Merge remote-tracking branch 'upstream/master'

This commit is contained in:
PhyoThandar
2020-06-24 08:38:14 +06:30
32 changed files with 1424 additions and 291 deletions

View File

@@ -83,7 +83,7 @@ class _CustomerListState extends State<CustomerList> {
padding: new EdgeInsets.symmetric(
horizontal: 32.0 - dotSize / 2),
child: Icon(
Feather.users,
Feather.user,
color: primaryColor,
size: 40,
),

View File

@@ -1,6 +1,7 @@
import 'package:country_code_picker/country_code.dart';
import 'package:fcs/model/main_model.dart';
import 'package:fcs/pages/shipment_list.dart';
import 'package:fcs/pages_fcs/box_list.dart';
import 'package:fcs/pages_fcs/package_list.dart';
import 'package:fcs/widget/bottom_up_page_route.dart';
import 'package:fcs/widget/localization/transalation.dart';
@@ -103,13 +104,21 @@ class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
login = Provider.of<MainModel>(context).isLogin();
var owner = Provider.of<MainModel>(context).isOwner();
var customer = Provider.of<MainModel>(context).isCustomer();
final packagesBtn = _buildBtn2("package.name",
icon: Octicons.package,
btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(PackageList())));
final boxesBtn = _buildBtn2("boxes.name",
icon: MaterialCommunityIcons.package,
btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(BoxList())));
final pickUpBtn = _buildBtn2("pickup",
icon: MaterialCommunityIcons.directions,
icon: SimpleLineIcons.direction,
btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(PickUpList())));
@@ -118,7 +127,7 @@ class _HomePageState extends State<HomePage> {
btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(ShipmentRates())));
final fcsProfileBtn = _buildBtn2("profile.title",
final fcsProfileBtn = _buildBtn2("fcs.btn",
// imgIcon: Image.asset("assets/logo_btn.png", height: 25,color:Colors.white),
icon: MaterialCommunityIcons.home_city,
btnCallback: () =>
@@ -171,16 +180,17 @@ class _HomePageState extends State<HomePage> {
Navigator.of(context).push(BottomUpPageRoute(Term())));
List<Widget> widgets = [];
widgets.add(buyingBtn);
widgets.add(pickUpBtn);
widgets.add(shipmentBtn);
widgets.add(notiBtn);
widgets.add(staffBtn);
widgets.add(fcsProfileBtn);
customer ? widgets.add(buyingBtn) : "";
customer || owner ? widgets.add(pickUpBtn) : "";
owner ? widgets.add(shipmentBtn) : "";
customer || owner ? widgets.add(notiBtn) : "";
owner ? widgets.add(staffBtn) : "";
owner ? widgets.add(fcsProfileBtn) : "";
widgets.add(shipmentCostBtn);
widgets.add(packagesBtn);
widgets.add(customersBtn);
widgets.add(invoicesBtn);
customer || owner ? widgets.add(packagesBtn) : "";
customer || owner ? widgets.add(boxesBtn) : "";
owner ? widgets.add(customersBtn) : "";
customer || owner ? widgets.add(invoicesBtn) : "";
widgets.add(termBtn);
return OfflineRedirect(
@@ -306,8 +316,8 @@ class _HomePageState extends State<HomePage> {
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
_buildSmallButton(
"Policies", FontAwesomeIcons.fileContract),
// _buildSmallButton(
// "Policies", FontAwesomeIcons.fileContract),
_buildSmallButton("Support", SimpleLineIcons.support),
],
)

View File

@@ -65,7 +65,7 @@ class _InvoiceListState extends State<InvoiceList> {
bottom: TabBar(
unselectedLabelColor: Colors.grey,
tabs: [
Tab(text: "Packages"),
Tab(text: "Boxes"),
Tab(text: "Pending"),
Tab(text: "Paid"),
],

View File

@@ -1,3 +1,4 @@
import 'package:fcs/model/main_model.dart';
import 'package:fcs/pages/invoice/package_addition.dart';
import 'package:fcs/theme/theme.dart';
import 'package:fcs/vo/invoice.dart';
@@ -10,6 +11,7 @@ import 'package:fcs/widget/multi_img_file.dart';
import 'package:fcs/widget/my_data_table.dart';
import 'package:fcs/widget/progress.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart';
import 'package:provider/provider.dart';
@@ -48,7 +50,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
_dateController.text = dateFormatter.format(_invoice.invoiceDate);
_nameController.text = _invoice.customerName;
_phoneController.text = _invoice.customerPhoneNumber;
_amountController.text = _invoice.amount.toString();
_amountController.text = _invoice.getAmount.toString();
_statusController.text = _invoice.status.toString();
_packages = _invoice.packages;
} else {
@@ -85,6 +87,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
@override
Widget build(BuildContext context) {
var mainModel = Provider.of<MainModel>(context);
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
@@ -123,8 +127,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
Icons.pages,
color: Colors.grey,
FontAwesomeIcons.fileInvoice,
color: primaryColor,
),
)),
),
@@ -132,7 +136,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
? Container(
padding: EdgeInsets.only(top: 5),
child: TextFormField(
initialValue: "U Nyi",
initialValue: "Ko Myo Min",
cursorColor: primaryColor,
decoration: InputDecoration(
fillColor: Colors.white,
@@ -144,8 +148,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
borderSide: BorderSide(
color: Colors.grey, width: 1.0)),
icon: Icon(
Icons.account_box,
color: Colors.grey,
FontAwesomeIcons.fileInvoice,
color: primaryColor,
),
suffixIcon: IconButton(
icon: Icon(
@@ -167,34 +171,34 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
fillColor: Colors.white,
labelText: 'Customer Name',
labelStyle:
TextStyle(fontSize: 16, color: Colors.grey),
TextStyle(fontSize: 16, color: primaryColor),
filled: true,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
Icons.account_box,
color: Colors.grey,
Feather.user,
color: primaryColor,
),
)),
),
widget.invoice == null
? Container()
: TextFormField(
controller: _phoneController,
readOnly: true,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Customer Phone Number',
labelStyle:
TextStyle(fontSize: 16, color: Colors.grey),
filled: true,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
Icons.phone,
color: Colors.grey,
),
)),
// widget.invoice == null
// ? Container()
// : TextFormField(
// controller: _phoneController,
// readOnly: true,
// decoration: InputDecoration(
// fillColor: Colors.white,
// labelText: 'Customer Phone Number',
// labelStyle:
// TextStyle(fontSize: 16, color: Colors.grey),
// filled: true,
// enabledBorder: InputBorder.none,
// focusedBorder: InputBorder.none,
// icon: Icon(
// Icons.phone,
// color: Colors.grey,
// ),
// )),
Container(
padding: EdgeInsets.only(top: 0),
child: fcsInput('Amount', FontAwesomeIcons.moneyBill,
@@ -215,12 +219,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
fillColor: Colors.white,
labelText: 'Status',
filled: true,
icon: Image.asset(
'assets/status.png',
width: 24,
height: 24,
color: Colors.grey[700],
),
icon: Icon(Icons.av_timer,color: primaryColor,),
)),
),
SizedBox(
@@ -250,7 +249,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
],
),
ExpansionTile(
title: Text('Package Informations'),
title: Text('Box Information'),
children: <Widget>[
Container(
child: SingleChildScrollView(
@@ -292,14 +291,14 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
),
),
),
Container(
mainModel.isOwner()?Container(
padding: EdgeInsets.only(top: 20),
child: Align(
alignment: Alignment.bottomRight,
child: FloatingActionButton.extended(
icon: Icon(Icons.add),
label: Text(AppTranslations.of(context)
.text("invoice.add_package")),
.text("invoice.add_box")),
backgroundColor: primaryColor,
onPressed: () {
Navigator.of(context)
@@ -307,7 +306,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
},
),
),
),
):Container(),
SizedBox(height: 25),
],
),
@@ -328,7 +327,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
},
),
)))
: Container(
:mainModel.isCustomer()?Container():Container(
child: Column(
children: <Widget>[
Align(
@@ -355,7 +354,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
child: Container(
width: 250,
child: FlatButton(
child: Text('Confirm Payment'),
child: Text('Attach Payment Receipt'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {

View File

@@ -90,7 +90,7 @@ class MessageDetail extends StatelessWidget {
message: e.message,
time: dateFormat.format(e.date),
delivered: true,
isMe: e.isMe != null ? e.isMe : true))
isMe: !(e.isMe != null ? e.isMe : true)))
.toList();
return Scaffold(

View File

@@ -45,11 +45,13 @@ class _PickUpEditorState extends State<PickUpEditor> {
PickUp _pickUp;
bool _isLoading = false;
var now = new DateTime.now();
bool isNew;
@override
void initState() {
super.initState();
if (widget.pickUp != null) {
isNew = false;
_pickUp = widget.pickUp;
_addressEditingController.text = _pickUp.address;
_fromTimeEditingController.text = _pickUp.fromTime;
@@ -63,6 +65,8 @@ class _PickUpEditorState extends State<PickUpEditor> {
_recipientPhoneEditingController.text = mainModel.recipient.phoneNumber;
_recipientAddressEditingController.text =
mainModel.recipient.shippingAddress;
} else {
isNew = true;
}
}
@@ -190,7 +194,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
EdgeInsets.symmetric(vertical: 10.0, horizontal: 0.0),
icon: Icon(
Icons.date_range,
color: Colors.grey,
color: primaryColor,
)),
validator: (value) {
if (value.isEmpty) {
@@ -224,18 +228,20 @@ class _PickUpEditorState extends State<PickUpEditor> {
child: ListView(children: <Widget>[
Center(child: nameWidget(mainModel.customer.name)),
Center(child: nameWidget(mainModel.customer.phoneNumber)),
Center(
child: Padding(
padding: const EdgeInsets.only(left: 10.0, top: 8),
child: Text(
'#P200304',
style: TextStyle(
color: Colors.black87,
fontSize: 14,
fontWeight: FontWeight.bold),
),
),
),
isNew
? Container()
: Center(
child: Padding(
padding: const EdgeInsets.only(left: 10.0, top: 8),
child: Text(
'#P200304',
style: TextStyle(
color: Colors.black87,
fontSize: 14,
fontWeight: FontWeight.bold),
),
),
),
ExpansionTile(
title: Text('Pickup Location / Time'),
children: <Widget>[
@@ -264,7 +270,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
],
),
ExpansionTile(
title: Text('Package Informations'),
title: Text('Package Information'),
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 20.0),
@@ -296,7 +302,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
],
),
ExpansionTile(
title: Text('Recipient Informations'),
title: Text('Recipient Information'),
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 20.0),
@@ -340,6 +346,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
_recipientAddressEditingController)),
],
),
mainModel.isCustomer()?Container():
ExpansionTile(
title: Text('For FCS'),
children: <Widget>[

View File

@@ -58,7 +58,7 @@ class _PickupListRowState extends State<PickupListRow> {
Padding(
padding: EdgeInsets.all(5.0),
child: Icon(
MaterialCommunityIcons.directions,
SimpleLineIcons.direction,
color: primaryColor,
)),
new Expanded(

View File

@@ -254,27 +254,6 @@ class _ProfileState extends State<Profile> {
),
),
));
Future<String> getVersionNumber() async {
PackageInfo packageInfo = await PackageInfo.fromPlatform();
String version = packageInfo.version + "+" + packageInfo.buildNumber;
return version;
}
final versionbox = Container(
padding: EdgeInsets.only(top: 15),
child: Container(
child: Center(
child: FutureBuilder(
future: getVersionNumber(),
builder: (BuildContext context, AsyncSnapshot<String> snapshot) =>
Text(
snapshot.hasData ? "v${snapshot.data}" : "Loading ...",
style: TextStyle(fontSize: 16.0, fontStyle: FontStyle.normal),
),
)),
));
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(

View File

@@ -266,7 +266,7 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
child: ListView(children: <Widget>[
// _showCustomerData(mainModel.customer),
widget.shipment == null
? fcsInput('Shipment Number', Icons.text_rotation_none,
? fcsInput('Shipment Number', Ionicons.ios_airplane,
controller: _shipmentNumberController)
: Container(
child: TextFormField(
@@ -281,8 +281,8 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
Icons.text_rotation_none,
color: Colors.grey,
Ionicons.ios_airplane,
color: primaryColor,
),
)),
),
@@ -293,26 +293,6 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
controller: _cutoffDateController),
)
: Container(),
widget.shipment == null
? Container(
padding: EdgeInsets.only(top: 5),
child: DropdownButtonFormField(
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Shipment Type',
icon: Icon(Icons.pages)),
items: shipmentModel.shipmentType
.map((e) =>
DropdownMenuItem(child: Text(e), value: e))
.toList(),
onChanged: (selected) => {
setState(() {
_currentShipment = selected;
})
},
),
)
: Container(),
Container(
padding:
EdgeInsets.only(top: widget.shipment == null ? 5 : 0),
@@ -324,6 +304,28 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
child: fcsInput('Departure Date', Icons.date_range,
controller: _departureDateControler),
),
widget.shipment == null
? Container(
padding: EdgeInsets.only(top: 5),
child: DropdownButtonFormField(
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Shipment Type',
icon: Icon(Ionicons.ios_airplane,
color: primaryColor)),
items: shipmentModel.shipmentType
.map((e) =>
DropdownMenuItem(child: Text(e), value: e))
.toList(),
onChanged: (selected) => {
setState(() {
_currentShipment = selected;
})
},
),
)
: Container(),
widget.shipment == null
? Container(
padding: EdgeInsets.only(top: 5),
@@ -355,21 +357,16 @@ class _ShipmentEditorState extends State<ShipmentEditor> {
controller: _statusController,
cursorColor: primaryColor,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Status',
filled: true,
labelStyle:
TextStyle(fontSize: 16, color: Colors.grey),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.grey, width: 1.0)),
icon: Image.asset(
'assets/status.png',
width: 24,
height: 24,
color: Colors.grey[700],
),
)),
fillColor: Colors.white,
labelText: 'Status',
filled: true,
labelStyle: TextStyle(
fontSize: 16, color: Colors.grey),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.grey, width: 1.0)),
icon: Icon(Icons.av_timer,
color: primaryColor))),
),
widget.shipment == null
? Container()

View File

@@ -109,7 +109,7 @@ class _ShipmentRatesState extends State<ShipmentRates> {
Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => Term()));
}),
fcsButton(context, "Calculate", callack: () {
fcsButton(context, "Estimate shipping cost", callack: () {
Navigator.of(context)
.push(BottomUpPageRoute(ShipmentRatesCal()));
}),

View File

@@ -381,7 +381,7 @@ Widget nameWidget(String name) {
child: Text(
name,
style: TextStyle(
color: Colors.black87, fontSize: 18, fontWeight: FontWeight.bold),
color: Colors.black87, fontSize: 18, fontWeight: FontWeight.bold),
),
),
);
@@ -417,7 +417,7 @@ Widget fcsInput(String label, IconData iconData,
filled: true,
icon: Icon(
iconData,
color: Colors.grey,
color: primaryColor,
),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(color: Colors.grey, width: 1.0)),