Merge branch 'master' of tzw/fcs into master

This commit is contained in:
2020-06-25 00:50:37 +00:00
committed by Gogs
17 changed files with 698 additions and 169 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 KiB

BIN
assets/Fullname.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@@ -480,9 +480,10 @@
"user.shipping_address":"USA SHIPPING ADDRESS", "user.shipping_address":"USA SHIPPING ADDRESS",
"user.deliveryAddress":"My delivery address", "user.deliveryAddress":"My delivery address",
"user.buying_instruction":"See below instructions to add USA shipping address while shoping online", "user.buying_instruction":"See below instructions to add USA shipping address while shoping online",
"user.form.shipping_address":"SHIPPING ADDRESS",
"buy_online":"Buying Online", "buy_online":"Buying Instructions",
"buy_online.title":"BUYING ONLINE", "buy_online.title":"BUYING INSTRUCTIONS",
"buy.amazon":"Amazon", "buy.amazon":"Amazon",
"buy.newegg":"Newegg", "buy.newegg":"Newegg",
"buy.macy":"Macy", "buy.macy":"Macy",
@@ -540,8 +541,8 @@
"pickup.information": "Pickup Informations", "pickup.information": "Pickup Informations",
"pickup.recipient_information": "Recipient Informations", "pickup.recipient_information": "Recipient Informations",
"message.btn":"Messages", "message.btn":"Notifications",
"message.title":"MESSAGES", "message.title":"NOTIFICATIONS",
"customers.btn": "Customers", "customers.btn": "Customers",
"customers.title": "CUSTOMERS", "customers.title": "CUSTOMERS",
@@ -554,7 +555,7 @@
"invoice.add_box":"Add Box", "invoice.add_box":"Add Box",
"term":"TERMS", "term":"TERMS",
"term.btn":"Terms", "term.btn":"Terms of services",
"customer.list.title":"CUSTOMERS", "customer.list.title":"CUSTOMERS",
"customer.form.title":"CUSTOMER", "customer.form.title":"CUSTOMER",

View File

@@ -513,9 +513,10 @@
"user.shipping_address":"My USA shipping address", "user.shipping_address":"My USA shipping address",
"user.deliveryAddress":"My delivery address", "user.deliveryAddress":"My delivery address",
"user.buying_instruction":"See below instructions to add shipping address", "user.buying_instruction":"See below instructions to add shipping address",
"user.form.shipping_address":"ကုန်ပစ္စည်းပို့ဆောင်ရမည့်လိပ်စာ",
"buy_online":"အွန်လိုင်း မှဝယ်ယူခြင်း", "buy_online":"ဝယ်ယူရန်ညွှန်ကြားချက်များ",
"buy_online.title":"အွန်လိုင်း မှဝယ်ယူခြင်း", "buy_online.title":"ဝယ်ယူရန်ညွှန်ကြားချက်များ",
"buy.amazon":"Amazon", "buy.amazon":"Amazon",
"buy.newegg":"Newegg", "buy.newegg":"Newegg",
"buy.macy":"Macy", "buy.macy":"Macy",
@@ -562,8 +563,8 @@
"rate.cal.title":"အဆင့်သတ်မှတ်ချက်များတွက်ချက်ရန်", "rate.cal.title":"အဆင့်သတ်မှတ်ချက်များတွက်ချက်ရန်",
"message.btn":"မက်ဆေ့ခ်ျများ", "message.btn":"အသိပေးချက်များ",
"message.title":"မက်ဆေ့ခ်ျများ", "message.title":"အသိပေးချက်များ",
"customers.btn": "ဝယ်ယူသူများ", "customers.btn": "ဝယ်ယူသူများ",
"customers.title": "ဝယ်ယူသူများ", "customers.title": "ဝယ်ယူသူများ",

View File

@@ -35,6 +35,7 @@ import 'model/shipment_rate_model.dart';
import 'model/user_model.dart'; import 'model/user_model.dart';
import 'model_fcs/box_model.dart'; import 'model_fcs/box_model.dart';
import 'pages/home_page.dart'; import 'pages/home_page.dart';
import 'pages/home_page_welcome.dart';
import 'pages/splash.dart'; import 'pages/splash.dart';
import 'pages/term.dart'; import 'pages/term.dart';
import 'pages/welcome_page.dart'; import 'pages/welcome_page.dart';
@@ -127,7 +128,8 @@ class _AppState extends State<App> {
Map<String, WidgetBuilder> route(BuildContext context) { Map<String, WidgetBuilder> route(BuildContext context) {
final routes = <String, WidgetBuilder>{ final routes = <String, WidgetBuilder>{
'/': (_) => SplashScreen(), '/': (_) => SplashScreen(),
'/home': (_) => HomePage(), '/home': (_) => HomePageWelcome(),
'/homeLogin': (_) => HomePage(),
'/welcome': (context) => WelcomePage(), '/welcome': (context) => WelcomePage(),
'/term': (context) => Term( '/term': (context) => Term(
agreePage: true, agreePage: true,

View File

@@ -32,7 +32,8 @@ class PickUpModel extends BaseModel {
weight: 25, weight: 25,
status: 'Pending', status: 'Pending',
date: DateTime(2020, 5, 1), date: DateTime(2020, 5, 1),
address: '154-19 64th Ave.\nFlushing, NY 11367'), address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000),
PickUp( PickUp(
id: "P200125 - 12 May 2020", id: "P200125 - 12 May 2020",
userName: "Ko Kyaw Nyi", userName: "Ko Kyaw Nyi",
@@ -43,7 +44,8 @@ class PickUpModel extends BaseModel {
weight: 25, weight: 25,
status: 'Assigned', status: 'Assigned',
date: DateTime(2020, 5, 6), date: DateTime(2020, 5, 6),
address: '154-19 64th Ave.\nFlushing, NY 11367'), address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000),
PickUp( PickUp(
id: "P200441 - 13 Apr 2020", id: "P200441 - 13 Apr 2020",
userName: "Ko Kyaw Nyi", userName: "Ko Kyaw Nyi",
@@ -54,7 +56,8 @@ class PickUpModel extends BaseModel {
weight: 25, weight: 25,
status: "Pickuped", status: "Pickuped",
date: DateTime(2020, 5, 9), date: DateTime(2020, 5, 9),
address: '154-19 64th Ave.\nFlushing, NY 11367'), address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000),
PickUp( PickUp(
id: "P200412 - 12 Apr 2020", id: "P200412 - 12 Apr 2020",
userName: "Ko Kyaw Nyi", userName: "Ko Kyaw Nyi",
@@ -65,7 +68,8 @@ class PickUpModel extends BaseModel {
weight: 25, weight: 25,
status: 'Pickuped', status: 'Pickuped',
date: DateTime(2020, 5, 15), date: DateTime(2020, 5, 15),
address: '154-19 64th Ave.\nFlushing, NY 11367'), address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000),
PickUp( PickUp(
id: "P200125 - 12 May 2020", id: "P200125 - 12 May 2020",
userName: "Ko Kyaw Nyi", userName: "Ko Kyaw Nyi",
@@ -76,7 +80,8 @@ class PickUpModel extends BaseModel {
weight: 25, weight: 25,
status: 'Pickuped', status: 'Pickuped',
date: DateTime(2020, 5, 20), date: DateTime(2020, 5, 20),
address: '154-19 64th Ave.\nFlushing, NY 11367'), address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000),
PickUp( PickUp(
id: "P200441 - 13 Apr 2020", id: "P200441 - 13 Apr 2020",
userName: "Ko Kyaw Nyi", userName: "Ko Kyaw Nyi",
@@ -87,7 +92,8 @@ class PickUpModel extends BaseModel {
weight: 25, weight: 25,
status: "Pickuped", status: "Pickuped",
date: DateTime(2020, 5, 21), date: DateTime(2020, 5, 21),
address: '154-19 64th Ave.\nFlushing, NY 11367'), address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000),
PickUp( PickUp(
id: "P200441 - 10 Apr 2020", id: "P200441 - 10 Apr 2020",
userName: "Ko Kyaw Nyi", userName: "Ko Kyaw Nyi",
@@ -98,7 +104,8 @@ class PickUpModel extends BaseModel {
weight: 25, weight: 25,
status: "Canceled", status: "Canceled",
date: DateTime(2020, 5, 25), date: DateTime(2020, 5, 25),
address: '154-19 64th Ave.\nFlushing, NY 11367'), address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000),
PickUp( PickUp(
id: "P200441 - 6 Apr 2020", id: "P200441 - 6 Apr 2020",
userName: "Ko Kyaw Nyi", userName: "Ko Kyaw Nyi",
@@ -109,7 +116,8 @@ class PickUpModel extends BaseModel {
weight: 25, weight: 25,
status: "Canceled", status: "Canceled",
date: DateTime(2020, 5, 27), date: DateTime(2020, 5, 27),
address: '154-19 64th Ave.\nFlushing, NY 11367'), address: '154-19 64th Ave.\nFlushing, NY 11367',
handlingFee: 5000),
]; ];
List<PickUp> get canceled { List<PickUp> get canceled {

View File

@@ -1,4 +1,5 @@
import 'package:fcs/vo/shipment.dart'; import 'package:fcs/vo/shipment.dart';
import 'package:fcs/vo/shipping_address.dart';
import 'base_model.dart'; import 'base_model.dart';
@@ -74,6 +75,23 @@ class ShipmentModel extends BaseModel {
return _shipments; return _shipments;
} }
List<ShippingAddress> 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) { void initUser(user) {
super.initUser(user); super.initUser(user);
} }

View File

@@ -20,6 +20,10 @@ class BuyingOnlinePage extends StatefulWidget {
class _BuyingOnlinePagetate extends State<BuyingOnlinePage> { class _BuyingOnlinePagetate extends State<BuyingOnlinePage> {
bool _isLoading = false; bool _isLoading = false;
List<String> images = [
'assets/Fullname.jpeg',
'assets/FirstName&LastName.jpeg'
];
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@@ -86,64 +90,6 @@ class _BuyingOnlinePagetate extends State<BuyingOnlinePage> {
), ),
); );
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( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
child: Scaffold( child: Scaffold(
@@ -202,9 +148,20 @@ class _BuyingOnlinePagetate extends State<BuyingOnlinePage> {
), ),
// deliveryAddressBox, // deliveryAddressBox,
instructionBox, instructionBox,
amazonbutton, Container(
neweggbutton, height: 500,
macybutton, 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) SizedBox(height: 10)
], ],
), ),

View File

@@ -208,7 +208,7 @@ class _HomePageState extends State<HomePage> {
ToggleButtons( ToggleButtons(
children: <Widget>[ children: <Widget>[
Image.asset( Image.asset(
'icons/flags/png/gb.png', 'icons/flags/png/us.png',
package: 'country_icons', package: 'country_icons',
fit: BoxFit.fitWidth, fit: BoxFit.fitWidth,
width: 25, width: 25,
@@ -232,14 +232,14 @@ class _HomePageState extends State<HomePage> {
); );
}, },
iconSize: 30, iconSize: 30,
icon: Icon(Icons.tune), icon: Icon(Icons.account_circle),
), ),
] ]
: <Widget>[ : <Widget>[
ToggleButtons( ToggleButtons(
children: <Widget>[ children: <Widget>[
Image.asset( Image.asset(
'icons/flags/png/gb.png', 'icons/flags/png/us.png',
package: 'country_icons', package: 'country_icons',
fit: BoxFit.fitWidth, fit: BoxFit.fitWidth,
width: 25, width: 25,
@@ -318,7 +318,7 @@ class _HomePageState extends State<HomePage> {
children: <Widget>[ children: <Widget>[
// _buildSmallButton( // _buildSmallButton(
// "Policies", FontAwesomeIcons.fileContract), // "Policies", FontAwesomeIcons.fileContract),
_buildSmallButton("Support", SimpleLineIcons.support), _buildSmallButton("Contact Us", SimpleLineIcons.support),
], ],
) )
], ],

View File

@@ -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<HomePageWelcome> {
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<bool> isSelected = [true, false];
@override
Widget build(BuildContext context) {
login = Provider.of<MainModel>(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
? <Widget>[
ToggleButtons(
children: <Widget>[
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),
),
]
: <Widget>[
ToggleButtons(
children: <Widget>[
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 <Color>[
// secondaryColor,
// primaryColor,
// secondaryColor,
// primaryColor,
// secondaryColor,
// ],
// stops: const <double>[0.0, 0.25, 0.5, 0.75, 1.0],
// ),
),
child: Column(
children: <Widget>[
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: <Widget>[
// _buildSmallButton(
// "Policies", FontAwesomeIcons.fileContract),
_buildSmallButton(
"Contact Us", SimpleLineIcons.support),
],
)
],
))),
),
);
}
_langChange(index) {
var languageModel = Provider.of<LanguageModel>(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: <Widget>[
IconButton(
icon: Icon(iconData, color: Colors.white70),
color: Colors.white70,
onPressed: null),
// RaisedButton(onPressed: ()=>{},child: Row(
// children: <Widget>[
// IconButton(
// icon: Icon(iconData, ),
// onPressed: null),
// Text(text),
// ],
// ),color: Colors.transparent,
// focusColor: Colors.transparent,),
Text(
text,
style: subMenuStyle,
)
],
),
),
);
}
}

View File

@@ -122,7 +122,6 @@ class _NotificationListState extends State<NotificationList> {
} }
_display(Message msg) { _display(Message msg) {
Navigator.push(context, BottomUpPageRoute(MessageDetail(msg:msg)) Navigator.push(context, BottomUpPageRoute(MessageDetail(msg: msg)));
);
} }
} }

View File

@@ -26,6 +26,7 @@ class PickUpEditor extends StatefulWidget {
class _PickUpEditorState extends State<PickUpEditor> { class _PickUpEditorState extends State<PickUpEditor> {
var dateFormatter = new DateFormat('dd MMM yyyy'); var dateFormatter = new DateFormat('dd MMM yyyy');
final numberFormatter = new NumberFormat("#,###");
TextEditingController _addressEditingController = new TextEditingController(); TextEditingController _addressEditingController = new TextEditingController();
TextEditingController _fromTimeEditingController = TextEditingController _fromTimeEditingController =
@@ -41,6 +42,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
TextEditingController _recipientAddressEditingController = TextEditingController _recipientAddressEditingController =
new TextEditingController(); new TextEditingController();
TextEditingController _pickupDate = new TextEditingController(); TextEditingController _pickupDate = new TextEditingController();
TextEditingController _handlingFeeController = new TextEditingController();
PickUp _pickUp; PickUp _pickUp;
bool _isLoading = false; bool _isLoading = false;
@@ -59,6 +61,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
_noOfPackageEditingController.text = _pickUp.numberOfPackage.toString(); _noOfPackageEditingController.text = _pickUp.numberOfPackage.toString();
_weightEditingController.text = _pickUp.weight.toString(); _weightEditingController.text = _pickUp.weight.toString();
_pickupDate.text = dateFormatter.format(now); _pickupDate.text = dateFormatter.format(now);
_handlingFeeController.text = numberFormatter.format(_pickUp.handlingFee);
var mainModel = Provider.of<MainModel>(context, listen: false); var mainModel = Provider.of<MainModel>(context, listen: false);
_recipientNameEditingController.text = mainModel.recipient.name; _recipientNameEditingController.text = mainModel.recipient.name;
@@ -294,6 +297,20 @@ class _PickUpEditorState extends State<PickUpEditor> {
FontAwesomeIcons.weightHanging, FontAwesomeIcons.weightHanging,
controller: _weightEditingController), 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(
padding: const EdgeInsets.only(left: 20.0), padding: const EdgeInsets.only(left: 20.0),
child: fcsInput("Remark", MaterialCommunityIcons.note), child: fcsInput("Remark", MaterialCommunityIcons.note),
@@ -301,59 +318,61 @@ class _PickUpEditorState extends State<PickUpEditor> {
SizedBox(height: 10.0), SizedBox(height: 10.0),
], ],
), ),
ExpansionTile( // ExpansionTile(
title: Text('Recipient Information'), // title: Text('Recipient Information'),
children: <Widget>[ // children: <Widget>[
Padding( // Padding(
padding: const EdgeInsets.only(left: 20.0), // padding: const EdgeInsets.only(left: 20.0),
child: widget.pickUp == null // child: widget.pickUp == null
? fcsInput("Name", FontAwesomeIcons.user, // ? fcsInput("Name", FontAwesomeIcons.user,
controller: _recipientNameEditingController) // controller: _recipientNameEditingController)
: widget.pickUp.status == 'Pending' // : widget.pickUp.status == 'Pending'
? fcsInput("Name", FontAwesomeIcons.user, // ? fcsInput("Name", FontAwesomeIcons.user,
controller: // controller:
_recipientNameEditingController) // _recipientNameEditingController)
: fcsInputReadOnly( // : fcsInputReadOnly(
"Name", FontAwesomeIcons.user, // "Name", FontAwesomeIcons.user,
controller: // controller:
_recipientNameEditingController)), // _recipientNameEditingController)),
Padding( // Padding(
padding: const EdgeInsets.only(left: 20.0), // padding: const EdgeInsets.only(left: 20.0),
child: widget.pickUp == null // child: widget.pickUp == null
? fcsInput("Phone Number", Icons.phone, // ? fcsInput("Phone Number", Icons.phone,
controller: _recipientPhoneEditingController) // controller: _recipientPhoneEditingController)
: widget.pickUp.status == 'Pending' // : widget.pickUp.status == 'Pending'
? fcsInput("Phone Number", Icons.phone, // ? fcsInput("Phone Number", Icons.phone,
controller: // controller:
_recipientPhoneEditingController) // _recipientPhoneEditingController)
: fcsInputReadOnly( // : fcsInputReadOnly(
"Phone Number", Icons.phone, // "Phone Number", Icons.phone,
controller: // controller:
_recipientPhoneEditingController)), // _recipientPhoneEditingController)),
Padding( // Padding(
padding: const EdgeInsets.only(left: 20.0), // padding: const EdgeInsets.only(left: 20.0),
child: widget.pickUp == null // child: widget.pickUp == null
? fcsInput("Address", Icons.location_on, // ? fcsInput("Address", Icons.location_on,
controller: // controller:
_recipientAddressEditingController) // _recipientAddressEditingController)
: widget.pickUp.status == 'Pending' // : widget.pickUp.status == 'Pending'
? fcsInput("Address", Icons.location_on, // ? fcsInput("Address", Icons.location_on,
controller: // controller:
_recipientAddressEditingController) // _recipientAddressEditingController)
: fcsInputReadOnly( // : fcsInputReadOnly(
"Address", Icons.location_on, // "Address", Icons.location_on,
controller: // controller:
_recipientAddressEditingController)), // _recipientAddressEditingController)),
], // ],
), // ),
mainModel.isCustomer()?Container(): mainModel.isCustomer()
ExpansionTile( ? Container()
: ExpansionTile(
title: Text('For FCS'), title: Text('For FCS'),
children: <Widget>[ children: <Widget>[
widget.pickUp != null widget.pickUp != null
? widget.pickUp.status == 'Pending' ? widget.pickUp.status == 'Pending'
? Padding( ? Padding(
padding: const EdgeInsets.only(left: 20.0), padding:
const EdgeInsets.only(left: 20.0),
child: fcsDropDown("Assigned", child: fcsDropDown("Assigned",
MaterialCommunityIcons.worker), MaterialCommunityIcons.worker),
) )

View File

@@ -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:flutter/material.dart';
import 'package:package_info/package_info.dart'; import 'package:package_info/package_info.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -13,6 +18,7 @@ import 'package:fcs/widget/progress.dart';
import '../theme/theme.dart'; import '../theme/theme.dart';
import 'profile_setting.dart'; import 'profile_setting.dart';
import 'shipping_address_editor.dart';
typedef void ProfileCallback(); typedef void ProfileCallback();
@@ -49,7 +55,7 @@ class _ProfileState extends State<Profile> {
var languageModel = Provider.of<LanguageModel>(context); var languageModel = Provider.of<LanguageModel>(context);
MainModel mainModel = Provider.of<MainModel>(context); MainModel mainModel = Provider.of<MainModel>(context);
buildLanguage(languageModel); // buildLanguage(languageModel);
_selectedDropdown(String selected) { _selectedDropdown(String selected) {
setState(() { setState(() {
selectedLanguage = selected; selectedLanguage = selected;
@@ -58,7 +64,8 @@ class _ProfileState extends State<Profile> {
} }
final namebox = Container( 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( child: Container(
height: 45.0, height: 45.0,
child: Row( child: Row(
@@ -96,6 +103,7 @@ class _ProfileState extends State<Profile> {
)); ));
final phonenumberbox = Container( final phonenumberbox = Container(
padding: EdgeInsets.only(left: 25.0, right: 25.0),
height: 45.0, height: 45.0,
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@@ -132,7 +140,7 @@ class _ProfileState extends State<Profile> {
), ),
); );
final emailBox = Container( final emailBox = Container(
padding: EdgeInsets.only(top: 10, left: 0), padding: EdgeInsets.only(top: 10, left: 25.0, right: 25.0),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Text( Text(
@@ -163,7 +171,7 @@ class _ProfileState extends State<Profile> {
), ),
); );
final languageBox = Container( 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( child: Container(
height: 45.0, height: 45.0,
child: Row( child: Row(
@@ -223,10 +231,8 @@ class _ProfileState extends State<Profile> {
_isLoading = true; _isLoading = true;
}); });
await mainModel.logout(); await mainModel.logout();
Navigator.pop(context); Navigator.of(context).pushNamedAndRemoveUntil(
"/home", ModalRoute.withName('/home'));
// Navigator.of(context)
// .pushNamedAndRemoveUntil("/", ModalRoute.withName('/'));
Future.delayed(Duration(seconds: 1), () { Future.delayed(Duration(seconds: 1), () {
if (mounted) { if (mounted) {
setState(() { setState(() {
@@ -262,15 +268,10 @@ class _ProfileState extends State<Profile> {
AppTranslations.of(context).text("profile.title"), AppTranslations.of(context).text("profile.title"),
), ),
backgroundColor: primaryColor, backgroundColor: primaryColor,
actions: <Widget>[ actions: <Widget>[],
],
), ),
body: ListView( body: ListView(
padding: EdgeInsets.only( // padding: EdgeInsets.only(left: 25.0, right: 25.0),
left: 25.0,
right: 25.0,
),
shrinkWrap: true, shrinkWrap: true,
children: <Widget>[ children: <Widget>[
Row( Row(
@@ -290,7 +291,10 @@ class _ProfileState extends State<Profile> {
? Container() ? Container()
: emailBox, : emailBox,
languageBox, languageBox,
SizedBox(height: 50,), getShippingAddressList(context),
SizedBox(
height: 50,
),
logoutbutton, logoutbutton,
], ],
), ),
@@ -298,6 +302,110 @@ class _ProfileState extends State<Profile> {
); );
} }
Widget getShippingAddressList(BuildContext context) {
var shipmentModel = Provider.of<ShipmentModel>(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: <Widget>[
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<MyDataRow> getAddressRows(List<ShippingAddress> 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) { Widget getPrivilegeBox(BuildContext context) {
var languageModel = Provider.of<LanguageModel>(context); var languageModel = Provider.of<LanguageModel>(context);
var userModel = Provider.of<UserModel>(context); var userModel = Provider.of<UserModel>(context);

View File

@@ -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<ShippingAddressEditor> {
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: <Widget>[
Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 20.0),
child: ListView(children: <Widget>[
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)
],
),
),
),
);
}
}

View File

@@ -1,4 +1,5 @@
import 'package:fcs/model/shared_pref.dart'; 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:fcs/widget/localization/app_translations.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@@ -7,6 +8,7 @@ import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../theme/theme.dart'; import '../theme/theme.dart';
import '../widget/local_text.dart'; import '../widget/local_text.dart';
import '../widget/progress.dart'; import '../widget/progress.dart';
import 'home_page.dart';
class UserEditPage extends StatefulWidget { class UserEditPage extends StatefulWidget {
@override @override
@@ -108,6 +110,6 @@ class _UserEditPageState extends State<UserEditPage> {
} }
_submit() async { _submit() async {
Navigator.pop(context); Navigator.pushNamedAndRemoveUntil(context, "/homeLogin", (r) => false);
} }
} }

View File

@@ -6,6 +6,7 @@ class PickUp {
String toTime; String toTime;
int numberOfPackage; int numberOfPackage;
int weight; int weight;
int handlingFee;
String address; String address;
String status; String status;
DateTime date; DateTime date;
@@ -18,6 +19,7 @@ class PickUp {
this.toTime, this.toTime,
this.numberOfPackage, this.numberOfPackage,
this.weight, this.weight,
this.handlingFee,
this.address, this.address,
this.status, this.status,
this.date}); this.date});

View File

@@ -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});
}