Commit 04a97fbd authored by Dio Maulana's avatar Dio Maulana

config from API and add Video

parent cfeb0e2f
{
"status": "ok",
"code": "OK",
"msg": "",
"data": {
"order": {
"id": "a13004c9ba18459586212b7155d7348e",
"business_date": "2022-03-15",
"bdy": 2022,
"bdm": 3,
"bdd": 15,
"bdh": 11,
"bdi": 0,
"start_time": "2022-03-15T04:00:46",
"sth": 11,
"sti": 0,
"transaction_time": "",
"duration": 19845,
"counter": "",
"table_key": "62559116f816440b94e46b10be08ad3e",
"table_name": "I02",
"order_type": 0,
"kind": "Normal",
"table_section_id": "68fb6b92-901d-4b49-bec0-3a0bbd2c3018",
"table_section_name": "INDOOR",
"order_user_id": "d31d7ad3-ba86-4ea3-9300-cb99c9e2ac3f",
"order_user_name": "Kasir",
"cashier_user_id": null,
"cashier_user_name": "",
"base_total": "232454.00",
"discount_amount": "0.00",
"tax_base_undiscounted": "232454.00",
"tax_base": "232454.00",
"tax_amount": "23246.00",
"tax_sales": "23246.00",
"tax_percent": "0.00",
"subtotal": "232454.00",
"rounding": "0.00",
"total": "255700.00",
"pax": 1,
"note": "",
"name": "",
"pbn": "",
"print_count": 0,
"is_locked": false,
"flags": "",
"order_detail": [
{
"id": "be2b6f7615634af296e51315d9d92e58",
"ordering": 0,
"brand_id": "083dfff6-7489-40c8-af89-05c3122c8c29",
"brand_code": "EXC",
"branch_id": "b04f92ae-b389-469d-9afd-42e6ab3d8ffc",
"branch_code": "PMA",
"business_date": "2022-03-15",
"item_category_id": "3922c774-07d8-499e-abc0-0f7e113f8aa1",
"item_category_name": "FOOD - TEST KALAU NAMANYA PANJANG",
"item_subcategory_id": "e5d5f314-482e-4b9d-b40c-4a7ec59fda5a",
"item_subcategory_name": "FI - EXC COMPANIONS",
"item_id": "d65be82e-262b-4ece-8e78-00e3ae83f2f2",
"parent_item_code": "",
"price_set": {
"id": "c0f1befaf9b64d7bbd1410d06f55055b",
"brand_name": "Excelso",
"name": "P-JAKARTA"
},
"promotion_id": null,
"promotion_code": "",
"user_id": "d31d7ad3-ba86-4ea3-9300-cb99c9e2ac3f",
"user_name": "Kasir",
"quantity": "1.000",
"price": "78000.00",
"original_price": "78000.00",
"base_total": "78000.00",
"original_total": "78000.00",
"discount_total": "0.00",
"subtotal": "78000.00",
"discount": null,
"discount_value": "0.00",
"discount_percent": "0.00",
"discount_is_value": false,
"custom_discount_percent": "0.00",
"custom_discount_value": "0.00",
"discount_is_custom": false,
"tax_preset": {
"id": "0ad791ce5d2545d7a1face07dda510a6",
"brand": "Excelso",
"name": "PB1",
"code": "PB1",
"bill_name": "PB1",
"amount": "10.00",
"rounding_type": 2,
"is_service_taxable": true,
"is_charge1_taxable": false,
"is_charge2_taxable": false,
"is_charge3_taxable": false,
"is_inclusive": false,
"tax_mode": 1,
"priority": 1
},
"tax_base_undiscounted": "78000.00",
"tax_base": "78000.00",
"tax_percent": "10.00",
"tax_sales": "7800.00",
"tax_service": "0.00",
"tax_total": "7800.00",
"service_percent": "0.00",
"service_value": "0.00",
"total": "85800.00",
"rate": "1.00",
"code": "10JFD0301000061",
"name": "Dory Sambal Sereh with Sautee Corn Peas & Butter Rice",
"original_name": "Dory Sambal Sereh with Sautee Corn Peas & Butter Rice",
"alt_name": "",
"description": "",
"void_reason": null,
"mode": 0,
"price_state": 0,
"is_printed": false,
"is_print_local": false,
"printer": null,
"is_permanent": false,
"is_prevent_delete": false,
"build_number": "",
"order_id": "a13004c9-ba18-4595-8621-2b7155d7348e",
"order_options": "",
"order_detail_options": [],
"create_stamp": "2022-03-15T08:53:48.957Z"
},
{
"id": "465263f1b37047249e3f723458bfec15",
"ordering": 0,
"brand_id": "083dfff6-7489-40c8-af89-05c3122c8c29",
"brand_code": "EXC",
"branch_id": "b04f92ae-b389-469d-9afd-42e6ab3d8ffc",
"branch_code": "PMA",
"business_date": "2022-03-15",
"item_category_id": "3922c774-07d8-499e-abc0-0f7e113f8aa1",
"item_category_name": "FOOD - TEST KALAU NAMANYA PANJANG",
"item_subcategory_id": "e5d5f314-482e-4b9d-b40c-4a7ec59fda5a",
"item_subcategory_name": "FI - EXC COMPANIONS",
"item_id": "55164787-9649-45e9-99ef-1d5d8579519f",
"parent_item_code": "",
"price_set": {
"id": "c0f1befaf9b64d7bbd1410d06f55055b",
"brand_name": "Excelso",
"name": "P-JAKARTA"
},
"promotion_id": null,
"promotion_code": "",
"user_id": "d31d7ad3-ba86-4ea3-9300-cb99c9e2ac3f",
"user_name": "Kasir",
"quantity": "1.000",
"price": "50000.00",
"original_price": "50000.00",
"base_total": "50000.00",
"original_total": "50000.00",
"discount_total": "0.00",
"subtotal": "50000.00",
"discount": null,
"discount_value": "0.00",
"discount_percent": "0.00",
"discount_is_value": false,
"custom_discount_percent": "0.00",
"custom_discount_value": "0.00",
"discount_is_custom": false,
"tax_preset": {
"id": "0ad791ce5d2545d7a1face07dda510a6",
"brand": "Excelso",
"name": "PB1",
"code": "PB1",
"bill_name": "PB1",
"amount": "10.00",
"rounding_type": 2,
"is_service_taxable": true,
"is_charge1_taxable": false,
"is_charge2_taxable": false,
"is_charge3_taxable": false,
"is_inclusive": false,
"tax_mode": 1,
"priority": 1
},
"tax_base_undiscounted": "50000.00",
"tax_base": "50000.00",
"tax_percent": "10.00",
"tax_sales": "5000.00",
"tax_service": "0.00",
"tax_total": "5000.00",
"service_percent": "0.00",
"service_value": "0.00",
"total": "55000.00",
"rate": "1.00",
"code": "10JFD0301000052",
"name": "BUND CHEESY GARLIC CHICKEN BUN+IC CAFE LATTE",
"original_name": "BUND CHEESY GARLIC CHICKEN BUN+IC CAFE LATTE",
"alt_name": "",
"description": "",
"void_reason": null,
"mode": 0,
"price_state": 0,
"is_printed": false,
"is_print_local": false,
"printer": null,
"is_permanent": false,
"is_prevent_delete": false,
"build_number": "",
"order_id": "a13004c9-ba18-4595-8621-2b7155d7348e",
"order_options": "",
"order_detail_options": [],
"create_stamp": "2022-03-15T08:46:25.372Z"
},
{
"id": "f0f96e9b0ffe4534a5724ac1f32c4d06",
"ordering": 0,
"brand_id": "083dfff6-7489-40c8-af89-05c3122c8c29",
"brand_code": "EXC",
"branch_id": "b04f92ae-b389-469d-9afd-42e6ab3d8ffc",
"branch_code": "PMA",
"business_date": "2022-03-15",
"item_category_id": "0953e847-2df6-4a47-b7a3-848b15c610c4",
"item_category_name": "BEVERAGE",
"item_subcategory_id": "93d2631f-eee7-4f37-b64f-f9eeff40a02b",
"item_subcategory_name": "BI - EXC GOURMET COFFEE",
"item_id": "320e4acd-8c47-440e-8ac0-dc0c4374b7fc",
"parent_item_code": "",
"price_set": {
"id": "c0f1befaf9b64d7bbd1410d06f55055b",
"brand_name": "Excelso",
"name": "P-JAKARTA"
},
"promotion_id": null,
"promotion_code": "",
"user_id": "d31d7ad3-ba86-4ea3-9300-cb99c9e2ac3f",
"user_name": "Kasir",
"quantity": "2.000",
"price": "3000.00",
"original_price": "3000.00",
"base_total": "6000.00",
"original_total": "6000.00",
"discount_total": "0.00",
"subtotal": "6000.00",
"discount": null,
"discount_value": "0.00",
"discount_percent": "0.00",
"discount_is_value": false,
"custom_discount_percent": "0.00",
"custom_discount_value": "0.00",
"discount_is_custom": false,
"tax_preset": {
"id": "0ad791ce5d2545d7a1face07dda510a6",
"brand": "Excelso",
"name": "PB1",
"code": "PB1",
"bill_name": "PB1",
"amount": "10.00",
"rounding_type": 2,
"is_service_taxable": true,
"is_charge1_taxable": false,
"is_charge2_taxable": false,
"is_charge3_taxable": false,
"is_inclusive": false,
"tax_mode": 1,
"priority": 1
},
"tax_base_undiscounted": "6000.00",
"tax_base": "6000.00",
"tax_percent": "10.00",
"tax_sales": "600.00",
"tax_service": "0.00",
"tax_total": "600.00",
"service_percent": "0.00",
"service_value": "0.00",
"total": "6600.00",
"rate": "1.00",
"code": "11",
"name": "A KOPI",
"original_name": "A KOPI",
"alt_name": "",
"description": "",
"void_reason": null,
"mode": 0,
"price_state": 0,
"is_printed": true,
"is_print_local": false,
"printer": null,
"is_permanent": false,
"is_prevent_delete": false,
"build_number": "",
"order_id": "a13004c9-ba18-4595-8621-2b7155d7348e",
"order_options": "No Sugar; Extra Sugar",
"order_detail_options": [
{
"id": "5600c00375d449349954fd3702406d98",
"status": 2,
"ordering": 0,
"brand_code": "EXC",
"branch_code": "PMA",
"option_category": {
"id": "6f0ff66feec54fa4be9b54a0c87f8386",
"brand": "Excelso",
"name": "Coffee",
"ordering": 0
},
"option_category_name": "Coffee",
"option": {
"id": "4efdef9ac085457fa65a4eb4e79e172b",
"brand": "Excelso",
"option_category": {
"id": "6f0ff66feec54fa4be9b54a0c87f8386",
"brand": "Excelso",
"name": "Coffee",
"ordering": 0
},
"option_category_name": "Coffee",
"code": "NOSUGAR",
"name": "No Sugar",
"alt_name": "",
"is_global": false,
"is_print_local": false,
"ordering": 0,
"color": "FFFFFF",
"text_color": "000000"
},
"code": "NOSUGAR",
"name": "No Sugar",
"alt_name": "",
"quantity": "1.00",
"is_print_local": false,
"build_number": ""
},
{
"id": "9c44ce4f0d574b80977c43459024f1dc",
"status": 2,
"ordering": 0,
"brand_code": "EXC",
"branch_code": "PMA",
"option_category": {
"id": "6f0ff66feec54fa4be9b54a0c87f8386",
"brand": "Excelso",
"name": "Coffee",
"ordering": 0
},
"option_category_name": "Coffee",
"option": {
"id": "5725ba5a315340d0aa5afc85d30cf8e6",
"brand": "Excelso",
"option_category": {
"id": "6f0ff66feec54fa4be9b54a0c87f8386",
"brand": "Excelso",
"name": "Coffee",
"ordering": 0
},
"option_category_name": "Coffee",
"code": "EXTRASUGAR",
"name": "Extra Sugar",
"alt_name": "",
"is_global": false,
"is_print_local": false,
"ordering": 0,
"color": "FFFFFF",
"text_color": "000000"
},
"code": "EXTRASUGAR",
"name": "Extra Sugar",
"alt_name": "",
"quantity": "1.00",
"is_print_local": false,
"build_number": ""
}
],
"create_stamp": "2022-03-15T04:02:02.041Z"
},
{
"id": "402fd272179a453c9fc3699ec21f8682",
"ordering": 0,
"brand_id": "083dfff6-7489-40c8-af89-05c3122c8c29",
"brand_code": "EXC",
"branch_id": "b04f92ae-b389-469d-9afd-42e6ab3d8ffc",
"branch_code": "PMA",
"business_date": "2022-03-15",
"item_category_id": "0953e847-2df6-4a47-b7a3-848b15c610c4",
"item_category_name": "BEVERAGE",
"item_subcategory_id": "93d2631f-eee7-4f37-b64f-f9eeff40a02b",
"item_subcategory_name": "BI - EXC GOURMET COFFEE",
"item_id": "320e4acd-8c47-440e-8ac0-dc0c4374b7fc",
"parent_item_code": "",
"price_set": {
"id": "c0f1befaf9b64d7bbd1410d06f55055b",
"brand_name": "Excelso",
"name": "P-JAKARTA"
},
"promotion_id": null,
"promotion_code": "",
"user_id": "d31d7ad3-ba86-4ea3-9300-cb99c9e2ac3f",
"user_name": "Kasir",
"quantity": "1.000",
"price": "3000.00",
"original_price": "3000.00",
"base_total": "3000.00",
"original_total": "3000.00",
"discount_total": "0.00",
"subtotal": "3000.00",
"discount": null,
"discount_value": "0.00",
"discount_percent": "0.00",
"discount_is_value": false,
"custom_discount_percent": "0.00",
"custom_discount_value": "0.00",
"discount_is_custom": false,
"tax_preset": {
"id": "0ad791ce5d2545d7a1face07dda510a6",
"brand": "Excelso",
"name": "PB1",
"code": "PB1",
"bill_name": "PB1",
"amount": "10.00",
"rounding_type": 2,
"is_service_taxable": true,
"is_charge1_taxable": false,
"is_charge2_taxable": false,
"is_charge3_taxable": false,
"is_inclusive": false,
"tax_mode": 1,
"priority": 1
},
"tax_base_undiscounted": "3000.00",
"tax_base": "3000.00",
"tax_percent": "10.00",
"tax_sales": "300.00",
"tax_service": "0.00",
"tax_total": "300.00",
"service_percent": "0.00",
"service_value": "0.00",
"total": "3300.00",
"rate": "1.00",
"code": "11",
"name": "A KOPI",
"original_name": "A KOPI",
"alt_name": "",
"description": "",
"void_reason": null,
"mode": 0,
"price_state": 0,
"is_printed": true,
"is_print_local": false,
"printer": null,
"is_permanent": false,
"is_prevent_delete": false,
"build_number": "",
"order_id": "a13004c9-ba18-4595-8621-2b7155d7348e",
"order_options": "",
"order_detail_options": [],
"create_stamp": "2022-03-15T04:01:46.527Z"
},
{
"id": "5563563e72b2456591af563bce2647b3",
"ordering": 0,
"brand_id": "083dfff6-7489-40c8-af89-05c3122c8c29",
"brand_code": "EXC",
"branch_id": "b04f92ae-b389-469d-9afd-42e6ab3d8ffc",
"branch_code": "PMA",
"business_date": "2022-03-15",
"item_category_id": "0953e847-2df6-4a47-b7a3-848b15c610c4",
"item_category_name": "BEVERAGE",
"item_subcategory_id": "ce944289-6a9b-47f0-9300-70d9e218f261",
"item_subcategory_name": "BII - EXC BLEND COFFEE",
"item_id": "a94f3848-b9f8-49cf-8390-d767c11dd16a",
"parent_item_code": "",
"price_set": {
"id": "c0f1befaf9b64d7bbd1410d06f55055b",
"brand_name": "Excelso",
"name": "P-JAKARTA"
},
"promotion_id": null,
"promotion_code": "",
"user_id": "d31d7ad3-ba86-4ea3-9300-cb99c9e2ac3f",
"user_name": "Kasir",
"quantity": "2.000",
"price": "47727.00",
"original_price": "47727.27",
"base_total": "95454.00",
"original_total": "95454.54",
"discount_total": "0.00",
"subtotal": "95454.00",
"discount": null,
"discount_value": "0.00",
"discount_percent": "0.00",
"discount_is_value": false,
"custom_discount_percent": "0.00",
"custom_discount_value": "0.00",
"discount_is_custom": false,
"tax_preset": {
"id": "0ad791ce5d2545d7a1face07dda510a6",
"brand": "Excelso",
"name": "PB1",
"code": "PB1",
"bill_name": "PB1",
"amount": "10.00",
"rounding_type": 2,
"is_service_taxable": true,
"is_charge1_taxable": false,
"is_charge2_taxable": false,
"is_charge3_taxable": false,
"is_inclusive": false,
"tax_mode": 1,
"priority": 1
},
"tax_base_undiscounted": "95454.00",
"tax_base": "95454.00",
"tax_percent": "10.00",
"tax_sales": "9546.00",
"tax_service": "0.00",
"tax_total": "9546.00",
"service_percent": "0.00",
"service_value": "0.00",
"total": "105000.00",
"rate": "1.00",
"code": "10JBV0201000037",
"name": "CAPPUCCINO",
"original_name": "CAPPUCCINO",
"alt_name": "",
"description": "",
"void_reason": null,
"mode": 0,
"price_state": 0,
"is_printed": true,
"is_print_local": false,
"printer": null,
"is_permanent": false,
"is_prevent_delete": false,
"build_number": "",
"order_id": "a13004c9-ba18-4595-8621-2b7155d7348e",
"order_options": "No Ice; No Sugar",
"order_detail_options": [
{
"id": "3a8adb2f5030417684b2194433890269",
"status": 2,
"ordering": 0,
"brand_code": "EXC",
"branch_code": "PMA",
"option_category": {
"id": "6f0ff66feec54fa4be9b54a0c87f8386",
"brand": "Excelso",
"name": "Coffee",
"ordering": 0
},
"option_category_name": "Coffee",
"option": {
"id": "035c99d5065a4fe3b90b04e2789ff1da",
"brand": "Excelso",
"option_category": {
"id": "6f0ff66feec54fa4be9b54a0c87f8386",
"brand": "Excelso",
"name": "Coffee",
"ordering": 0
},
"option_category_name": "Coffee",
"code": "NOICE",
"name": "No Ice",
"alt_name": "",
"is_global": false,
"is_print_local": false,
"ordering": 0,
"color": "FFFFFF",
"text_color": "000000"
},
"code": "NOICE",
"name": "No Ice",
"alt_name": "",
"quantity": "1.00",
"is_print_local": false,
"build_number": ""
},
{
"id": "f070c2b5aa33453fa3f8259ddabb9cb9",
"status": 2,
"ordering": 0,
"brand_code": "EXC",
"branch_code": "PMA",
"option_category": {
"id": "6f0ff66feec54fa4be9b54a0c87f8386",
"brand": "Excelso",
"name": "Coffee",
"ordering": 0
},
"option_category_name": "Coffee",
"option": {
"id": "4efdef9ac085457fa65a4eb4e79e172b",
"brand": "Excelso",
"option_category": {
"id": "6f0ff66feec54fa4be9b54a0c87f8386",
"brand": "Excelso",
"name": "Coffee",
"ordering": 0
},
"option_category_name": "Coffee",
"code": "NOSUGAR",
"name": "No Sugar",
"alt_name": "",
"is_global": false,
"is_print_local": false,
"ordering": 0,
"color": "FFFFFF",
"text_color": "000000"
},
"code": "NOSUGAR",
"name": "No Sugar",
"alt_name": "",
"quantity": "1.00",
"is_print_local": false,
"build_number": ""
}
],
"create_stamp": "2022-03-15T04:01:09.526Z"
}
],
"order_payment": [],
"payment_paid": 0,
"payment_owed": "255700.00"
}
}
}
\ No newline at end of file
import 'dart:convert'; import 'dart:convert';
import 'package:second_display/helper/config.dart'; import 'package:second_display/helper/config.dart';
import 'package:second_display/models/config_display.dart';
import 'package:second_display/models/order_detail.dart'; import 'package:second_display/models/order_detail.dart';
import 'package:second_display/models/orders.dart'; import 'package:second_display/models/orders.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'package:flutter/services.dart' as bundel_root;
class Api { class Api {
static Future<CustomerOrders> getOrders() async { static Future<CustomerOrders> getOrders() async {
String apiUrl = getOrdersUrl; /// url get data dari midware getby id, need session
CustomerOrders customerOrdersList = CustomerOrders( // String apiUrl = getOrdersUrl;
order_user_name: "",
total: "0.0", /// url get data dari midware getorder, no need session
discount_amount: "0.0", String apiUrl = getJsonUrl;
orderCount: 0,
subtotal: "0.0", CustomerOrders customerOrdersList = modelCustomerOrder;
tax: "0");
try { try {
Map data = { /// load data dari json local
"session_key": "d289c7d6dfc04690b4149b93c91aef8a", // String datas = await bundel_root.rootBundle.loadString('file.json');
"user_id": "d31d7ad3ba864ea39300cb99c9e2ac3f", // var jsonObject = jsonDecode(datas);
"ignore_lock": "", /// load data dari json local
"order_id": "a13004c9ba18459586212b7155d7348e"
}; /// load data dari api midware getby id
// Map data = {
// "session_key": "d289c7d6dfc04690b4149b93c91aef8a",
// "user_id": "d31d7ad3ba864ea39300cb99c9e2ac3f",
// "ignore_lock": "",
// "order_id": "a13004c9ba18459586212b7155d7348e"
// };
// var bodi = jsonEncode(data);
// var apiresults = await http.post(Uri.parse(apiUrl), body: bodi);
// var jsonObject = jsonDecode(apiresults.body);
/// load data dari api midware getby id
/// load data dari midwar file json
Map data = {};
var bodi = jsonEncode(data); var bodi = jsonEncode(data);
var apiresults = await http.post(Uri.parse(apiUrl), body: bodi); var apiresults = await http.post(Uri.parse(apiUrl), body: bodi);
var jsonObject = jsonDecode(apiresults.body); var jsonObject = jsonDecode(apiresults.body);
/// load data dari midwar file json
List<dynamic> orderDetailCount = (jsonObject List<dynamic> orderDetailCount = (jsonObject
as Map<dynamic, dynamic>)['data']['order']['order_detail']; as Map<dynamic, dynamic>)['data']['order']['order_detail'];
var jsonMap = jsonObject['data']['order']; var jsonMap = jsonObject['data']['order'];
String orderuserName = jsonMap['order_user_name']; String orderuserName = jsonMap['id'].substring(0, 5);
String total = jsonMap['total']; String total = jsonMap['total'];
String discountAmount = jsonMap['discount_amount']; String discountAmount = jsonMap['discount_amount'];
int orderCounts = orderDetailCount.length; int orderCounts = orderDetailCount.length;
String subtotal = jsonMap['subtotal']; String subtotal = jsonMap['subtotal'];
String tax = jsonMap['tax_amount']; String tax = jsonMap['tax_amount'];
customerOrdersList.order_user_name = orderuserName; String pax = jsonMap['pax'].toString();
String tableName = jsonMap['table_name'];
String tableSecName = jsonMap['table_section_name'];
String dateOrder = jsonMap['start_time'];
String orderusername = jsonMap['order_user_name'];
customerOrdersList.id = orderuserName;
customerOrdersList.total = total; customerOrdersList.total = total;
customerOrdersList.discount_amount = discountAmount; customerOrdersList.discount_amount = discountAmount;
customerOrdersList.orderCount = orderCounts; customerOrdersList.orderCount = orderCounts;
customerOrdersList.subtotal = subtotal; customerOrdersList.subtotal = subtotal;
customerOrdersList.tax = tax; customerOrdersList.tax = tax;
customerOrdersList.pax = pax;
customerOrdersList.table_name = tableName;
customerOrdersList.table_section_name = tableSecName;
customerOrdersList.dateOrder = dateOrder;
customerOrdersList.order_user_name = orderusername;
return customerOrdersList; return customerOrdersList;
} catch (e) { } catch (e) {
...@@ -49,24 +80,55 @@ class Api { ...@@ -49,24 +80,55 @@ class Api {
} }
static Future<List<CustomerOrdersDetail>> getOrderDetail() async { static Future<List<CustomerOrdersDetail>> getOrderDetail() async {
String apiUrl = getOrdersUrl; // String apiUrl = getOrdersUrl;
String apiUrl = getJsonUrl;
try { try {
List<CustomerOrdersDetail> listOrderDetail = []; List<CustomerOrdersDetail> listOrderDetail = [];
Map data = {
"session_key": "d289c7d6dfc04690b4149b93c91aef8a", /// load data dari json local
"user_id": "d31d7ad3ba864ea39300cb99c9e2ac3f", // String datas = await bundel_root.rootBundle.loadString('file.json');
"ignore_lock": "", // var jsonObject = jsonDecode(datas);
"order_id": "a13004c9ba18459586212b7155d7348e" /// load data dari json local
};
/// load data dari api midware getby id
// Map data = {
// "session_key": "d289c7d6dfc04690b4149b93c91aef8a",
// "user_id": "d31d7ad3ba864ea39300cb99c9e2ac3f",
// "ignore_lock": "",
// "order_id": "a13004c9ba18459586212b7155d7348e"
// };
// var bodi = jsonEncode(data);
// var apiresults = await http.post(Uri.parse(apiUrl), body: bodi);
// var jsonObject = jsonDecode(apiresults.body);
/// load data dari api midware getby id
/// load data dari midwar file json
Map data = {};
var bodi = jsonEncode(data); var bodi = jsonEncode(data);
var apiresults = await http.post(Uri.parse(apiUrl), body: bodi); var apiresults = await http.post(Uri.parse(apiUrl), body: bodi);
var jsonObject = jsonDecode(apiresults.body); var jsonObject = jsonDecode(apiresults.body);
/// load data dari midwar file json
List<dynamic> listDetail = (jsonObject as Map<dynamic, dynamic>)['data'] List<dynamic> listDetail = (jsonObject as Map<dynamic, dynamic>)['data']
['order']['order_detail']; ['order']['order_detail'];
for (int i = 0; i < listDetail.length; i++) { for (int i = 0; i < listDetail.length; i++) {
listOrderDetail listOrderDetail
.add(CustomerOrdersDetail.createOrderDetail(listDetail[i])); .add(CustomerOrdersDetail.createOrderDetail(listDetail[i]));
// List<dynamic> optionOrderDetail =
// (jsonObject as Map<dynamic, dynamic>)['data']['order']
// ['order_detail'][i]['order_detail_options'];
// print(optionOrderDetail.length);
// if (optionOrderDetail.isNotEmpty) {
// for (int j = 0; j < optionOrderDetail.length; j++) {
// listOrderDetail.add(
// CustomerOrdersDetail(optionName: optionOrderDetail[j]['name']));
// }
// }
} }
return listOrderDetail; return listOrderDetail;
} catch (e) { } catch (e) {
...@@ -74,4 +136,26 @@ class Api { ...@@ -74,4 +136,26 @@ class Api {
return []; return [];
} }
} }
static Future<List<ConfigDisplay>> getConfigDisplay() async {
String apiUrl = apiUrlConfig;
List<ConfigDisplay> configList = [];
try {
Map data = {};
var bodi = jsonEncode(data);
var apiresults = await http.post(Uri.parse(apiUrl), body: bodi);
var jsonObject = jsonDecode(apiresults.body);
List<dynamic> listConfig = (jsonObject as Map<dynamic, dynamic>)['data'];
for (int i = 0; i < listConfig.length; i++) {
configList.add(ConfigDisplay.createConfig(listConfig[i]));
}
return configList;
} catch (e) {
return [];
}
}
} }
import 'package:second_display/api/api.dart';
import 'package:second_display/models/config_display.dart';
import 'package:bloc/bloc.dart';
class ConfigDisplayBloc extends Cubit<List<ConfigDisplay>> {
ConfigDisplayBloc() : super([]);
Future<List<ConfigDisplay>> getData() async {
var orderDetail = await Api.getConfigDisplay();
return orderDetail;
}
void getConfigDisplay() {
getData().then((value) {
emit(value);
});
}
}
import 'package:second_display/api/api.dart'; import 'package:second_display/api/api.dart';
import 'package:second_display/helper/config.dart';
import 'package:second_display/models/orders.dart'; import 'package:second_display/models/orders.dart';
import 'package:bloc/bloc.dart'; import 'package:bloc/bloc.dart';
class OrdersBloc extends Cubit<CustomerOrders> { class OrdersBloc extends Cubit<CustomerOrders> {
OrdersBloc() OrdersBloc() : super(modelCustomerOrder);
: super(CustomerOrders(
order_user_name: "",
total: "",
discount_amount: "",
orderCount: 0,
subtotal: "",
tax: "0"));
Future<CustomerOrders> getData() async { Future<CustomerOrders> getData() async {
return await Api.getOrders(); return await Api.getOrders();
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:second_display/models/orders.dart';
final Color textColor = Colors.white; // final Color textColor = Colors.white;
final Color colorBackgroundOrder = Colors.black.withOpacity(0.8); // final Color colorBackgroundOrder = Colors.black.withOpacity(0.8);
final Color colorBackgroundCarousel = Colors.black;
final String getOrdersUrl = "http://192.168.2.142:8001/midware/order/get_by_id"; final String getOrdersUrl = "http://192.168.2.142:8001/midware/order/get_by_id";
final String apiUrlConfig =
"http://192.168.2.142:8001/queue/config_second_display";
final String getJsonUrl =
"http://192.168.2.142:8001/midware/order/get_for_second_display";
late CustomerOrders modelCustomerOrder = CustomerOrders(
id: "",
total: "",
discount_amount: "",
orderCount: 0,
subtotal: "",
tax: "0",
pax: "0",
table_name: "",
table_section_name: "",
dateOrder: "",
order_user_name: "");
final List<String> imgList = [ final List<String> imgList = [
'https://images.unsplash.com/photo-1520342868574-5fa3804e551c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=6ff92caffcdd63681a35134a6770ed3b&auto=format&fit=crop&w=1951&q=80', 'https://images.unsplash.com/photo-1520342868574-5fa3804e551c?ixlib=rb-0.3.5&ixid=eyJhcHBfaWQiOjEyMDd9&s=6ff92caffcdd63681a35134a6770ed3b&auto=format&fit=crop&w=1951&q=80',
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:second_display/bloc/config_display_blog.dart';
import 'package:second_display/bloc/order_detail.dart'; import 'package:second_display/bloc/order_detail.dart';
import 'package:second_display/bloc/orders_bloc.dart'; import 'package:second_display/bloc/orders_bloc.dart';
import 'package:second_display/ui/main_page.dart'; import 'package:second_display/ui/main_page.dart';
import 'package:second_display/ui/splash.dart';
import 'package:url_strategy/url_strategy.dart'; import 'package:url_strategy/url_strategy.dart';
void main() async { void main() async {
...@@ -21,12 +23,14 @@ class MyApp extends StatelessWidget { ...@@ -21,12 +23,14 @@ class MyApp extends StatelessWidget {
providers: [ providers: [
BlocProvider(create: (_) => OrdersBloc()), BlocProvider(create: (_) => OrdersBloc()),
BlocProvider(create: (_) => OrderDetailBloc()), BlocProvider(create: (_) => OrderDetailBloc()),
BlocProvider(create: (_) => ConfigDisplayBloc())
], ],
child: MaterialApp( child: MaterialApp(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
initialRoute: '/', initialRoute: '/',
routes: { routes: {
'/': (context) => const MainPage(), '/': (context) => Splash(),
'/main': (context) => MainPage(),
}, },
), ),
); );
......
class ConfigDisplay {
final String backgroundColorCarouselVideo;
final String textColor;
final String backgroundColorOrder;
final int isVideo;
ConfigDisplay(
{required this.backgroundColorCarouselVideo,
required this.textColor,
required this.backgroundColorOrder,
required this.isVideo});
factory ConfigDisplay.createConfig(Map<String, dynamic> json) {
return ConfigDisplay(
backgroundColorCarouselVideo:
json['background_color_carousel_video'].toString(),
textColor: json['text_color'].toString(),
backgroundColorOrder: json['background_color_order'],
isVideo: json['is_video']);
}
}
class CustomerOrdersDetail { class CustomerOrdersDetail {
late String name; late String name;
late String total; late String total;
late String quantity;
late String optionOrder;
CustomerOrdersDetail({required this.name, required this.total}); CustomerOrdersDetail({
this.name = "",
this.total = "",
this.quantity = "",
this.optionOrder = "",
});
factory CustomerOrdersDetail.createOrderDetail(Map<String, dynamic> json) { factory CustomerOrdersDetail.createOrderDetail(Map<String, dynamic> json) {
return CustomerOrdersDetail( return CustomerOrdersDetail(
name: json['name'].toString(), name: json['name'].toString(),
total: json['subtotal'].toString(), total: json['subtotal'].toString(),
); quantity: json['quantity'].toString(),
optionOrder: json['order_options']);
} }
} }
class CustomerOrders { class CustomerOrders {
late String order_user_name; late String id;
late String total; late String total;
late String discount_amount; late String discount_amount;
late int orderCount; late int orderCount;
late String subtotal; late String subtotal;
late String tax; late String tax;
late String pax;
late String table_name;
late String table_section_name;
late String dateOrder;
late String order_user_name;
CustomerOrders( CustomerOrders({
{required this.order_user_name, required this.id,
required this.total, required this.total,
required this.discount_amount, required this.discount_amount,
required this.orderCount, required this.orderCount,
required this.subtotal, required this.subtotal,
required this.tax}); required this.tax,
required this.pax,
required this.table_name,
required this.table_section_name,
required this.dateOrder,
required this.order_user_name,
});
} }
...@@ -3,8 +3,9 @@ import 'package:flutter/material.dart'; ...@@ -3,8 +3,9 @@ import 'package:flutter/material.dart';
import 'package:second_display/helper/config.dart'; import 'package:second_display/helper/config.dart';
class CarouselIndicator extends StatefulWidget { class CarouselIndicator extends StatefulWidget {
const CarouselIndicator({Key? key}) : super(key: key); final Color backgroundColor;
const CarouselIndicator({Key? key, required this.backgroundColor})
: super(key: key);
@override @override
State<CarouselIndicator> createState() => _CarouselIndicatorState(); State<CarouselIndicator> createState() => _CarouselIndicatorState();
} }
...@@ -58,7 +59,7 @@ class _CarouselIndicatorState extends State<CarouselIndicator> { ...@@ -58,7 +59,7 @@ class _CarouselIndicatorState extends State<CarouselIndicator> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Container( body: Container(
color: colorBackgroundCarousel, color: widget.backgroundColor,
child: Column(children: [ child: Column(children: [
Expanded( Expanded(
child: CarouselSlider( child: CarouselSlider(
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:second_display/bloc/config_display_blog.dart';
import 'package:second_display/bloc/order_detail.dart'; import 'package:second_display/bloc/order_detail.dart';
import 'package:second_display/bloc/orders_bloc.dart'; import 'package:second_display/bloc/orders_bloc.dart';
import 'package:second_display/helper/config.dart'; import 'package:second_display/models/config_display.dart';
import 'package:second_display/ui/carousel.dart'; import 'package:second_display/ui/carousel.dart';
import 'package:second_display/ui/orders.dart'; import 'package:second_display/ui/orders.dart';
import 'package:second_display/ui/video_promotion.dart';
// ignore: must_be_immutable
class MainPage extends StatelessWidget { class MainPage extends StatelessWidget {
const MainPage({Key? key}) : super(key: key); MainPage({Key? key}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
context.read<OrdersBloc>().getOrderList(); context.read<OrdersBloc>().getOrderList();
context.read<OrderDetailBloc>().getOrderDetailList(); context.read<OrderDetailBloc>().getOrderDetailList();
return MaterialApp( return MaterialApp(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
home: Scaffold( home: Scaffold(body: BlocBuilder<ConfigDisplayBloc, List<ConfigDisplay>>(
body: Row( builder: (context, configState) {
children: [ int valueIntBackgroundColorCarouselVideo =
Container( int.parse(configState[0].backgroundColorCarouselVideo, radix: 16);
height: MediaQuery.of(context).size.height, final Color colorBackgroundCarouselandVideo =
width: MediaQuery.of(context).size.width * 0.6, Color(valueIntBackgroundColorCarouselVideo);
// color: Colors.red,
child: CarouselIndicator(), int valueIntTextColor =
), int.parse(configState[0].textColor, radix: 16);
Container( final Color textColor = Color(valueIntTextColor);
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.4, int valueIntBackgroundColorOrder =
color: colorBackgroundOrder, int.parse(configState[0].backgroundColorOrder, radix: 16);
child: OrderPage(), final Color backgroundColorOrder =
) Color(valueIntBackgroundColorOrder);
],
return Row(
children: [
(configState[0].isVideo == 1)
? Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.6,
color: colorBackgroundCarouselandVideo,
child: VideoPromotion(),
)
: Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.6,
child: CarouselIndicator(
backgroundColor: colorBackgroundCarouselandVideo),
),
Container(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.4,
color: backgroundColorOrder,
child: OrderPage(textColor: textColor),
)
],
);
},
)), )),
); );
} }
......
...@@ -2,13 +2,13 @@ import 'package:flutter/material.dart'; ...@@ -2,13 +2,13 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:second_display/bloc/order_detail.dart'; import 'package:second_display/bloc/order_detail.dart';
import 'package:second_display/bloc/orders_bloc.dart'; import 'package:second_display/bloc/orders_bloc.dart';
import 'package:second_display/helper/config.dart';
import 'package:second_display/models/order_detail.dart'; import 'package:second_display/models/order_detail.dart';
import 'package:second_display/models/orders.dart'; import 'package:second_display/models/orders.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
class OrderPage extends StatelessWidget { class OrderPage extends StatelessWidget {
const OrderPage({Key? key}) : super(key: key); final Color textColor;
const OrderPage({Key? key, required this.textColor}) : super(key: key);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
...@@ -22,13 +22,25 @@ class OrderPage extends StatelessWidget { ...@@ -22,13 +22,25 @@ class OrderPage extends StatelessWidget {
var discountAmountText = formatCurrency().format(discountAmount); var discountAmountText = formatCurrency().format(discountAmount);
var subTotalAmountText = formatCurrency().format(subTotalAmount); var subTotalAmountText = formatCurrency().format(subTotalAmount);
var taxAmountText = formatCurrency().format(taxAmount); var taxAmountText = formatCurrency().format(taxAmount);
String? timeOrder;
if (list.dateOrder != '') {
var dateFormat = DateFormat("yyyy-MM-ddTHH:mm:ss")
.parse(list.dateOrder, true)
.toLocal();
var afterFormat =
DateFormat('dd MMM yyyy HH:mm:ss').format(dateFormat);
timeOrder = afterFormat.toString();
} else {
timeOrder = '';
}
return Container( return Container(
// color: Colors.black.withOpacity(0.8), // color: Colors.black.withOpacity(0.8),
margin: EdgeInsets.fromLTRB( margin: EdgeInsets.fromLTRB(
MediaQuery.of(context).size.width * 0.05, MediaQuery.of(context).size.width * 0.02,
MediaQuery.of(context).size.height * 0.05, MediaQuery.of(context).size.height * 0.02,
MediaQuery.of(context).size.width * 0.05, MediaQuery.of(context).size.width * 0.02,
MediaQuery.of(context).size.height * 0.05), MediaQuery.of(context).size.height * 0.02),
child: Column( child: Column(
children: [ children: [
Container( Container(
...@@ -37,15 +49,43 @@ class OrderPage extends StatelessWidget { ...@@ -37,15 +49,43 @@ class OrderPage extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Text( Column(
list.order_user_name, mainAxisAlignment: MainAxisAlignment.center,
style: TextStyle( children: [
fontSize: MediaQuery.of(context).size.height * 0.05, Text(
color: textColor), "Kasir",
style: TextStyle(
fontSize:
MediaQuery.of(context).size.height * 0.04,
color: textColor),
),
],
)
],
),
),
Container(
// color: Colors.green,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Column(
children: [
topList(context, "Order ID: " + list.id.toUpperCase(),
timeOrder),
topList(context, list.table_section_name,
"Tabel Section: " + list.table_name),
],
) )
], ],
), ),
), ),
Expanded(
child: Divider(
color: Colors.white,
height: MediaQuery.of(context).size.height * 0.01,
thickness: MediaQuery.of(context).size.height * 0.003,
)),
Container( Container(
// color: Colors.blue, // color: Colors.blue,
height: MediaQuery.of(context).size.height * 0.5, height: MediaQuery.of(context).size.height * 0.5,
...@@ -54,6 +94,8 @@ class OrderPage extends StatelessWidget { ...@@ -54,6 +94,8 @@ class OrderPage extends StatelessWidget {
return ListView.builder( return ListView.builder(
itemCount: detailOrder.length, itemCount: detailOrder.length,
itemBuilder: (context, i) { itemBuilder: (context, i) {
var optionStr = detailOrder[i].optionOrder;
var OrderOptionDetail = optionStr.split(';');
var amountEachOrder = var amountEachOrder =
double.tryParse(detailOrder[i].total) ?? 0; double.tryParse(detailOrder[i].total) ?? 0;
var amountEachOrderText = var amountEachOrderText =
...@@ -64,23 +106,56 @@ class OrderPage extends StatelessWidget { ...@@ -64,23 +106,56 @@ class OrderPage extends StatelessWidget {
Column( Column(
children: [ children: [
Container( Container(
// color: Colors.white,
height:
MediaQuery.of(context).size.height * 0.05,
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: MediaQuery.of(context).size.height * top: MediaQuery.of(context).size.height *
0.005, 0.005,
bottom: bottom:
MediaQuery.of(context).size.height * MediaQuery.of(context).size.height *
0.005), 0),
child: Row( child: Row(
children: [ children: [
listOforder(context, Alignment.centerLeft, listOforder(
"1 " + detailOrder[i].name), context,
Alignment.centerLeft,
double.tryParse(
detailOrder[i].quantity)
.toString() +
" x " +
detailOrder[i].name),
listOforder( listOforder(
context, context,
Alignment.centerRight, Alignment.centerRight,
amountEachOrderText) amountEachOrderText)
], ],
), ),
) ),
for (int i = 0;
i < OrderOptionDetail.length;
i++)
Container(
height: MediaQuery.of(context).size.height *
0.02,
margin: EdgeInsets.only(
top:
MediaQuery.of(context).size.height *
0.001,
bottom:
MediaQuery.of(context).size.height *
0.001),
child: Row(
children: [
listOforderOption(
context,
Alignment.topLeft,
OrderOptionDetail[i].trim()),
listOforderOption(
context, Alignment.centerRight, '')
],
),
),
], ],
) )
], ],
...@@ -99,34 +174,46 @@ class OrderPage extends StatelessWidget { ...@@ -99,34 +174,46 @@ class OrderPage extends StatelessWidget {
SizedBox(height: MediaQuery.of(context).size.height * 0.01), SizedBox(height: MediaQuery.of(context).size.height * 0.01),
Container( Container(
// color: Colors.green, // color: Colors.green,
height: MediaQuery.of(context).size.height * 0.29, height: MediaQuery.of(context).size.height * 0.25,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: [ children: [
Column( BlocBuilder<OrderDetailBloc, List<CustomerOrdersDetail>>(
children: [ builder: (context, itemTotal) {
Text( late int totalQuantity = 0;
"Total Rincian", for (int i = 0; i < itemTotal.length; i++) {
style: TextStyle( var quantity =
color: textColor, double.tryParse(itemTotal[i].quantity) ?? 0;
fontSize: totalQuantity = totalQuantity + quantity.toInt();
MediaQuery.of(context).size.height * 0.046), }
), return Column(
SizedBox( children: [
height: MediaQuery.of(context).size.height * 0.005), // Text(
listTotalRincian( // "Total Rincian",
context, // style: TextStyle(
list.orderCount.toString() + " Item", // color: textColor,
subTotalAmountText + ",-"), // fontSize:
listTotalRincian( // MediaQuery.of(context).size.height * 0.03),
context, "Diskon", discountAmountText + ",-"), // ),
listTotalRincian( SizedBox(
context, "Pajak", taxAmountText + ",-"), height:
SizedBox( MediaQuery.of(context).size.height * 0.01),
height: MediaQuery.of(context).size.height * 0.02), listTotalRincian(
listTotalRincian( context, "Subtotal", subTotalAmountText + ",-"),
context, "Total", totalAmountText + ",-"), listTotalRincian(
], context, "Diskon", discountAmountText + ",-"),
listTotalRincian(
context, "Pajak", taxAmountText + ",-"),
listTotalRincian(context, "Total Item",
totalQuantity.toString()),
SizedBox(
height:
MediaQuery.of(context).size.height * 0.02),
listTotalRincian(
context, "Total", totalAmountText + ",-"),
],
);
},
) )
], ],
), ),
...@@ -138,12 +225,55 @@ class OrderPage extends StatelessWidget { ...@@ -138,12 +225,55 @@ class OrderPage extends StatelessWidget {
); );
} }
Container topList(BuildContext context, String kiri, String kanan) {
return Container(
// color: Colors.green,
margin: EdgeInsets.only(
top: MediaQuery.of(context).size.height * 0.0001,
bottom: MediaQuery.of(context).size.height * 0.0001),
child: Row(
children: [
Container(
// color: Colors.white,
height: MediaQuery.of(context).size.height * 0.02,
width: MediaQuery.of(context).size.width * 0.13,
child: Align(
alignment: Alignment.centerLeft,
child: Text(
kiri,
style: TextStyle(
fontSize: MediaQuery.of(context).size.height * 0.015,
color: textColor.withOpacity(0.5)),
),
),
),
Container(
// color: Colors.white,
height: MediaQuery.of(context).size.height * 0.02,
width: MediaQuery.of(context).size.width * 0.13,
child: Align(
alignment: Alignment.centerRight,
child: Text(
kanan,
style: TextStyle(
fontSize: MediaQuery.of(context).size.height * 0.015,
color: textColor.withOpacity(0.5)),
),
),
),
],
),
);
}
NumberFormat formatCurrency() => NumberFormat formatCurrency() =>
NumberFormat.currency(locale: 'id', symbol: 'Rp ', decimalDigits: 0); NumberFormat.currency(locale: 'id', symbol: 'Rp ', decimalDigits: 0);
Container listTotalRincian( Container listTotalRincian(
BuildContext context, String textKiri, String textKanan) { BuildContext context, String textKiri, String textKanan) {
return Container( return Container(
// color: Colors.white,
height: MediaQuery.of(context).size.height * 0.03,
margin: EdgeInsets.only( margin: EdgeInsets.only(
top: MediaQuery.of(context).size.height * 0.0001, top: MediaQuery.of(context).size.height * 0.0001,
bottom: MediaQuery.of(context).size.height * 0.0001), bottom: MediaQuery.of(context).size.height * 0.0001),
...@@ -159,17 +289,37 @@ class OrderPage extends StatelessWidget { ...@@ -159,17 +289,37 @@ class OrderPage extends StatelessWidget {
Container listOforder(BuildContext context, Alignment align, String text) { Container listOforder(BuildContext context, Alignment align, String text) {
return Container( return Container(
// color: Colors.white, // color: Colors.white,
height: MediaQuery.of(context).size.height * 0.05, height: MediaQuery.of(context).size.height * 0.06,
width: MediaQuery.of(context).size.width * 0.13, width: MediaQuery.of(context).size.width * 0.13,
child: Align( child: Align(
alignment: align, alignment: align,
child: Text( child: Text(
text, text,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: TextStyle( style: TextStyle(
fontSize: MediaQuery.of(context).size.height * 0.025, fontSize: MediaQuery.of(context).size.height * 0.02,
color: textColor), color: textColor),
), ),
), ),
); );
} }
Container listOforderOption(
BuildContext context, Alignment align, String text) {
return Container(
// color: Colors.white,
height: MediaQuery.of(context).size.height * 0.05,
width: MediaQuery.of(context).size.width * 0.13,
child: Align(
alignment: align,
child: Text(
text,
style: TextStyle(
fontSize: MediaQuery.of(context).size.height * 0.015,
color: textColor.withOpacity(0.7)),
),
),
);
}
} }
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:loading_animations/loading_animations.dart';
import 'package:second_display/bloc/config_display_blog.dart';
import 'package:second_display/ui/main_page.dart';
class Splash extends StatefulWidget {
const Splash({Key? key}) : super(key: key);
@override
State<Splash> createState() => _SplashState();
}
class _SplashState extends State<Splash> {
// bool isLoaded = false;
// Future<List<ConfigApl>> config({url = ""}) async {
// // String? base_urlapi = prefs.getString('base_url');
// List<ConfigApl> apiConfigs = [];
// try {
// var apiConfig = await Api.getConfig(url: url);
// apiConfigs = apiConfig;
// return apiConfigs;
// } catch (e) {
// return apiConfigs;
// }
// }
@override
void initState() {
Future.delayed(const Duration(seconds: 2), () {
Navigator.push(context, MaterialPageRoute(builder: (_) => MainPage()));
});
super.initState();
}
@override
Widget build(BuildContext context) {
context.read<ConfigDisplayBloc>().getConfigDisplay();
return Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Please wait",
style: TextStyle(
fontSize: MediaQuery.of(context).size.height * 0.03,
fontWeight: FontWeight.w500,
color: Colors.black,
decoration: TextDecoration.none),
),
LoadingBumpingLine.circle(
size: MediaQuery.of(context).size.height * 0.1,
backgroundColor: Colors.black,
)
],
);
}
}
import 'package:flutter/material.dart';
import 'package:loading_animations/loading_animations.dart';
import 'package:video_player/video_player.dart';
class VideoPromotion extends StatefulWidget {
const VideoPromotion({Key? key}) : super(key: key);
@override
State<VideoPromotion> createState() => _VideoPromotionState();
}
class _VideoPromotionState extends State<VideoPromotion> {
VideoPlayerController? _controller;
@override
void initState() {
_controller = VideoPlayerController.network(
'https://media.istockphoto.com/videos/man-in-formal-suit-dancing-and-throwing-money-video-id892877794')
..setLooping(true)
..initialize().then((_) {
// Ensure the first frame is shown after the video is initialized, even before the play button has been pressed.
setState(() {});
});
_controller!.setVolume(0);
_controller!.play();
super.initState();
}
@override
Widget build(BuildContext context) {
return Center(
child: Container(
// color: Colors.green,
margin: EdgeInsets.fromLTRB(
MediaQuery.of(context).size.width * 0.05,
MediaQuery.of(context).size.height * 0.1,
MediaQuery.of(context).size.width * 0.05,
MediaQuery.of(context).size.height * 0.1),
child: _controller!.value.isInitialized
? AspectRatio(
aspectRatio: _controller!.value.aspectRatio,
child: VideoPlayer(_controller!),
)
: Center(
child: Container(
child: LoadingBumpingLine.circle(
size: MediaQuery.of(context).size.height * 0.1,
backgroundColor: Colors.black,
),
),
)),
);
}
}
...@@ -57,6 +57,13 @@ packages: ...@@ -57,6 +57,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.15.0" version: "1.15.0"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.1"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -100,6 +107,13 @@ packages: ...@@ -100,6 +107,13 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.15.0"
http: http:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -135,6 +149,13 @@ packages: ...@@ -135,6 +149,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.0.1" version: "1.0.1"
loading_animations:
dependency: "direct main"
description:
name: loading_animations
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
matcher: matcher:
dependency: transitive dependency: transitive
description: description:
...@@ -170,6 +191,13 @@ packages: ...@@ -170,6 +191,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
provider: provider:
dependency: transitive dependency: transitive
description: description:
...@@ -245,6 +273,41 @@ packages: ...@@ -245,6 +273,41 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.1" version: "2.1.1"
video_player:
dependency: "direct main"
description:
name: video_player
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
video_player_android:
dependency: transitive
description:
name: video_player_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.1"
video_player_avfoundation:
dependency: transitive
description:
name: video_player_avfoundation
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.1"
video_player_platform_interface:
dependency: transitive
description:
name: video_player_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "5.1.0"
video_player_web:
dependency: transitive
description:
name: video_player_web
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.7"
sdks: sdks:
dart: ">=2.16.1 <3.0.0" dart: ">=2.16.1 <3.0.0"
flutter: ">=1.20.0" flutter: ">=2.8.0"
...@@ -34,7 +34,9 @@ dependencies: ...@@ -34,7 +34,9 @@ dependencies:
flutter_bloc: ^8.0.1 flutter_bloc: ^8.0.1
http: ^0.13.4 http: ^0.13.4
intl: ^0.17.0 intl: ^0.17.0
loading_animations: ^2.2.0
url_strategy: ^0.2.0 url_strategy: ^0.2.0
video_player: ^2.3.0
dev_dependencies: dev_dependencies:
flutter_lints: ^1.0.0 flutter_lints: ^1.0.0
...@@ -51,8 +53,8 @@ flutter: ...@@ -51,8 +53,8 @@ flutter:
# the material Icons class. # the material Icons class.
uses-material-design: true uses-material-design: true
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
# assets: assets:
# - images/a_dot_burr.jpeg - assets/file.json
# - images/a_dot_ham.jpeg # - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware. # https://flutter.dev/assets-and-images/#resolution-aware.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment