diff --git a/assets/FirstName&LastName.jpeg b/assets/FirstName&LastName.jpeg new file mode 100644 index 0000000..8f1c6ae Binary files /dev/null and b/assets/FirstName&LastName.jpeg differ diff --git a/assets/Fullname.jpeg b/assets/Fullname.jpeg new file mode 100644 index 0000000..fbaa0e2 Binary files /dev/null and b/assets/Fullname.jpeg differ diff --git a/assets/local/localization_en.json b/assets/local/localization_en.json index 28db4a8..dcf1c95 100644 --- a/assets/local/localization_en.json +++ b/assets/local/localization_en.json @@ -480,9 +480,10 @@ "user.shipping_address":"USA SHIPPING ADDRESS", "user.deliveryAddress":"My delivery address", "user.buying_instruction":"See below instructions to add USA shipping address while shoping online", - - "buy_online":"Buying Online", - "buy_online.title":"BUYING ONLINE", + "user.form.shipping_address":"SHIPPING ADDRESS", + + "buy_online":"Buying Instructions", + "buy_online.title":"BUYING INSTRUCTIONS", "buy.amazon":"Amazon", "buy.newegg":"Newegg", "buy.macy":"Macy", @@ -540,8 +541,8 @@ "pickup.information": "Pickup Informations", "pickup.recipient_information": "Recipient Informations", - "message.btn":"Messages", - "message.title":"MESSAGES", + "message.btn":"Notifications", + "message.title":"NOTIFICATIONS", "customers.btn": "Customers", "customers.title": "CUSTOMERS", @@ -554,7 +555,7 @@ "invoice.add_box":"Add Box", "term":"TERMS", - "term.btn":"Terms", + "term.btn":"Terms of services", "customer.list.title":"CUSTOMERS", "customer.form.title":"CUSTOMER", diff --git a/assets/local/localization_mu.json b/assets/local/localization_mu.json index 12b67e8..748bea1 100644 --- a/assets/local/localization_mu.json +++ b/assets/local/localization_mu.json @@ -513,9 +513,10 @@ "user.shipping_address":"My USA shipping address", "user.deliveryAddress":"My delivery address", "user.buying_instruction":"See below instructions to add shipping address", + "user.form.shipping_address":"ကုန်ပစ္စည်းပို့ဆောင်ရမည့်လိပ်စာ", - "buy_online":"အွန်လိုင်း မှဝယ်ယူခြင်း", - "buy_online.title":"အွန်လိုင်း မှဝယ်ယူခြင်း", + "buy_online":"ဝယ်ယူရန်ညွှန်ကြားချက်များ", + "buy_online.title":"ဝယ်ယူရန်ညွှန်ကြားချက်များ", "buy.amazon":"Amazon", "buy.newegg":"Newegg", "buy.macy":"Macy", @@ -562,8 +563,8 @@ "rate.cal.title":"အဆင့်သတ်မှတ်ချက်များတွက်ချက်ရန်", - "message.btn":"မက်ဆေ့ခ်ျများ", - "message.title":"မက်ဆေ့ခ်ျများ", + "message.btn":"အသိပေးချက်များ", + "message.title":"အသိပေးချက်များ", "customers.btn": "ဝယ်ယူသူများ", "customers.title": "ဝယ်ယူသူများ", diff --git a/lib/app.dart b/lib/app.dart index 29fec3e..38a6661 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -35,6 +35,7 @@ import 'model/shipment_rate_model.dart'; import 'model/user_model.dart'; import 'model_fcs/box_model.dart'; import 'pages/home_page.dart'; +import 'pages/home_page_welcome.dart'; import 'pages/splash.dart'; import 'pages/term.dart'; import 'pages/welcome_page.dart'; @@ -71,9 +72,9 @@ class _AppState extends State { final PickUpModel pickUpModel = new PickUpModel(); final ShipmentRateModel shipmentRateModel = new ShipmentRateModel(); final ShipmentModel shipmentModel = new ShipmentModel(); - final PackageModel packageModel=new PackageModel(); - final BoxModel boxModel=new BoxModel(); - final MessageModel messageModel=new MessageModel(); + final PackageModel packageModel = new PackageModel(); + final BoxModel boxModel = new BoxModel(); + final MessageModel messageModel = new MessageModel(); final InvoiceModel invoiceModel = new InvoiceModel(); final CustomerModel customerModel = new CustomerModel(); @@ -127,7 +128,8 @@ class _AppState extends State { Map route(BuildContext context) { final routes = { '/': (_) => SplashScreen(), - '/home': (_) => HomePage(), + '/home': (_) => HomePageWelcome(), + '/homeLogin': (_) => HomePage(), '/welcome': (context) => WelcomePage(), '/term': (context) => Term( agreePage: true, @@ -170,7 +172,7 @@ class _AppState extends State { ChangeNotifierProvider(builder: (context) => boxModel), ChangeNotifierProvider(builder: (context) => messageModel), ChangeNotifierProvider(builder: (context) => invoiceModel), - ChangeNotifierProvider(builder: (context) => customerModel), + ChangeNotifierProvider(builder: (context) => customerModel), ChangeNotifierProvider( builder: (context) => testModel, ), diff --git a/lib/model/pickup_model.dart b/lib/model/pickup_model.dart index 630f289..6f1c5fc 100644 --- a/lib/model/pickup_model.dart +++ b/lib/model/pickup_model.dart @@ -32,7 +32,8 @@ class PickUpModel extends BaseModel { weight: 25, status: 'Pending', date: DateTime(2020, 5, 1), - address: '154-19 64th Ave.\nFlushing, NY 11367'), + address: '154-19 64th Ave.\nFlushing, NY 11367', + handlingFee: 5000), PickUp( id: "P200125 - 12 May 2020", userName: "Ko Kyaw Nyi", @@ -43,7 +44,8 @@ class PickUpModel extends BaseModel { weight: 25, status: 'Assigned', date: DateTime(2020, 5, 6), - address: '154-19 64th Ave.\nFlushing, NY 11367'), + address: '154-19 64th Ave.\nFlushing, NY 11367', + handlingFee: 5000), PickUp( id: "P200441 - 13 Apr 2020", userName: "Ko Kyaw Nyi", @@ -54,7 +56,8 @@ class PickUpModel extends BaseModel { weight: 25, status: "Pickuped", date: DateTime(2020, 5, 9), - address: '154-19 64th Ave.\nFlushing, NY 11367'), + address: '154-19 64th Ave.\nFlushing, NY 11367', + handlingFee: 5000), PickUp( id: "P200412 - 12 Apr 2020", userName: "Ko Kyaw Nyi", @@ -65,7 +68,8 @@ class PickUpModel extends BaseModel { weight: 25, status: 'Pickuped', date: DateTime(2020, 5, 15), - address: '154-19 64th Ave.\nFlushing, NY 11367'), + address: '154-19 64th Ave.\nFlushing, NY 11367', + handlingFee: 5000), PickUp( id: "P200125 - 12 May 2020", userName: "Ko Kyaw Nyi", @@ -76,7 +80,8 @@ class PickUpModel extends BaseModel { weight: 25, status: 'Pickuped', date: DateTime(2020, 5, 20), - address: '154-19 64th Ave.\nFlushing, NY 11367'), + address: '154-19 64th Ave.\nFlushing, NY 11367', + handlingFee: 5000), PickUp( id: "P200441 - 13 Apr 2020", userName: "Ko Kyaw Nyi", @@ -87,7 +92,8 @@ class PickUpModel extends BaseModel { weight: 25, status: "Pickuped", date: DateTime(2020, 5, 21), - address: '154-19 64th Ave.\nFlushing, NY 11367'), + address: '154-19 64th Ave.\nFlushing, NY 11367', + handlingFee: 5000), PickUp( id: "P200441 - 10 Apr 2020", userName: "Ko Kyaw Nyi", @@ -98,7 +104,8 @@ class PickUpModel extends BaseModel { weight: 25, status: "Canceled", date: DateTime(2020, 5, 25), - address: '154-19 64th Ave.\nFlushing, NY 11367'), + address: '154-19 64th Ave.\nFlushing, NY 11367', + handlingFee: 5000), PickUp( id: "P200441 - 6 Apr 2020", userName: "Ko Kyaw Nyi", @@ -109,7 +116,8 @@ class PickUpModel extends BaseModel { weight: 25, status: "Canceled", date: DateTime(2020, 5, 27), - address: '154-19 64th Ave.\nFlushing, NY 11367'), + address: '154-19 64th Ave.\nFlushing, NY 11367', + handlingFee: 5000), ]; List get canceled { diff --git a/lib/model/shipment_model.dart b/lib/model/shipment_model.dart index 2bab8d5..088ce3e 100644 --- a/lib/model/shipment_model.dart +++ b/lib/model/shipment_model.dart @@ -1,4 +1,5 @@ import 'package:fcs/vo/shipment.dart'; +import 'package:fcs/vo/shipping_address.dart'; import 'base_model.dart'; @@ -74,6 +75,23 @@ class ShipmentModel extends BaseModel { return _shipments; } + List shippingAddresses = [ + ShippingAddress( + fullName: 'FCS-0203-390-2', + addressLine1: '154-19 64th Ave.', + addressLine2: 'Flushing', + city: 'NY', + state: 'NY', + phoneNumber: '+1 (292)215-2247'), + ShippingAddress( + fullName: 'FCS-0204-390-2', + addressLine1: '153-154 5th Thitsar.', + addressLine2: 'Flushing', + city: 'Yangon', + state: 'Yangon', + phoneNumber: '+09 5724 87508'), + ]; + void initUser(user) { super.initUser(user); } diff --git a/lib/pages/buying_online.dart b/lib/pages/buying_online.dart index aecfaf0..e5e65fc 100644 --- a/lib/pages/buying_online.dart +++ b/lib/pages/buying_online.dart @@ -20,6 +20,10 @@ class BuyingOnlinePage extends StatefulWidget { class _BuyingOnlinePagetate extends State { bool _isLoading = false; + List images = [ + 'assets/Fullname.jpeg', + 'assets/FirstName&LastName.jpeg' + ]; @override Widget build(BuildContext context) { @@ -86,64 +90,6 @@ class _BuyingOnlinePagetate extends State { ), ); - final neweggbutton = Container( - padding: EdgeInsets.only(left: 10, right: 10, top: 10), - child: Container( - height: 45.0, - decoration: BoxDecoration( - color: primaryColor, - shape: BoxShape.rectangle, - // borderRadius: BorderRadius.all(Radius.circular(10.0)) - ), - child: ButtonTheme( - minWidth: 900.0, - height: 100.0, - child: FlatButton( - onPressed: () { - Navigator.of(context) - .push(BottomUpPageRoute(ManualPage(marketplace: 'Newegg'))); - }, - child: LocalText( - context, - 'buy.newegg', - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ); - - final macybutton = Container( - padding: EdgeInsets.only(left: 10, right: 10, top: 10), - child: Container( - height: 45.0, - decoration: BoxDecoration( - color: primaryColor, - shape: BoxShape.rectangle, - // borderRadius: BorderRadius.all(Radius.circular(10.0)) - ), - child: ButtonTheme( - minWidth: 900.0, - height: 100.0, - child: FlatButton( - onPressed: () { - Navigator.of(context) - .push(BottomUpPageRoute(ManualPage(marketplace: 'Macy'))); - }, - child: LocalText( - context, - 'buy.macy', - color: Colors.white, - fontSize: 16, - fontWeight: FontWeight.bold, - ), - ), - ), - ), - ); - return LocalProgress( inAsyncCall: _isLoading, child: Scaffold( @@ -202,9 +148,20 @@ class _BuyingOnlinePagetate extends State { ), // deliveryAddressBox, instructionBox, - amazonbutton, - neweggbutton, - macybutton, + Container( + height: 500, + width: 500, + child: ListView.builder( + itemCount: images.length, + scrollDirection: Axis.horizontal, + itemBuilder: (context, index) { + return Container( + padding: EdgeInsets.only(left: 0, right: 5, top: 5), + child: Image.asset(images[index], fit: BoxFit.contain), + ); + }), + ), + SizedBox(height: 10) ], ), diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index 88636e6..a6e2509 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -208,7 +208,7 @@ class _HomePageState extends State { ToggleButtons( children: [ Image.asset( - 'icons/flags/png/gb.png', + 'icons/flags/png/us.png', package: 'country_icons', fit: BoxFit.fitWidth, width: 25, @@ -232,14 +232,14 @@ class _HomePageState extends State { ); }, iconSize: 30, - icon: Icon(Icons.tune), + icon: Icon(Icons.account_circle), ), ] : [ ToggleButtons( children: [ Image.asset( - 'icons/flags/png/gb.png', + 'icons/flags/png/us.png', package: 'country_icons', fit: BoxFit.fitWidth, width: 25, @@ -318,7 +318,7 @@ class _HomePageState extends State { children: [ // _buildSmallButton( // "Policies", FontAwesomeIcons.fileContract), - _buildSmallButton("Support", SimpleLineIcons.support), + _buildSmallButton("Contact Us", SimpleLineIcons.support), ], ) ], diff --git a/lib/pages/home_page_welcome.dart b/lib/pages/home_page_welcome.dart new file mode 100644 index 0000000..4a927c4 --- /dev/null +++ b/lib/pages/home_page_welcome.dart @@ -0,0 +1,257 @@ +import 'package:fcs/model/main_model.dart'; +import 'package:fcs/widget/bottom_up_page_route.dart'; +import 'package:fcs/widget/localization/transalation.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_icons/flutter_icons.dart'; +import 'package:intl/intl.dart'; + +import 'package:logging/logging.dart'; +import 'package:provider/provider.dart'; + +import 'package:fcs/model/language_model.dart'; + +import 'package:fcs/pages/contact.dart'; + +import 'package:fcs/widget/banner.dart'; +import 'package:fcs/widget/localization/app_translations.dart'; +import 'package:fcs/widget/offline_redirect.dart'; +import 'package:flutter/cupertino.dart'; + +import '../theme/theme.dart'; + +import 'profile_page.dart'; +import 'signin_page.dart'; + +final msgLog = Logger('backgroundMessageHandler'); + +class HomePageWelcome extends StatefulWidget { + @override + _HomePageWelcomeState createState() => _HomePageWelcomeState(); +} + +typedef BtnCallback(); + +class _HomePageWelcomeState extends State { + final log = Logger('_HomePageWelcomeState'); + bool login = false; + bool customer = true; + + @override + void initState() { + super.initState(); + } + + void dispose() { + super.dispose(); + } + + int actualChart = 0; + final numberFormatter = new NumberFormat("#,###"); + + String pin; + List isSelected = [true, false]; + + @override + Widget build(BuildContext context) { + login = Provider.of(context).isLogin(); + + return OfflineRedirect( + child: FlavorBanner( + child: Scaffold( + appBar: AppBar( + elevation: 0, + backgroundColor: primaryColor, + title: ClipRRect( + child: Image.asset("assets/logo.jpg", height: 40), + borderRadius: new BorderRadius.circular(30.0), + ), + actions: login + ? [ + 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: isSelected, + ), + IconButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => Profile()), + ); + }, + iconSize: 30, + icon: Icon(Icons.account_circle), + ), + ] + : [ + 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: isSelected, + ), + FlatButton( + onPressed: () { + Navigator.of(context) + .push(BottomUpPageRoute(SigninPage())); + }, + // iconSize: 30, + child: Text( + "Sign In", + style: siginButtonStyle, + ), + ), + ]), + body: Container( + decoration: BoxDecoration( + gradient: + // RadialGradient( + // center: const Alignment(-0.7, 0.6), // near the top right + // radius: 0.6, + // colors: [ + // secondaryColor, + // primaryColor, // yellow sun + // ], + // stops: [0.4, 1.0], + // ) + LinearGradient( + begin: Alignment.topCenter, + end: Alignment + .bottomCenter, // 10% of the width, so there are ten blinds. + colors: [ + Color(0xd0272262), + Color(0xfa272262), + // Color(0xa0ff4400), + // secondaryColor, + ], // whitish to gray + ), + // SweepGradient( + // center: FractionalOffset.centerLeft, + // startAngle: 0.0, + // endAngle: math.pi * 2, + // colors: const [ + // secondaryColor, + // primaryColor, + // secondaryColor, + // primaryColor, + // secondaryColor, + // ], + // stops: const [0.0, 0.25, 0.5, 0.75, 1.0], + // ), + ), + child: Column( + children: [ + Expanded( + child: ListView(children: [ + Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Container( + padding: EdgeInsets.only(top: 50), + child: CircleAvatar( + radius: (50), + backgroundColor: Colors.white, + child: ClipRRect( + borderRadius: BorderRadius.circular(50), + child: Image.asset("assets/logo.jpg"), + )), + ), + Padding( + padding: const EdgeInsets.all(10.0), + child: Text( + "Welcome Cargo Services\nby FCS Trading", + style: TextStyle( + color: Colors.white, + fontSize: 18, + fontFamily: "Roboto"), + ), + ) + ], + ), + ]), + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + // _buildSmallButton( + // "Policies", FontAwesomeIcons.fileContract), + _buildSmallButton( + "Contact Us", SimpleLineIcons.support), + ], + ) + ], + ))), + ), + ); + } + + _langChange(index) { + var languageModel = Provider.of(context); + languageModel.saveLanguage(Translation().supportedLanguages[index]); + setState(() { + isSelected.asMap().forEach((i, e) { + isSelected[i] = false; + }); + isSelected[index] = !isSelected[index]; + }); + } + + Widget _buildSmallButton(String text, IconData iconData) { + return InkWell( + onTap: () => { + Navigator.of(context) + .push(MaterialPageRoute(builder: (_) => Contact())), + }, + child: Padding( + padding: const EdgeInsets.all(18.0), + child: Row( + children: [ + IconButton( + icon: Icon(iconData, color: Colors.white70), + color: Colors.white70, + onPressed: null), + // RaisedButton(onPressed: ()=>{},child: Row( + // children: [ + // IconButton( + // icon: Icon(iconData, ), + // onPressed: null), + // Text(text), + // ], + // ),color: Colors.transparent, + // focusColor: Colors.transparent,), + Text( + text, + style: subMenuStyle, + ) + ], + ), + ), + ); + } +} diff --git a/lib/pages/notification_list.dart b/lib/pages/notification_list.dart index ae196ff..9aefaa8 100644 --- a/lib/pages/notification_list.dart +++ b/lib/pages/notification_list.dart @@ -122,7 +122,6 @@ class _NotificationListState extends State { } _display(Message msg) { - Navigator.push(context, BottomUpPageRoute(MessageDetail(msg:msg)) - ); + Navigator.push(context, BottomUpPageRoute(MessageDetail(msg: msg))); } } diff --git a/lib/pages/pickup_editor.dart b/lib/pages/pickup_editor.dart index 6a6443b..b26cc9f 100644 --- a/lib/pages/pickup_editor.dart +++ b/lib/pages/pickup_editor.dart @@ -26,6 +26,7 @@ class PickUpEditor extends StatefulWidget { class _PickUpEditorState extends State { var dateFormatter = new DateFormat('dd MMM yyyy'); + final numberFormatter = new NumberFormat("#,###"); TextEditingController _addressEditingController = new TextEditingController(); TextEditingController _fromTimeEditingController = @@ -41,6 +42,7 @@ class _PickUpEditorState extends State { TextEditingController _recipientAddressEditingController = new TextEditingController(); TextEditingController _pickupDate = new TextEditingController(); + TextEditingController _handlingFeeController = new TextEditingController(); PickUp _pickUp; bool _isLoading = false; @@ -59,6 +61,7 @@ class _PickUpEditorState extends State { _noOfPackageEditingController.text = _pickUp.numberOfPackage.toString(); _weightEditingController.text = _pickUp.weight.toString(); _pickupDate.text = dateFormatter.format(now); + _handlingFeeController.text = numberFormatter.format(_pickUp.handlingFee); var mainModel = Provider.of(context, listen: false); _recipientNameEditingController.text = mainModel.recipient.name; @@ -294,6 +297,20 @@ class _PickUpEditorState extends State { FontAwesomeIcons.weightHanging, controller: _weightEditingController), ), + Padding( + padding: const EdgeInsets.only(left: 20.0), + child: widget.pickUp == null + ? fcsInput( + "Handling Fee", FontAwesomeIcons.moneyBill, + controller: _handlingFeeController) + : widget.pickUp.status == 'Pending' + ? fcsInput( + "Handling Fee", FontAwesomeIcons.moneyBill, + controller: _handlingFeeController) + : fcsInputReadOnly( + "Handling Fee", FontAwesomeIcons.moneyBill, + controller: _handlingFeeController), + ), Padding( padding: const EdgeInsets.only(left: 20.0), child: fcsInput("Remark", MaterialCommunityIcons.note), @@ -301,66 +318,68 @@ class _PickUpEditorState extends State { SizedBox(height: 10.0), ], ), - ExpansionTile( - title: Text('Recipient Information'), - children: [ - Padding( - padding: const EdgeInsets.only(left: 20.0), - child: widget.pickUp == null - ? fcsInput("Name", FontAwesomeIcons.user, - controller: _recipientNameEditingController) - : widget.pickUp.status == 'Pending' - ? fcsInput("Name", FontAwesomeIcons.user, - controller: - _recipientNameEditingController) - : fcsInputReadOnly( - "Name", FontAwesomeIcons.user, - controller: - _recipientNameEditingController)), - Padding( - padding: const EdgeInsets.only(left: 20.0), - child: widget.pickUp == null - ? fcsInput("Phone Number", Icons.phone, - controller: _recipientPhoneEditingController) - : widget.pickUp.status == 'Pending' - ? fcsInput("Phone Number", Icons.phone, - controller: - _recipientPhoneEditingController) - : fcsInputReadOnly( - "Phone Number", Icons.phone, - controller: - _recipientPhoneEditingController)), - Padding( - padding: const EdgeInsets.only(left: 20.0), - child: widget.pickUp == null - ? fcsInput("Address", Icons.location_on, - controller: - _recipientAddressEditingController) - : widget.pickUp.status == 'Pending' - ? fcsInput("Address", Icons.location_on, - controller: - _recipientAddressEditingController) - : fcsInputReadOnly( - "Address", Icons.location_on, - controller: - _recipientAddressEditingController)), - ], - ), - mainModel.isCustomer()?Container(): - ExpansionTile( - title: Text('For FCS'), - children: [ - widget.pickUp != null - ? widget.pickUp.status == 'Pending' - ? Padding( - padding: const EdgeInsets.only(left: 20.0), - child: fcsDropDown("Assigned", - MaterialCommunityIcons.worker), - ) - : Container() - : Container(), - ], - ), + // ExpansionTile( + // title: Text('Recipient Information'), + // children: [ + // Padding( + // padding: const EdgeInsets.only(left: 20.0), + // child: widget.pickUp == null + // ? fcsInput("Name", FontAwesomeIcons.user, + // controller: _recipientNameEditingController) + // : widget.pickUp.status == 'Pending' + // ? fcsInput("Name", FontAwesomeIcons.user, + // controller: + // _recipientNameEditingController) + // : fcsInputReadOnly( + // "Name", FontAwesomeIcons.user, + // controller: + // _recipientNameEditingController)), + // Padding( + // padding: const EdgeInsets.only(left: 20.0), + // child: widget.pickUp == null + // ? fcsInput("Phone Number", Icons.phone, + // controller: _recipientPhoneEditingController) + // : widget.pickUp.status == 'Pending' + // ? fcsInput("Phone Number", Icons.phone, + // controller: + // _recipientPhoneEditingController) + // : fcsInputReadOnly( + // "Phone Number", Icons.phone, + // controller: + // _recipientPhoneEditingController)), + // Padding( + // padding: const EdgeInsets.only(left: 20.0), + // child: widget.pickUp == null + // ? fcsInput("Address", Icons.location_on, + // controller: + // _recipientAddressEditingController) + // : widget.pickUp.status == 'Pending' + // ? fcsInput("Address", Icons.location_on, + // controller: + // _recipientAddressEditingController) + // : fcsInputReadOnly( + // "Address", Icons.location_on, + // controller: + // _recipientAddressEditingController)), + // ], + // ), + mainModel.isCustomer() + ? Container() + : ExpansionTile( + title: Text('For FCS'), + children: [ + widget.pickUp != null + ? widget.pickUp.status == 'Pending' + ? Padding( + padding: + const EdgeInsets.only(left: 20.0), + child: fcsDropDown("Assigned", + MaterialCommunityIcons.worker), + ) + : Container() + : Container(), + ], + ), ]), )), widget.pickUp == null diff --git a/lib/pages/profile_page.dart b/lib/pages/profile_page.dart index 5042941..b3910f1 100644 --- a/lib/pages/profile_page.dart +++ b/lib/pages/profile_page.dart @@ -1,3 +1,8 @@ +import 'package:fcs/model/shipment_model.dart'; +import 'package:fcs/vo/shipping_address.dart'; +import 'package:fcs/widget/bottom_up_page_route.dart'; +import 'package:fcs/widget/local_text.dart'; +import 'package:fcs/widget/my_data_table.dart'; import 'package:flutter/material.dart'; import 'package:package_info/package_info.dart'; import 'package:provider/provider.dart'; @@ -13,6 +18,7 @@ import 'package:fcs/widget/progress.dart'; import '../theme/theme.dart'; import 'profile_setting.dart'; +import 'shipping_address_editor.dart'; typedef void ProfileCallback(); @@ -49,7 +55,7 @@ class _ProfileState extends State { var languageModel = Provider.of(context); MainModel mainModel = Provider.of(context); - buildLanguage(languageModel); + // buildLanguage(languageModel); _selectedDropdown(String selected) { setState(() { selectedLanguage = selected; @@ -58,7 +64,8 @@ class _ProfileState extends State { } final namebox = Container( - padding: EdgeInsets.only(top: 10), + // padding: EdgeInsets.only(left: 25.0, right: 25.0), + padding: EdgeInsets.only(top: 10, left: 25.0, right: 25.0), child: Container( height: 45.0, child: Row( @@ -94,8 +101,9 @@ class _ProfileState extends State { ], ), )); - + final phonenumberbox = Container( + padding: EdgeInsets.only(left: 25.0, right: 25.0), height: 45.0, child: Row( children: [ @@ -132,7 +140,7 @@ class _ProfileState extends State { ), ); final emailBox = Container( - padding: EdgeInsets.only(top: 10, left: 0), + padding: EdgeInsets.only(top: 10, left: 25.0, right: 25.0), child: Row( children: [ Text( @@ -163,7 +171,7 @@ class _ProfileState extends State { ), ); final languageBox = Container( - padding: EdgeInsets.only(bottom: 15, top: 7), + padding: EdgeInsets.only(bottom: 0, top: 7, left: 25.0, right: 25.0), child: Container( height: 45.0, child: Row( @@ -223,10 +231,8 @@ class _ProfileState extends State { _isLoading = true; }); await mainModel.logout(); - Navigator.pop(context); - - // Navigator.of(context) - // .pushNamedAndRemoveUntil("/", ModalRoute.withName('/')); + Navigator.of(context).pushNamedAndRemoveUntil( + "/home", ModalRoute.withName('/home')); Future.delayed(Duration(seconds: 1), () { if (mounted) { setState(() { @@ -262,22 +268,17 @@ class _ProfileState extends State { AppTranslations.of(context).text("profile.title"), ), backgroundColor: primaryColor, - actions: [ - - ], + actions: [], ), body: ListView( - padding: EdgeInsets.only( - left: 25.0, - right: 25.0, - ), + // padding: EdgeInsets.only(left: 25.0, right: 25.0), shrinkWrap: true, children: [ Row( children: [ namebox, Padding( - padding: const EdgeInsets.only(left:18.0), + padding: const EdgeInsets.only(left: 18.0), child: Icon(Icons.edit), ) ], @@ -290,7 +291,10 @@ class _ProfileState extends State { ? Container() : emailBox, languageBox, - SizedBox(height: 50,), + getShippingAddressList(context), + SizedBox( + height: 50, + ), logoutbutton, ], ), @@ -298,6 +302,110 @@ class _ProfileState extends State { ); } + Widget getShippingAddressList(BuildContext context) { + var shipmentModel = Provider.of(context); + return Container( + padding: EdgeInsets.only(top: 5, left: 10), + child: ExpansionTile( + title: Text( + "Shipping Addresses", + style: TextStyle( + fontWeight: FontWeight.bold, fontStyle: FontStyle.normal), + ), + children: [ + Container( + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: MyDataTable( + headingRowHeight: 40, + columnSpacing: 50, + columns: [ + MyDataColumn( + label: Text( + "Full Name", + style: TextStyle( + fontSize: 15, + color: Colors.grey[600], + ), + )), + MyDataColumn( + label: Text( + "Phone Number", + style: TextStyle( + fontSize: 15, + color: Colors.grey[600], + ), + )), + MyDataColumn( + label: Text( + "Delete", + style: TextStyle( + fontSize: 15, + color: Colors.grey[600], + ), + )), + ], + rows: getAddressRows(shipmentModel.shippingAddresses), + ), + ), + ), + Container( + padding: EdgeInsets.only(top: 20, bottom: 15, right: 15), + child: Align( + alignment: Alignment.bottomRight, + child: Container( + width: 120, + height: 40, + child: FloatingActionButton.extended( + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + onPressed: () { + Navigator.push( + context, + BottomUpPageRoute(ShippingAddressEditor()), + ); + }, + label: Text( + 'Add Shipping\nAddress', + style: TextStyle(fontSize: 12), + ), + backgroundColor: primaryColor, + ), + ), + ), + ) + ], + ), + ); + } + + List getAddressRows(List addresses) { + return addresses.map((s) { + return MyDataRow( + onSelectChanged: (selected) { + Navigator.push( + context, + BottomUpPageRoute(ShippingAddressEditor(shippingAddress: s)), + ); + }, + cells: [ + MyDataCell( + new Text( + s.fullName, + style: textStyle, + ), + ), + MyDataCell( + new Text( + s.phoneNumber, + style: textStyle, + ), + ), + MyDataCell(IconButton(icon: Icon(Icons.delete), onPressed: null)), + ], + ); + }).toList(); + } + Widget getPrivilegeBox(BuildContext context) { var languageModel = Provider.of(context); var userModel = Provider.of(context); diff --git a/lib/pages/shipping_address_editor.dart b/lib/pages/shipping_address_editor.dart new file mode 100644 index 0000000..add284a --- /dev/null +++ b/lib/pages/shipping_address_editor.dart @@ -0,0 +1,140 @@ +import 'package:fcs/pages/util.dart'; +import 'package:fcs/vo/shipping_address.dart'; +import 'package:fcs/widget/local_text.dart'; +import 'package:flutter_icons/flutter_icons.dart'; +import 'package:flutter/material.dart'; +import 'package:fcs/widget/progress.dart'; + +import '../theme/theme.dart'; + +class ShippingAddressEditor extends StatefulWidget { + final ShippingAddress shippingAddress; + ShippingAddressEditor({this.shippingAddress}); + + @override + _ShippingAddressEditorState createState() => _ShippingAddressEditorState(); +} + +class _ShippingAddressEditorState extends State { + TextEditingController _nameController = new TextEditingController(); + TextEditingController _address1Controller = new TextEditingController(); + TextEditingController _address2Controller = new TextEditingController(); + TextEditingController _cityController = new TextEditingController(); + TextEditingController _stateController = new TextEditingController(); + TextEditingController _phoneController = new TextEditingController(); + + ShippingAddress _shippingAddress = new ShippingAddress(); + + bool _isLoading = false; + + @override + void initState() { + super.initState(); + if (widget.shippingAddress != null) { + _shippingAddress = widget.shippingAddress; + _nameController.text = _shippingAddress.fullName; + _address1Controller.text = _shippingAddress.addressLine1; + _address2Controller.text = _shippingAddress.addressLine2; + _cityController.text = _shippingAddress.city; + _stateController.text = _shippingAddress.state; + _phoneController.text = _shippingAddress.phoneNumber; + } + } + + @override + void dispose() { + super.dispose(); + } + + @override + Widget build(BuildContext context) { + final usaAddress = + fcsInput('Full Name', Icons.text_format, controller: _nameController); + final mmAddress = fcsInput('Address Line 1', Icons.location_on, + controller: _address1Controller); + + final contactNumber = fcsInput('Address Line 2', Icons.location_on, + controller: _address2Controller); + final mmContactNumber = + fcsInput('City', Icons.location_city, controller: _cityController); + + final mailBox = + fcsInput('State/Region', Entypo.location, controller: _stateController); + final fbLinkBox = + fcsInput('Phone Number', Icons.phone, controller: _phoneController); + + return LocalProgress( + inAsyncCall: _isLoading, + child: Scaffold( + appBar: AppBar( + centerTitle: true, + leading: new IconButton( + icon: new Icon(Icons.close), + onPressed: () => Navigator.of(context).pop(), + ), + backgroundColor: primaryColor, + title: LocalText( + context, + 'user.form.shipping_address', + color: Colors.white, + fontSize: 20, + ), + ), + body: Card( + child: Column( + children: [ + Expanded( + child: Padding( + padding: const EdgeInsets.only(left: 20.0), + child: ListView(children: [ + usaAddress, + SizedBox(height: 10), + mmAddress, + SizedBox(height: 10), + contactNumber, + SizedBox(height: 10), + mmContactNumber, + SizedBox(height: 10), + mailBox, + SizedBox(height: 10), + fbLinkBox, + SizedBox(height: 10), + ]), + )), + widget.shippingAddress == null + ? Align( + alignment: Alignment.bottomCenter, + child: Center( + child: Container( + width: 250, + child: FlatButton( + child: Text('Create'), + color: primaryColor, + textColor: Colors.white, + onPressed: () { + Navigator.pop(context); + }, + ), + ))) + : Align( + alignment: Alignment.bottomCenter, + child: Center( + child: Container( + width: 250, + child: FlatButton( + child: Text('Update'), + color: primaryColor, + textColor: Colors.white, + onPressed: () { + Navigator.pop(context); + }, + ), + ))), + SizedBox(height: 10) + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/user_edit.dart b/lib/pages/user_edit.dart index 08c8ec8..10c35a8 100644 --- a/lib/pages/user_edit.dart +++ b/lib/pages/user_edit.dart @@ -1,4 +1,5 @@ import 'package:fcs/model/shared_pref.dart'; +import 'package:fcs/widget/bottom_up_page_route.dart'; import 'package:fcs/widget/localization/app_translations.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; @@ -7,6 +8,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import '../theme/theme.dart'; import '../widget/local_text.dart'; import '../widget/progress.dart'; +import 'home_page.dart'; class UserEditPage extends StatefulWidget { @override @@ -108,6 +110,6 @@ class _UserEditPageState extends State { } _submit() async { - Navigator.pop(context); + Navigator.pushNamedAndRemoveUntil(context, "/homeLogin", (r) => false); } } diff --git a/lib/vo/pickup.dart b/lib/vo/pickup.dart index 3e45ef7..41daa36 100644 --- a/lib/vo/pickup.dart +++ b/lib/vo/pickup.dart @@ -6,6 +6,7 @@ class PickUp { String toTime; int numberOfPackage; int weight; + int handlingFee; String address; String status; DateTime date; @@ -18,6 +19,7 @@ class PickUp { this.toTime, this.numberOfPackage, this.weight, + this.handlingFee, this.address, this.status, this.date}); diff --git a/lib/vo/shipping_address.dart b/lib/vo/shipping_address.dart new file mode 100644 index 0000000..0baba4b --- /dev/null +++ b/lib/vo/shipping_address.dart @@ -0,0 +1,15 @@ +class ShippingAddress { + String fullName; + String addressLine1; + String addressLine2; + String city; + String state; + String phoneNumber; + ShippingAddress( + {this.fullName, + this.addressLine1, + this.addressLine2, + this.city, + this.state, + this.phoneNumber}); +}