From cb857cfb2974e9454f94476e4d708ef304eb201e Mon Sep 17 00:00:00 2001 From: sma Date: Thu, 15 Feb 2024 16:38:57 +0630 Subject: [PATCH 1/3] Prepare pinlogin page --- lib/pages/signin/pinlogin_page.dart | 48 ++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 7 deletions(-) diff --git a/lib/pages/signin/pinlogin_page.dart b/lib/pages/signin/pinlogin_page.dart index e03d1e5..ae830af 100644 --- a/lib/pages/signin/pinlogin_page.dart +++ b/lib/pages/signin/pinlogin_page.dart @@ -1,4 +1,6 @@ +import 'package:fcs/domain/entities/user.dart'; import 'package:fcs/helpers/theme.dart'; +import 'package:fcs/pages/main/util.dart'; import 'package:fcs/pages/widgets/local_app_bar.dart'; import 'package:fcs/pages/widgets/local_button.dart'; import 'package:fcs/pages/widgets/local_text.dart'; @@ -7,6 +9,7 @@ import 'package:flutter/material.dart'; import 'package:pin_input_text_field/pin_input_text_field.dart'; class PinLoginPage extends StatefulWidget { + //final User user; const PinLoginPage({super.key}); @override @@ -16,12 +19,17 @@ class PinLoginPage extends StatefulWidget { class _PinLoginPageState extends State { bool _isLoading = false; late String pin; + //late User _user; TextEditingController _fcsIdCtl = new TextEditingController(); @override void initState() { - pin = ""; + //_user=widget.user; + //pin = _user.pinDigit ?? ""; super.initState(); + if (mounted) { + setState(() {}); + } } Widget build(BuildContext context) { @@ -59,18 +67,19 @@ class _PinLoginPageState extends State { padding: EdgeInsets.only(top: 30), child: LocalButton( textKey: "welcome.pinlogin", - callBack: () {}, + callBack: _login, ), ); return LocalProgress( inAsyncCall: _isLoading, child: new Scaffold( - appBar: LocalAppBar( - backgroundColor: null, - arrowColor: Colors.black, - ), + // appBar: LocalAppBar( + // backgroundColor: primaryColor, + + + // ), body: ListView( - padding: EdgeInsets.only(top: 20, left: 15, right: 15, bottom: 20), + padding: EdgeInsets.only(top: 80, left: 15, right: 15, bottom: 20), children: [ pinLoginLogo, Padding( @@ -117,4 +126,29 @@ class _PinLoginPageState extends State { this.pin = pin; }); } + _login() async { + if (pin == "") { + showMsgDialog(context, "Error", "Invalid PIN"); + return; + } + + if (pin.length < 6) { + showMsgDialog(context, "Error", "PIN must be 6 digits"); + return; + } + + setState(() { + _isLoading = true; + }); + + try { + Navigator.pop(context, true); + } catch (e) { + showMsgDialog(context, "Error", e.toString()); + } finally { + setState(() { + _isLoading = false; + }); + } + } } From ad5e61a6af94c91f3f3ecee32eab7610dff455a4 Mon Sep 17 00:00:00 2001 From: tzw Date: Thu, 15 Feb 2024 16:41:49 +0630 Subject: [PATCH 2/3] update carton list --- lib/pages/carton/carton_list.dart | 225 +++++++++++------- .../delivery_address_row.dart | 10 +- lib/pages/fcs_shipment/fcs_shipment_list.dart | 2 +- .../widgets/local_popup_menu_button.dart | 4 +- 4 files changed, 144 insertions(+), 97 deletions(-) diff --git a/lib/pages/carton/carton_list.dart b/lib/pages/carton/carton_list.dart index 5a3a61d..4001489 100644 --- a/lib/pages/carton/carton_list.dart +++ b/lib/pages/carton/carton_list.dart @@ -28,6 +28,7 @@ class _CartonListState extends State { bool _isLoading = false; List _shipments = []; FcsShipment? _selectedShipment; + bool _down = true; @override void initState() { @@ -120,105 +121,151 @@ class _CartonListState extends State { ), body: Column( children: [ - shipmentFilterBox, - Wrap( - runSpacing: 8, - children: [ - cartonModel.filterByConsingee != null - ? Padding( - padding: const EdgeInsets.only(left: 15), - child: Row( + AnimatedSwitcher( + duration: const Duration(milliseconds: 300), + transitionBuilder: (Widget child, Animation animation) => + FadeTransition( + opacity: animation, + child: SizeTransition( + child: child, + sizeFactor: animation, + axis: Axis.vertical, + ), + ), + child: _down + ? Column( + children: [ + shipmentFilterBox, + Wrap( + runSpacing: 8, children: [ - Wrap( - children: [ - Row( - children: [ - const Text("Consignee: ", - style: TextStyle( - fontSize: 12, color: Colors.grey)), - Text( - cartonModel.filterByConsingee!.name ?? - "", - style: const TextStyle( - fontSize: 12, color: Colors.black)), - const SizedBox(width: 3), - Text( - cartonModel.filterByConsingee!.fcsID ?? - "", - style: const TextStyle( - fontSize: 12, color: labelColor)), - ], - ) - ], - ), - Padding( - padding: const EdgeInsets.only(left: 5), - child: InkResponse( - radius: 30, - onTap: () { - context - .read() - .clearFilterConsignee(); - }, - child: const Icon(AntDesign.closecircleo, - size: 20, color: dangerColor), - ), - ) + cartonModel.filterByConsingee != null + ? Padding( + padding: const EdgeInsets.only(left: 15), + child: Row( + children: [ + Wrap( + children: [ + Row( + children: [ + const Text("Consignee: ", + style: TextStyle( + fontSize: 12, + color: Colors.grey)), + Text( + cartonModel + .filterByConsingee! + .name ?? + "", + style: const TextStyle( + fontSize: 12, + color: Colors.black)), + const SizedBox(width: 3), + Text( + cartonModel + .filterByConsingee! + .fcsID ?? + "", + style: const TextStyle( + fontSize: 12, + color: labelColor)), + ], + ) + ], + ), + Padding( + padding: + const EdgeInsets.only(left: 5), + child: InkResponse( + radius: 30, + onTap: () { + context + .read() + .clearFilterConsignee(); + }, + child: const Icon( + AntDesign.closecircleo, + size: 20, + color: dangerColor), + ), + ) + ], + ), + ) + : const SizedBox(), + cartonModel.filterBySender != null + ? Padding( + padding: const EdgeInsets.only(left: 15), + child: Row( + children: [ + Wrap( + children: [ + Row( + children: [ + const Text("Sender: ", + style: TextStyle( + fontSize: 12, + color: Colors.grey)), + Text( + cartonModel.filterBySender! + .name ?? + "", + style: const TextStyle( + fontSize: 12, + color: Colors.black)), + const SizedBox(width: 3), + Text( + cartonModel.filterBySender! + .fcsID ?? + "", + style: const TextStyle( + fontSize: 12, + color: labelColor)), + ], + ) + ], + ), + Padding( + padding: + const EdgeInsets.only(left: 5), + child: InkResponse( + radius: 30, + onTap: () { + context + .read() + .clearFilterSender(); + }, + child: const Icon( + AntDesign.closecircleo, + size: 20, + color: dangerColor), + ), + ) + ], + ), + ) + : const SizedBox(), ], ), - ) - : const SizedBox(), - cartonModel.filterBySender != null - ? Padding( - padding: const EdgeInsets.only(left: 15), - child: Row( - children: [ - Wrap( - children: [ - Row( - children: [ - const Text("Sender: ", - style: TextStyle( - fontSize: 12, color: Colors.grey)), - Text(cartonModel.filterBySender!.name ?? "", - style: const TextStyle( - fontSize: 12, color: Colors.black)), - const SizedBox(width: 3), - Text( - cartonModel.filterBySender!.fcsID ?? "", - style: const TextStyle( - fontSize: 12, color: labelColor)), - ], - ) - ], - ), - Padding( - padding: const EdgeInsets.only(left: 5), - child: InkResponse( - radius: 30, - onTap: () { - context - .read() - .clearFilterSender(); - }, - child: const Icon(AntDesign.closecircleo, - size: 20, color: dangerColor), - ), - ) - ], - ), - ) - : const SizedBox(), - ], + Divider(color: Colors.grey.shade400), + ], + ) + : const SizedBox(), ), - Divider(color: Colors.grey.shade400), Expanded( child: cartonModel.getBoxes == null ? const SizedBox() : PaginatorListView( paginatorListener: cartonModel.getBoxes!, rowBuilder: (p) => CartonListRow(box: p), - color: primaryColor), + color: primaryColor, + onScroll: ((down) { + if (_down == down) return; + setState(() { + _down = down; + }); + }), + ), ), ], ), diff --git a/lib/pages/delivery_address/delivery_address_row.dart b/lib/pages/delivery_address/delivery_address_row.dart index 2056ddc..a534d95 100644 --- a/lib/pages/delivery_address/delivery_address_row.dart +++ b/lib/pages/delivery_address/delivery_address_row.dart @@ -37,22 +37,22 @@ class DeliveryAddressRow extends StatelessWidget { deliveryAddress.addressLine1!="" ? line(context, deliveryAddress.addressLine1, - iconData: Icons.location_on,color: Colors.black, fontSize: 16):SizedBox(), + iconData: Icons.location_on,color: Colors.grey, fontSize: 16):SizedBox(), deliveryAddress.addressLine2!="" ? line( context, - deliveryAddress.addressLine2,color: Colors.black, fontSize: 16 + deliveryAddress.addressLine2,color: Colors.grey, fontSize: 16 ):SizedBox(), deliveryAddress.city!="" ? line( context, - deliveryAddress.city,color: Colors.black, fontSize: 16 + deliveryAddress.city,color: Colors.grey, fontSize: 16 ):SizedBox(), deliveryAddress.state!="" ? - line(context, deliveryAddress.state,color: Colors.black, fontSize: 16):SizedBox(), + line(context, deliveryAddress.state,color: Colors.grey, fontSize: 16):SizedBox(), ], ), ), @@ -69,7 +69,7 @@ class DeliveryAddressRow extends StatelessWidget { ? SizedBox(width: 40) : Padding( padding: const EdgeInsets.only(left: 8.0, right: 8), - child: Icon(iconData, color: Colors.black38), + child: Icon(iconData, color: Colors.grey), ), Flexible( child: TextLocalStyle( diff --git a/lib/pages/fcs_shipment/fcs_shipment_list.dart b/lib/pages/fcs_shipment/fcs_shipment_list.dart index 72cac2f..fff5b4a 100644 --- a/lib/pages/fcs_shipment/fcs_shipment_list.dart +++ b/lib/pages/fcs_shipment/fcs_shipment_list.dart @@ -107,7 +107,7 @@ class _FcsShipmentListState extends State { value: choice, child: Row( children: [ - Flexible(child: Text("${choice.text}")), + Flexible(child: Text("${choice.text}",style: TextStyle(color: Colors.black))), const SizedBox( width: 10, ), diff --git a/lib/pages/widgets/local_popup_menu_button.dart b/lib/pages/widgets/local_popup_menu_button.dart index 904eb98..268f80e 100644 --- a/lib/pages/widgets/local_popup_menu_button.dart +++ b/lib/pages/widgets/local_popup_menu_button.dart @@ -107,9 +107,9 @@ class _LocalPopupMenuButtonState extends State { style: TextStyle( fontSize: 14, color: - choice.enabled ? primaryColor : Colors.grey)) + choice.enabled ? Colors.black : Colors.grey)) : LocalText(context, choice.textKey ?? "", - color: choice.enabled ? primaryColor : Colors.grey, + color: choice.enabled ? Colors.black : Colors.grey, fontSize: 14), SizedBox( width: 10, From f75f7ed99f8e2a55c13e646285412ff7abde859c Mon Sep 17 00:00:00 2001 From: tzw Date: Thu, 15 Feb 2024 16:42:58 +0630 Subject: [PATCH 3/3] merge --- lib/pages/signin/pinlogin_page.dart | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/pages/signin/pinlogin_page.dart b/lib/pages/signin/pinlogin_page.dart index ae830af..de5be55 100644 --- a/lib/pages/signin/pinlogin_page.dart +++ b/lib/pages/signin/pinlogin_page.dart @@ -1,7 +1,5 @@ -import 'package:fcs/domain/entities/user.dart'; import 'package:fcs/helpers/theme.dart'; import 'package:fcs/pages/main/util.dart'; -import 'package:fcs/pages/widgets/local_app_bar.dart'; import 'package:fcs/pages/widgets/local_button.dart'; import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart';