diff --git a/assets/local/localization_en.json b/assets/local/localization_en.json index c117126..23ed0e6 100644 --- a/assets/local/localization_en.json +++ b/assets/local/localization_en.json @@ -31,6 +31,9 @@ "Welcome Start ================================================================":"", "welcome.signin":"Sign In", "welcome.msg":"Welcome to FCS!", + "welcome.pinlogin":"Login", + "welcome.pinlogin.fcsid":"Enter FCS ID", + "welcome.pinlogin.pin":"Enter Your PIN", "Welcome End ================================================================":"", "Contact Start ================================================================":"", diff --git a/assets/local/localization_mu.json b/assets/local/localization_mu.json index 41599cf..6e6424a 100644 --- a/assets/local/localization_mu.json +++ b/assets/local/localization_mu.json @@ -29,6 +29,9 @@ "Welcome Start ================================================================":"", "welcome.signin":"ဝင်မည်", + "welcome.pinlogin":"ဝင်ရောက်ပါ", + "welcome.pinlogin.fcsid":"FCS ID ကိုရိုက်ထည့်ပါ", + "welcome.pinlogin.pin":"သင်၏ pin ကိုထည့်ပါ", "welcome.msg":"FCS က ကြိုဆိုပါတယ်!", "Welcome End ================================================================":"", diff --git a/lib/pages/delivery_address/delivery_address_row.dart b/lib/pages/delivery_address/delivery_address_row.dart index c6e248c..c096417 100644 --- a/lib/pages/delivery_address/delivery_address_row.dart +++ b/lib/pages/delivery_address/delivery_address_row.dart @@ -26,26 +26,35 @@ class DeliveryAddressRow extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ + deliveryAddress.fullName!="" + ? line(context, deliveryAddress.fullName, iconData: MaterialCommunityIcons.account, - color: primaryColor, - fontSize: 16), + color: Colors.black, + fontSize: 16):SizedBox(), + deliveryAddress.phoneNumber!="" + ? line(context, deliveryAddress.phoneNumber, - iconData: Icons.phone, color: primaryColor, fontSize: 16), - SizedBox( - height: 5, - ), + iconData: Icons.phone, color: Colors.black, fontSize: 16):SizedBox(), + deliveryAddress.addressLine1!="" + ? line(context, deliveryAddress.addressLine1, - iconData: Icons.location_on), + iconData: Icons.location_on,color: Colors.black, fontSize: 16):SizedBox(), + deliveryAddress.addressLine2!="" + ? line( context, - deliveryAddress.addressLine2, - ), + deliveryAddress.addressLine2,color: Colors.black, fontSize: 16 + ):SizedBox(), + deliveryAddress.city!="" + ? line( context, - deliveryAddress.city, - ), - line(context, deliveryAddress.state), + deliveryAddress.city,color: Colors.black, fontSize: 16 + ):SizedBox(), + deliveryAddress.state!="" + ? + line(context, deliveryAddress.state,color: Colors.black, fontSize: 16):SizedBox(), ], ), ), diff --git a/lib/pages/main/home_page.dart b/lib/pages/main/home_page.dart index 85124a5..e7bd286 100644 --- a/lib/pages/main/home_page.dart +++ b/lib/pages/main/home_page.dart @@ -6,7 +6,6 @@ import 'package:fcs/domain/entities/package.dart'; import 'package:fcs/domain/entities/user.dart'; import 'package:fcs/helpers/shared_pref.dart'; import 'package:fcs/helpers/theme.dart'; -import 'package:fcs/localization/transalation.dart'; import 'package:fcs/pages/carton/carton_list.dart'; import 'package:fcs/pages/chat/message_detail.dart'; import 'package:fcs/pages/chat/model/message_model.dart'; @@ -27,6 +26,7 @@ import 'package:fcs/pages/pickup/pickup_list.dart'; import 'package:fcs/pages/processing/processing_list.dart'; import 'package:fcs/pages/rates/shipment_rates.dart'; import 'package:fcs/pages/receiving/receiving_list.dart'; +import 'package:fcs/pages/signin/pinlogin_page.dart'; import 'package:fcs/pages/staff/staff_list.dart'; import 'package:fcs/pages/widgets/badge.dart'; import 'package:fcs/pages/widgets/bottom_widgets.dart'; @@ -366,25 +366,7 @@ class _HomePageState extends State { isSelected: isFcs, selectedBorderColor: Colors.white24, ); - final langToggle = ToggleButtons( - children: [ - Image.asset( - 'icons/flags/png/us.png', - package: 'country_icons', - fit: BoxFit.fitWidth, - width: 25, - ), - Image.asset( - 'icons/flags/png/mm.png', - package: 'country_icons', - fit: BoxFit.fitWidth, - width: 25, - ) - ], - onPressed: _langChange, - isSelected: languageModel.currentState, - selectedBorderColor: Colors.white24, - ); + final signinBtn = TextButton( onPressed: () { Navigator.of(context) @@ -402,6 +384,14 @@ class _HomePageState extends State { iconSize: 30, icon: Icon(Icons.account_circle,color: buttonColor,), ); + final pinLoginBtn = IconButton( + onPressed: () { + Navigator.of(context) + .push(CupertinoPageRoute(builder: (context) => PinLoginPage())); + }, + iconSize: 30, + icon: Icon(SimpleLineIcons.lock,color: buttonColor,), + ); var searchInput = Row(children: [ Expanded( @@ -478,17 +468,15 @@ class _HomePageState extends State { actions: login ? user.isCustomer() ? [ - langToggle, - profileBtn, + profileBtn, ] : [ fcsToggle, - langToggle, + pinLoginBtn, profileBtn, ] : [ - langToggle, - signinBtn, + signinBtn, ]), body: Container( decoration: BoxDecoration( @@ -518,16 +506,7 @@ class _HomePageState extends State { ); } - _langChange(index) { - var languageModel = Provider.of(context, listen: false); - languageModel.saveLanguage(Translation().supportedLanguages[index]); - setState(() { - isSelected.asMap().forEach((i, e) { - isSelected[i] = false; - }); - isSelected[index] = !isSelected[index]; - }); - } + _lookup() async { setState(() { diff --git a/lib/pages/profile/profile_page.dart b/lib/pages/profile/profile_page.dart index 9745223..ee34c96 100644 --- a/lib/pages/profile/profile_page.dart +++ b/lib/pages/profile/profile_page.dart @@ -13,6 +13,7 @@ import 'package:fcs/pages/widgets/defalut_delivery_address.dart'; import 'package:fcs/pages/widgets/display_text.dart'; import 'package:fcs/pages/widgets/fcs_id_icon.dart'; import 'package:fcs/pages/widgets/local_app_bar.dart'; +import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/progress.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -62,9 +63,11 @@ class _ProfileState extends State { @override Widget build(BuildContext context) { MainModel mainModel = Provider.of(context); + LanguageModel languageModel = Provider.of(context); if (mainModel.user == null) { return Container(); } + buildLanguage(languageModel); DeliveryAddressModel deliveryAddressModel = Provider.of(context); @@ -172,6 +175,12 @@ class _ProfileState extends State { builder: (context) => DeliveryAddressList())); }, ), + buildLanguageWidget( + context: context, + text: "profile.language", + iconData: Icons.language, + isEng: languageModel.isEng, + ), getPrivilegeBox(context), SizedBox(height: 15), logoutbutton, @@ -183,6 +192,69 @@ class _ProfileState extends State { ); } + Widget buildLanguageWidget( + {required String text, + required BuildContext context, + IconData? iconData, + required bool isEng}) { + return Row( + children: [ + Icon(iconData, color: primaryColor), + const SizedBox(width: 15), + Expanded( + child: LocalText( + context, + text, + fontSize: 15.0, + color: Colors.black54, + ), + ), + Row( + children: [ + isEng + ? Image.asset( + 'icons/flags/png/us.png', + package: 'country_icons', + fit: BoxFit.fitWidth, + width: 25, + ) + : Image.asset( + 'icons/flags/png/mm.png', + package: 'country_icons', + fit: BoxFit.fitWidth, + width: 25, + ), + Container( + width: 100, + padding: const EdgeInsets.only(left: 15), + child: DropdownButton( + value: selectedLanguage, + underline: const SizedBox(), + isExpanded: true, + items: languagesList + .map>((String value) { + return DropdownMenuItem( + value: value, + child: Text( + value, + style: const TextStyle(fontSize: 14), + )); + }).toList(), + onChanged: _selectedDropdown)), + ], + ) + ], + ); + } + + _selectedDropdown(selected) { + var languageModel = Provider.of(context, listen: false); + languageModel.saveLanguage(selected); + setState(() { + selectedLanguage = selected; + }); + } + Widget getPrivilegeBox(BuildContext context) { User? user = Provider.of(context, listen: false).user; List _privileges = diff --git a/lib/pages/signin/pinlogin_page.dart b/lib/pages/signin/pinlogin_page.dart new file mode 100644 index 0000000..87b171f --- /dev/null +++ b/lib/pages/signin/pinlogin_page.dart @@ -0,0 +1,127 @@ +import 'package:fcs/helpers/theme.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'; +import 'package:flutter/material.dart'; +import 'package:pin_input_text_field/pin_input_text_field.dart'; + +class PinLoginPage extends StatefulWidget { + const PinLoginPage({super.key}); + + @override + State createState() => _PinLoginPageState(); +} + +class _PinLoginPageState extends State { + bool _isLoading = false; + late String pin; + late bool allNumberEntered; + @override + void initState() { + pin = ""; + allNumberEntered = false; + super.initState(); + } + + Widget build(BuildContext context) { + return LocalProgress( + inAsyncCall: _isLoading, + child: new Scaffold( + appBar: LocalAppBar( + backgroundColor: null, + arrowColor: Colors.black, + ), + body: _buildLogin(context)), + ); + } + + Widget _buildLogin(BuildContext context) { + return ListView( + padding: EdgeInsets.only(top: 20, left: 15, right: 15, bottom: 20), + children: [ + pinLoginLogo, + Padding( + padding: EdgeInsets.only(top: 20, bottom: 20), + child: Center( + child: LocalText( + context, + "welcome.pinlogin", + color: Colors.black, + fontSize: 18, + ), + ), + ), + LocalText( + context, + "welcome.pinlogin.fcsid", + color: Colors.grey, + ), + fcsIdBox, + Padding( + padding: EdgeInsets.only(top: 20, bottom: 20), + child: LocalText( + context, + "welcome.pinlogin.pin", + color: Colors.grey, + )), + Container( + child: PinInputTextField( + pinLength: 6, + decoration: BoxLooseDecoration( + strokeColorBuilder: PinListenColorBuilder( + primaryColor, Colors.grey.shade400)), + textInputAction: TextInputAction.done, + autoFocus: true, + onChanged: _pinChange, + ), + ), + loginBtn, + ]); + } + + final pinLoginLogo = Container( + width: 70, + height: 70, + child: FittedBox( + child: Image.asset( + "assets/logo.jpg", + ), + fit: BoxFit.fitHeight, + ), + ); + final fcsIdBox = Column( + children: [ + TextFormField( + // controller: controller, + style: textStyle, + cursorColor: primaryColor, + keyboardType: TextInputType.text, + decoration: new InputDecoration( + contentPadding: EdgeInsets.all(0), + labelStyle: newLabelStyle(color: Colors.black54, fontSize: 17), + enabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: primaryColor, width: 1.0)), + focusedBorder: UnderlineInputBorder( + borderSide: BorderSide(color: primaryColor, width: 1.0)), + disabledBorder: UnderlineInputBorder( + borderSide: BorderSide(color: primaryColor, width: 1.0)), + ), + ), + ], + ); + final loginBtn = Padding( + padding: EdgeInsets.only(top: 30), + child: LocalButton( + textKey: "welcome.pinlogin", + callBack: () {}, + ), + ); + + _pinChange(pin) { + setState(() { + this.pin = pin; + this.allNumberEntered = this.pin.length == 6; + }); + } +}