This commit is contained in:
Sai Naw Wun
2020-06-29 23:28:21 +06:30
35 changed files with 1553 additions and 488 deletions

View File

@@ -570,8 +570,9 @@
"customer.list.title":"CUSTOMERS", "customer.list.title":"CUSTOMERS",
"customer.form.title":"CUSTOMER", "customer.form.title":"CUSTOMER",
"customer.invite":"Invite",
"contact": "CONTACTS", "contact": "CONTACT US",
"fcs.btn": "FCS Profile", "fcs.btn": "FCS Profile",
"fcs.profile": "FCS PROFILE", "fcs.profile": "FCS PROFILE",
@@ -586,6 +587,7 @@
"payment.attachment":"Payment Attachment", "payment.attachment":"Payment Attachment",
"pdf_view.title":"Payment File", "pdf_view.title":"Payment File",
"remaining_balance":"Remaining Balance : ", "remaining_balance":"Remaining Balance : ",
"total.amount": "Amount :",
"payment.method.btn":"Payment Methods", "payment.method.btn":"Payment Methods",
"payment.method.title":"Payment Methods", "payment.method.title":"Payment Methods",
@@ -593,6 +595,8 @@
"discount.btn":"Discounts", "discount.btn":"Discounts",
"discount.title":"Discounts", "discount.title":"Discounts",
"discount.new":"Discount" "discount.new":"DISCOUNT",
"custom.form.title":"CUSTOM"
} }

View File

@@ -574,6 +574,7 @@
"customers.btn": "ဝယ်ယူသူများ", "customers.btn": "ဝယ်ယူသူများ",
"customers.title": "ဝယ်ယူသူများ", "customers.title": "ဝယ်ယူသူများ",
"customer.invite":"Invite",
"invoices.btn": "ငွေတောင်းခံလွှာများ", "invoices.btn": "ငွေတောင်းခံလွှာများ",
"invoices.title": "ငွေတောင်းခံလွှာများ", "invoices.title": "ငွေတောင်းခံလွှာများ",
@@ -603,6 +604,7 @@
"payment.attachment":"ပေးချေပြီးဖိုင်များ", "payment.attachment":"ပေးချေပြီးဖိုင်များ",
"pdf_view.title":"ပေးဆောင်ခြင်းဖိုင်", "pdf_view.title":"ပေးဆောင်ခြင်းဖိုင်",
"remaining_balance":"ပေးချေရန်ကျန်ရှိငွေ : ", "remaining_balance":"ပေးချေရန်ကျန်ရှိငွေ : ",
"total.amount": "ပမာဏ :",
"payment.method.btn":"ငွေပေးချေစနစ်", "payment.method.btn":"ငွေပေးချေစနစ်",
"payment.method.title":"ငွေပေးချေစနစ်", "payment.method.title":"ငွေပေးချေစနစ်",
@@ -610,5 +612,7 @@
"discount.btn":"Discounts", "discount.btn":"Discounts",
"discount.title":"Discounts", "discount.title":"Discounts",
"discount.new":"Discount" "discount.new":"Discount",
"custom.form.title":"အကောက်ခွန်"
} }

View File

@@ -14,9 +14,10 @@ class CustomerModel extends BaseModel {
User( User(
name: 'Ko Nyi', name: 'Ko Nyi',
phoneNumber: '+95 9 717273634', phoneNumber: '+95 9 717273634',
status: 'Invited'
), ),
User(name: 'Ko Phyu', phoneNumber: '+1 (939) 382-3844'), User(name: 'Ko Phyu', phoneNumber: '+1 (939) 382-3844',status: 'Signin'),
User(name: 'Ko Ye', phoneNumber: '+95 9 983734783', status: "Delivered"), User(name: 'Ko Ye', phoneNumber: '+95 9 983734783', status: 'Invited'),
]; ];
void initUser(user) async { void initUser(user) async {

View File

@@ -86,22 +86,21 @@ class MainModel extends ChangeNotifier {
List<PaymentMethod> methods = [ List<PaymentMethod> methods = [
PaymentMethod( PaymentMethod(
name: 'AYA Bank', name: 'AYA Bank',
accountName: 'AYA Co,Ltd', accountName: 'FCS',
account: '100 23404320548398', account: '100 23404320548398',
phone: '+959123456789', phone: '+959123456789',
mail: 'aya@gmail.com'), mail: 'aya@gmail.com'),
PaymentMethod( PaymentMethod(
name: 'KBZ Bank', name: 'KBZ Bank',
accountName: 'KBZ Co,Ltd', accountName: 'FCS',
account: '100 23404320548398', account: '100 23404320548398',
phone: '+959123456789', phone: '+959123456789',
mail: 'kbz@gmail.com'), mail: 'kbz@gmail.com'),
PaymentMethod( PaymentMethod(
name: 'PayPal', name: 'PayPal',
accountName: 'PayPal Co,Ltd', accountName: 'FCS',
account: '100 23404320548398', link: 'https://www.paypal.com/donate/buttons',
phone: '+959123456789', ),
mail: 'paypal@gmail.com'),
]; ];
return methods; return methods;
} }

View File

@@ -1,6 +1,8 @@
import 'dart:async'; import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:fcs/vo/custom.dart';
import 'package:fcs/vo/discount.dart';
import 'package:fcs/vo/rate.dart'; import 'package:fcs/vo/rate.dart';
import 'package:logging/logging.dart'; import 'package:logging/logging.dart';
@@ -22,6 +24,16 @@ class ShipmentRateModel extends BaseModel {
price: 8), price: 8),
]; ];
List<Custom> customs = [
Custom(productType: 'Phone', fee: 40),
Custom(productType: 'Max Book', fee: 40)
];
List<Discount> discountsByWeight = [
Discount(weight: 10, discountRate: 3),
Discount(weight: 20, discountRate: 5)
];
int freeDeliveryWeight = 10; int freeDeliveryWeight = 10;
void initUser(user) { void initUser(user) {

View File

@@ -40,6 +40,7 @@ class BoxModel extends BaseModel {
width: 10, width: 10,
height: 10, height: 10,
length: 10, length: 10,
shipmentWeight: 6,
packages: packages, packages: packages,
statusHistory: statusHistory, statusHistory: statusHistory,
shippingAddress: ShippingAddress( shippingAddress: ShippingAddress(
@@ -68,6 +69,7 @@ class BoxModel extends BaseModel {
width: 10, width: 10,
height: 20, height: 20,
length: 30, length: 30,
shipmentWeight: 36,
statusHistory: statusHistory, statusHistory: statusHistory,
packages: packages, packages: packages,
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon', receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
@@ -97,6 +99,7 @@ class BoxModel extends BaseModel {
width: 10, width: 10,
height: 10, height: 10,
length: 10, length: 10,
shipmentWeight: 6,
statusHistory: statusHistory, statusHistory: statusHistory,
packages: packages, packages: packages,
receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon', receiverAddress: '1 Bo Yar Nyunt St.\nDagon Tsp, Yangon',
@@ -126,6 +129,7 @@ class BoxModel extends BaseModel {
width: 10, width: 10,
height: 10, height: 10,
length: 10, length: 10,
shipmentWeight: 6,
statusHistory: statusHistory, statusHistory: statusHistory,
packages: packages, packages: packages,
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon', receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
@@ -155,6 +159,7 @@ class BoxModel extends BaseModel {
width: 10, width: 10,
height: 10, height: 10,
length: 10, length: 10,
shipmentWeight: 6,
statusHistory: statusHistory, statusHistory: statusHistory,
packages: packages, packages: packages,
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon', receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
@@ -184,6 +189,7 @@ class BoxModel extends BaseModel {
width: 10, width: 10,
height: 10, height: 10,
length: 10, length: 10,
shipmentWeight: 6,
statusHistory: statusHistory, statusHistory: statusHistory,
packages: packages, packages: packages,
receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon', receiverAddress: '2 Shwe Taung Kyar St, Bahan Tsp, Yangon',
@@ -213,6 +219,7 @@ class BoxModel extends BaseModel {
width: 10, width: 10,
height: 10, height: 10,
length: 10, length: 10,
shipmentWeight: 6,
statusHistory: statusHistory, statusHistory: statusHistory,
packages: packages, packages: packages,
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon', receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',
@@ -242,6 +249,7 @@ class BoxModel extends BaseModel {
width: 10, width: 10,
height: 10, height: 10,
length: 10, length: 10,
shipmentWeight: 6,
statusHistory: statusHistory, statusHistory: statusHistory,
packages: packages, packages: packages,
receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon', receiverAddress: '3 Kambzwza St, Bahan Tsp, Yangon',

View File

@@ -167,10 +167,10 @@ class _BuyingOnlinePagetate extends State<BuyingOnlinePage>
controller: _tabController, controller: _tabController,
tabs: [ tabs: [
new Tab( new Tab(
text: 'FULL NAME', text: 'With FULL NAME',
), ),
new Tab( new Tab(
text: 'FIRST NAME&\nLAST NAME', text: 'With FIRST NAME&\nLAST NAME',
), ),
], ],
), ),

View File

@@ -0,0 +1,80 @@
import 'package:fcs/pages/util.dart';
import 'package:fcs/vo/custom.dart';
import 'package:fcs/widget/localization/app_translations.dart';
import 'package:flutter/material.dart';
import 'package:fcs/widget/progress.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../theme/theme.dart';
class CustomEditor extends StatefulWidget {
final Custom custom;
CustomEditor({this.custom});
@override
_CustomEditorState createState() => _CustomEditorState();
}
class _CustomEditorState extends State<CustomEditor> {
TextEditingController _productController = new TextEditingController();
TextEditingController _feeController = new TextEditingController();
bool _isLoading = false;
Custom _custom = new Custom();
@override
void initState() {
super.initState();
if (widget.custom != null) {
_custom = widget.custom;
_productController.text = _custom.productType;
_feeController.text = _custom.fee.toString();
}
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
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: Text(AppTranslations.of(context).text("custom.form.title")),
),
body: Container(
padding: EdgeInsets.all(18),
child: Column(
children: <Widget>[
Expanded(
child: ListView(
children: <Widget>[
fcsInput("Procut Type", FontAwesomeIcons.weightHanging,
controller: _productController),
fcsInput("Fee", Icons.attach_money,
controller: _feeController),
SizedBox(height: 30),
],
),
),
widget.custom == null
? fcsButton(context, "Create", callack: () {})
: fcsButton(context, "Save", callack: () {}),
SizedBox(height: 10)
],
),
),
),
);
}
}

View File

@@ -25,6 +25,7 @@ class _CustomerEditorState extends State<CustomerEditor> {
TextEditingController _name = new TextEditingController(); TextEditingController _name = new TextEditingController();
TextEditingController _phone = new TextEditingController(); TextEditingController _phone = new TextEditingController();
TextEditingController _phoneInput = new TextEditingController(); TextEditingController _phoneInput = new TextEditingController();
TextEditingController _status = new TextEditingController();
final _formKey = GlobalKey<FormState>(); final _formKey = GlobalKey<FormState>();
bool _isLoading = false; bool _isLoading = false;
@@ -41,6 +42,7 @@ class _CustomerEditorState extends State<CustomerEditor> {
if (widget.customer != null) { if (widget.customer != null) {
_name.text = widget.customer.name; _name.text = widget.customer.name;
_phone.text = widget.customer.phone; _phone.text = widget.customer.phone;
_status.text = widget.customer.status;
// privileges.forEach((p) => widget.employee.privilegeIds.contains(p.id) // privileges.forEach((p) => widget.employee.privilegeIds.contains(p.id)
// ? p.isChecked = true // ? p.isChecked = true
// : p.isChecked = false); // : p.isChecked = false);
@@ -174,6 +176,21 @@ class _CustomerEditorState extends State<CustomerEditor> {
], ],
); );
final statusbox = TextFormField(
controller: _status,
autofocus: false,
readOnly: true,
cursorColor: primaryColor,
decoration: new InputDecoration(
border: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
Icons.av_timer,
color: primaryColor,
),
),
);
final updateButton = Container( final updateButton = Container(
padding: EdgeInsets.only(top: 40), padding: EdgeInsets.only(top: 40),
child: Container( child: Container(
@@ -266,6 +283,7 @@ class _CustomerEditorState extends State<CustomerEditor> {
widget.customer == null widget.customer == null
? this.isSend ? namebox : Container() ? this.isSend ? namebox : Container()
: namebox, : namebox,
statusbox,
// widget.customer == null ? addButton : updateButton, // widget.customer == null ? addButton : updateButton,
SizedBox( SizedBox(
height: 20, height: 20,
@@ -305,7 +323,8 @@ class _CustomerEditorState extends State<CustomerEditor> {
if (widget.customer == null) return; if (widget.customer == null) return;
var employeeModel = Provider.of<EmployeeModel>(context); var employeeModel = Provider.of<EmployeeModel>(context);
try { try {
await employeeModel.updatePrivileges(widget.customer.docID, privilegesIDs()); await employeeModel.updatePrivileges(
widget.customer.docID, privilegesIDs());
Navigator.pop(context); Navigator.pop(context);
} catch (e) { } catch (e) {
showMsgDialog(context, "Error", e.toString()); showMsgDialog(context, "Error", e.toString());

View File

@@ -1,6 +1,7 @@
import 'package:fcs/model/customer_model.dart'; import 'package:fcs/model/customer_model.dart';
import 'package:fcs/pages/search_page.dart'; import 'package:fcs/pages/search_page.dart';
import 'package:fcs/widget/bottom_up_page_route.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/material.dart';
import 'package:flutter_icons/flutter_icons.dart'; import 'package:flutter_icons/flutter_icons.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
@@ -13,6 +14,8 @@ import '../theme/theme.dart';
import '../vo/user.dart'; import '../vo/user.dart';
import '../widget/local_text.dart'; import '../widget/local_text.dart';
import 'customer_editor.dart'; import 'customer_editor.dart';
import 'invitation_page.dart';
import 'util.dart';
class CustomerList extends StatefulWidget { class CustomerList extends StatefulWidget {
@override @override
@@ -55,6 +58,14 @@ class _CustomerListState extends State<CustomerList> {
fontSize: 20, fontSize: 20,
), ),
), ),
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
Navigator.of(context).push(BottomUpPageRoute(InvitationPage()));
},
icon: Icon(Icons.add),
label: Text(AppTranslations.of(context).text("customer.invite")),
backgroundColor: primaryColor,
),
body: new ListView.separated( body: new ListView.separated(
separatorBuilder: (context, index) => Divider( separatorBuilder: (context, index) => Divider(
color: Colors.black, color: Colors.black,
@@ -116,6 +127,10 @@ class _CustomerListState extends State<CustomerList> {
), ),
), ),
), ),
Padding(
padding: const EdgeInsets.only(right: 10),
child: getStatus(user.status),
),
], ],
), ),
), ),

View File

@@ -0,0 +1,81 @@
import 'package:fcs/pages/util.dart';
import 'package:fcs/vo/custom.dart';
import 'package:fcs/vo/discount.dart';
import 'package:fcs/widget/localization/app_translations.dart';
import 'package:flutter/material.dart';
import 'package:fcs/widget/progress.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../theme/theme.dart';
class DiscountByWeightEditor extends StatefulWidget {
final Discount discount;
DiscountByWeightEditor({this.discount});
@override
_DiscountByWeightEditorState createState() => _DiscountByWeightEditorState();
}
class _DiscountByWeightEditorState extends State<DiscountByWeightEditor> {
TextEditingController _weightController = new TextEditingController();
TextEditingController _rateController = new TextEditingController();
bool _isLoading = false;
Discount _discount = new Discount();
@override
void initState() {
super.initState();
if (widget.discount != null) {
_discount = widget.discount;
_weightController.text = _discount.weight.toString();
_rateController.text = _discount.discountRate.toString();
}
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
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: Text(AppTranslations.of(context).text("discount.new")),
),
body: Container(
padding: EdgeInsets.all(18),
child: Column(
children: <Widget>[
Expanded(
child: ListView(
children: <Widget>[
fcsInput("Weight", FontAwesomeIcons.weightHanging,
controller: _weightController),
fcsInput("Discount Rate", Icons.attach_money,
controller: _rateController),
SizedBox(height: 30),
],
),
),
widget.discount == null
? fcsButton(context, "Create", callack: () {})
: fcsButton(context, "Save", callack: () {}),
SizedBox(height: 10)
],
),
),
),
);
}
}

View File

@@ -183,7 +183,7 @@ class _HomePageState extends State<HomePage> {
Navigator.of(context).push(BottomUpPageRoute(PaymentMethodPage()))); Navigator.of(context).push(BottomUpPageRoute(PaymentMethodPage())));
final discountBtn = _buildBtn2("discount.btn", final discountBtn = _buildBtn2("discount.btn",
icon: FontAwesomeIcons.percent, icon: Entypo.price_ribbon,
btnCallback: () => btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(DiscountList()))); Navigator.of(context).push(BottomUpPageRoute(DiscountList())));
@@ -211,7 +211,7 @@ class _HomePageState extends State<HomePage> {
customer || owner ? widgets.add(invoicesBtn) : ""; customer || owner ? widgets.add(invoicesBtn) : "";
customer || owner ? widgets.add(paymentMethodBtn) : ""; customer || owner ? widgets.add(paymentMethodBtn) : "";
customer || owner ? widgets.add(discountBtn) : ""; customer || owner ? widgets.add(discountBtn) : "";
widgets.add(termBtn); // widgets.add(termBtn);
return OfflineRedirect( return OfflineRedirect(
child: FlavorBanner( child: FlavorBanner(
@@ -338,8 +338,22 @@ class _HomePageState extends State<HomePage> {
children: <Widget>[ children: <Widget>[
// _buildSmallButton( // _buildSmallButton(
// "Policies", FontAwesomeIcons.fileContract), // "Policies", FontAwesomeIcons.fileContract),
_buildSmallButton( InkWell(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => Contact()));
},
child: _buildSmallButton(
"Contact Us", SimpleLineIcons.support), "Contact Us", SimpleLineIcons.support),
),
InkWell(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => Term()));
},
child: _buildSmallButton(
"Terms of services", Icons.info_outline),
),
], ],
) )
], ],
@@ -470,12 +484,7 @@ class _HomePageState extends State<HomePage> {
} }
Widget _buildSmallButton(String text, IconData iconData) { Widget _buildSmallButton(String text, IconData iconData) {
return InkWell( return Padding(
onTap: () => {
Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => Contact())),
},
child: Padding(
padding: const EdgeInsets.all(18.0), padding: const EdgeInsets.all(18.0),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@@ -498,7 +507,6 @@ class _HomePageState extends State<HomePage> {
) )
], ],
), ),
),
); );
} }
} }

View File

@@ -16,6 +16,7 @@ import 'package:provider/provider.dart';
import '../theme/theme.dart'; import '../theme/theme.dart';
import 'profile_page.dart'; import 'profile_page.dart';
import 'signin_page.dart'; import 'signin_page.dart';
import 'term.dart';
final msgLog = Logger('backgroundMessageHandler'); final msgLog = Logger('backgroundMessageHandler');
@@ -141,8 +142,41 @@ class _HomePageWelcomeState extends State<HomePageWelcome> {
Expanded( Expanded(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Padding(
padding: const EdgeInsets.all(100.0),
child: Text(
"Welcome!",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 28,
fontFamily: "Roboto"),
),
),
Padding(
padding: const EdgeInsets.only(top: 80.0),
child: Text(
"Cargo Services",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 28,
fontFamily: "Roboto"),
),
),
Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
"by FCS Trading",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 18,
fontFamily: "Roboto"),
),
),
Container( Container(
padding: EdgeInsets.only(top: 50), padding: EdgeInsets.only(top: 10, bottom: 10),
child: CircleAvatar( child: CircleAvatar(
radius: (50), radius: (50),
backgroundColor: Colors.white, backgroundColor: Colors.white,
@@ -151,80 +185,83 @@ class _HomePageWelcomeState extends State<HomePageWelcome> {
child: Image.asset("assets/logo.jpg"), 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( // Row(
children: <Widget>[ // children: <Widget>[
Expanded( // Expanded(
child: Container( // child: Container(
height: 200, // height: 200,
child: DimensionBox( // // child: DimensionBox(
length: length, // // dimension: Dimension(length, width, height),
width: width, // // color: secondaryColor,
height: height, // // ),
), // ),
), // ),
), // RotatedBox(
RotatedBox( // quarterTurns: -1,
quarterTurns: -1, // child: Slider(
child: Slider( // min: 6,
min: 6, // max: 100,
max: 100, // value: height,
value: height, // onChanged: (value) {
onChanged: (value) { // setState(() {
setState(() { // height = value;
height = value; // });
}); // },
}, // ),
), // ),
), // ],
], // ),
), // Row(
Row( // mainAxisAlignment: MainAxisAlignment.spaceEvenly,
mainAxisAlignment: MainAxisAlignment.spaceEvenly, // children: <Widget>[
children: <Widget>[ // Slider(
Slider( // label: "Length",
label: "Length", // min: 6,
min: 6, // max: 100,
max: 100, // value: length,
value: length, // onChanged: (value) {
onChanged: (value) { // setState(() {
setState(() { // length = value;
length = value; // });
}); // },
}, // ),
), // Slider(
Slider( // label: "Width",
label: "Width", // min: 6,
min: 6, // max: 100,
max: 100, // value: width,
value: width, // onChanged: (value) {
onChanged: (value) { // setState(() {
setState(() { // width = value;
width = value; // });
}); // },
}, // ),
), // ],
], // ),
),
Row( Row(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[ children: <Widget>[
// _buildSmallButton( // _buildSmallButton(
// "Policies", FontAwesomeIcons.fileContract), // "Policies", FontAwesomeIcons.fileContract),
_buildSmallButton( InkWell(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => Contact()));
},
child: _buildSmallButton(
"Contact Us", SimpleLineIcons.support), "Contact Us", SimpleLineIcons.support),
),
InkWell(
onTap: () {
Navigator.of(context).push(
MaterialPageRoute(builder: (_) => Term()));
},
child: _buildSmallButton(
"Terms of services", Icons.info_outline),
),
], ],
) )
], ],
@@ -245,12 +282,7 @@ class _HomePageWelcomeState extends State<HomePageWelcome> {
} }
Widget _buildSmallButton(String text, IconData iconData) { Widget _buildSmallButton(String text, IconData iconData) {
return InkWell( return Padding(
onTap: () => {
Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => Contact())),
},
child: Padding(
padding: const EdgeInsets.all(18.0), padding: const EdgeInsets.all(18.0),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
@@ -258,13 +290,21 @@ class _HomePageWelcomeState extends State<HomePageWelcome> {
icon: Icon(iconData, color: Colors.white70), icon: Icon(iconData, color: Colors.white70),
color: Colors.white70, color: Colors.white70,
onPressed: null), onPressed: null),
// RaisedButton(onPressed: ()=>{},child: Row(
// children: <Widget>[
// IconButton(
// icon: Icon(iconData, ),
// onPressed: null),
// Text(text),
// ],
// ),color: Colors.transparent,
// focusColor: Colors.transparent,),
Text( Text(
text, text,
style: subMenuStyle, style: subMenuStyle,
) )
], ],
), ),
),
); );
} }
} }

View File

@@ -0,0 +1,67 @@
import 'package:fcs/pages/util.dart';
import 'package:fcs/widget/localization/app_translations.dart';
import 'package:flutter/material.dart';
import 'package:fcs/widget/progress.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import '../theme/theme.dart';
class InvitationPage extends StatefulWidget {
@override
_InvitationPageState createState() => _InvitationPageState();
}
class _InvitationPageState extends State<InvitationPage> {
TextEditingController _nameController = new TextEditingController();
TextEditingController _phoneController = new TextEditingController();
bool _isLoading = false;
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
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: Text(AppTranslations.of(context).text("customer.form.title")),
),
body: Container(
padding: EdgeInsets.all(18),
child: Column(
children: <Widget>[
Expanded(
child: ListView(
children: <Widget>[
fcsInput("Name", Icons.person, controller: _nameController),
fcsInput("Phone Number", Icons.phone,
controller: _phoneController),
SizedBox(height: 30),
],
),
),
fcsButton(context, "Invite", callack: () {}),
SizedBox(height: 10)
],
),
),
),
);
}
}

View File

@@ -40,13 +40,26 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
TextEditingController _discountController = new TextEditingController(); TextEditingController _discountController = new TextEditingController();
TextEditingController _amountController = new TextEditingController(); TextEditingController _amountController = new TextEditingController();
TextEditingController _statusController = new TextEditingController(); TextEditingController _statusController = new TextEditingController();
TextEditingController _handlingFeeController = new TextEditingController();
TextEditingController _customFeeController = new TextEditingController();
MultiImgController multiImgController = MultiImgController(); MultiImgController multiImgController = MultiImgController();
TextEditingController _descriptionController = new TextEditingController();
TextEditingController _balanceController = new TextEditingController();
Invoice _invoice; Invoice _invoice;
bool _isLoading = false; bool _isLoading = false;
List<Box> _boxes = []; List<Box> _boxes = [];
bool isSwitched = false; bool isSwitched = false;
String deliveryfee = '\$0'; String deliveryfee = '\$0';
List<Cargo> _cargoTypes = [
Cargo(type: 'General Cargo', weight: 33, price: 6),
Cargo(type: 'Medicine', weight: 33, price: 7),
Cargo(type: 'Dangerous Cargo', weight: 33, price: 8)
];
List<String> _receipts = [
"assets/photos/amazon_ins.png",
];
@override @override
void initState() { void initState() {
@@ -57,10 +70,24 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
_dateController.text = dateFormatter.format(_invoice.invoiceDate); _dateController.text = dateFormatter.format(_invoice.invoiceDate);
_nameController.text = _invoice.customerName; _nameController.text = _invoice.customerName;
_phoneController.text = _invoice.customerPhoneNumber; _phoneController.text = _invoice.customerPhoneNumber;
_amountController.text = _invoice.getAmount.toString(); // _amountController.text = _invoice.getAmount.toString();
_amountController.text = _invoice.amount.toString();
_statusController.text = _invoice.status.toString(); _statusController.text = _invoice.status.toString();
_handlingFeeController.text = '0';
_customFeeController.text = '0';
multiImgController.setImageUrls = _receipts;
_descriptionController.text = 'For Electronics goods';
_balanceController.text =
(_invoice.amount - _invoice.receipts[0].amount).toString();
// _boxes = _invoice.packages; // _boxes = _invoice.packages;
} else {} } else {
_dateController.text = dateFormatter.format(DateTime.now());
_amountController.text = '0';
_handlingFeeController.text = '0';
_customFeeController.text = '0';
_descriptionController.text = '';
_balanceController.text = '0';
}
_boxes = [ _boxes = [
Box( Box(
@@ -140,8 +167,22 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
child: Padding( child: Padding(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
child: ListView(children: <Widget>[ child: ListView(children: <Widget>[
fcsInput('Invoice Date', Icons.date_range, TextFormField(
controller: _dateController), controller: _dateController,
readOnly: true,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Invoice Date',
labelStyle:
TextStyle(fontSize: 16,),
filled: true,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
Icons.date_range,
color: primaryColor,
),
)),
widget.invoice == null widget.invoice == null
? Container() ? Container()
: Container( : Container(
@@ -152,8 +193,8 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
decoration: InputDecoration( decoration: InputDecoration(
fillColor: Colors.white, fillColor: Colors.white,
labelText: 'Invoice Number', labelText: 'Invoice Number',
labelStyle: labelStyle: TextStyle(
TextStyle(fontSize: 16, color: Colors.grey), fontSize: 16,),
filled: true, filled: true,
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
@@ -173,7 +214,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
fillColor: Colors.white, fillColor: Colors.white,
labelText: 'Customer Name', labelText: 'Customer Name',
labelStyle: labelStyle:
TextStyle(fontSize: 16, color: Colors.grey), TextStyle(fontSize: 16,),
filled: true, filled: true,
focusedBorder: UnderlineInputBorder( focusedBorder: UnderlineInputBorder(
borderSide: BorderSide( borderSide: BorderSide(
@@ -202,7 +243,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
fillColor: Colors.white, fillColor: Colors.white,
labelText: 'Customer Name', labelText: 'Customer Name',
labelStyle: TextStyle( labelStyle: TextStyle(
fontSize: 16, color: primaryColor), fontSize: 16,),
filled: true, filled: true,
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
@@ -236,28 +277,6 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
// controller: _amountController), // controller: _amountController),
// ), // ),
widget.invoice == null
? Container()
: Container(
padding: EdgeInsets.only(top: 0),
child: TextFormField(
controller: _amountController,
readOnly: true,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Amount',
labelStyle: TextStyle(
fontSize: 16, color: primaryColor),
filled: true,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
FontAwesomeIcons.moneyBill,
color: primaryColor,
),
)),
),
widget.invoice == null widget.invoice == null
? Container() ? Container()
: Container( : Container(
@@ -269,7 +288,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
fillColor: Colors.white, fillColor: Colors.white,
labelText: 'Status', labelText: 'Status',
labelStyle: TextStyle( labelStyle: TextStyle(
fontSize: 16, color: primaryColor), fontSize: 16, ),
filled: true, filled: true,
enabledBorder: InputBorder.none, enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none, focusedBorder: InputBorder.none,
@@ -280,13 +299,120 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
)), )),
), ),
Container(
padding: EdgeInsets.only(top: 0),
child: TextFormField(
controller: _amountController,
readOnly: true,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Amount',
labelStyle:
TextStyle(fontSize: 16,),
filled: true,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
FontAwesomeIcons.moneyBill,
color: primaryColor,
),
)),
),
Container(
padding: EdgeInsets.only(top: 5),
child: TextFormField(
controller: _balanceController,
readOnly: true,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Balance',
labelStyle:
TextStyle(fontSize: 16, ),
filled: true,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
FontAwesomeIcons.moneyBill,
color: primaryColor,
),
)),
),
Container(
padding: EdgeInsets.only(top: 5),
child: TextFormField(
controller: _handlingFeeController,
readOnly: true,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Handling Fee',
labelStyle:
TextStyle(fontSize: 16,),
filled: true,
enabledBorder: InputBorder.none,
focusedBorder: InputBorder.none,
icon: Icon(
FontAwesomeIcons.moneyBill,
color: primaryColor,
),
)),
),
Container(
padding: EdgeInsets.only(top: 5),
child: TextFormField(
controller: _customFeeController,
readOnly: false,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Customs Fee',
labelStyle:
TextStyle(fontSize: 16,),
filled: true,
icon: Icon(
FontAwesomeIcons.moneyBill,
color: primaryColor,
),
focusedBorder: UnderlineInputBorder(
borderSide:
BorderSide(color: Colors.grey, width: 1.0)),
)),
),
Container(
padding: EdgeInsets.only(top: 5),
child: TextFormField(
controller: _descriptionController,
readOnly: false,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Customs Fee Description',
labelStyle:
TextStyle(fontSize: 16,),
filled: true,
icon: Icon(
Icons.comment,
color: primaryColor,
),
focusedBorder: UnderlineInputBorder(
borderSide:
BorderSide(color: Colors.grey, width: 1.0)),
)),
),
Container( Container(
padding: EdgeInsets.only(top: 20, left: 18), padding: EdgeInsets.only(top: 20, left: 18),
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: Text('Discounts', child: Text(
style: TextStyle(fontSize: 16))), 'Discounts',
style: TextStyle(
fontSize: 16,
color: primaryColor,
fontWeight: FontWeight.bold),
)),
Container( Container(
width: 150.0, width: 150.0,
child: DropdownButtonFormField( child: DropdownButtonFormField(
@@ -306,8 +432,13 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: Text('Payment Method', child: Text(
style: TextStyle(fontSize: 16))), 'Payment Method',
style: TextStyle(
fontSize: 16,
color: primaryColor,
fontWeight: FontWeight.bold),
)),
Container( Container(
width: 150.0, width: 150.0,
child: DropdownButtonFormField( child: DropdownButtonFormField(
@@ -330,7 +461,10 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
padding: const EdgeInsets.only(left: 18.0), padding: const EdgeInsets.only(left: 18.0),
child: Text( child: Text(
'Delivery fee:', 'Delivery fee:',
style: TextStyle(fontSize: 16), style: TextStyle(
fontSize: 16,
color: primaryColor,
fontWeight: FontWeight.bold),
), ),
)), )),
Switch( Switch(
@@ -349,38 +483,70 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
activeTrackColor: primaryColor.withOpacity(0.8), activeTrackColor: primaryColor.withOpacity(0.8),
activeColor: primaryColor, activeColor: primaryColor,
), ),
Text('(Delivery fee : $deliveryfee)',style: TextStyle(color: primaryColor,fontWeight: FontWeight.bold),), Text(
'(Delivery fee : $deliveryfee)',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
], ],
), ),
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
ExpansionTile( ExpansionTile(
title: Text('Payment Attachment'), title: Text(
'Payment Attachment',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[
widget.invoice != null
? Padding(
padding: EdgeInsets.only(left: 20),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Container( Container(
padding: EdgeInsets.only(left: 20), padding: EdgeInsets.only(top: 10),
child: Row(children: <Widget>[ child: Text(
LocalText( '${dateFormatter.format(_invoice.receipts[0].date)} ',
context, style: TextStyle(
"invoice.payment", color: Colors.black, fontSize: 16),
color: Colors.grey,
fontSize: 14,
), ),
MultiImageFile( ),
enabled: true, Container(
padding: EdgeInsets.only(left: 10),
child: MultiImageFile(
enabled: false,
controller: multiImgController, controller: multiImgController,
title: "Receipt File", title: "Receipt",
)),
Container(
padding: EdgeInsets.only(top: 10, left: 10),
child: Text(
'\$${_invoice.receipts[0].amount} ',
style: TextStyle(
color: Colors.black, fontSize: 16),
),
),
],
),
) )
])), : Container(),
SizedBox( SizedBox(
height: 25, height: 25,
), ),
], ],
), ),
ExpansionTile( ExpansionTile(
title: Text('Box Information'), title: Text(
'Box Information',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[ children: <Widget>[
Container( Container(
child: SingleChildScrollView( child: SingleChildScrollView(
@@ -446,9 +612,52 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
//Cargo Table //Cargo Table
ExpansionTile( ExpansionTile(
title: Text('Cargo Table'), title: Text(
children: getCargoTableByBox(context), 'Cargo Table',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
), ),
children: <Widget>[
Container(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: MyDataTable(
headingRowHeight: 40,
columnSpacing: 20,
columns: [
MyDataColumn(
label: LocalText(
context,
"cargo.type",
color: Colors.grey,
),
),
MyDataColumn(
label: LocalText(
context,
"cargo.weight",
color: Colors.grey,
),
),
MyDataColumn(
label: LocalText(
context,
"cargo.rate",
color: Colors.grey,
),
),
MyDataColumn(
label: LocalText(
context,
"cargo.amount",
color: Colors.grey,
),
),
],
rows: getCargoDataRow(context)),
),
),
]),
]), ]),
)), )),
widget.invoice == null widget.invoice == null
@@ -511,7 +720,6 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
} }
getCargoTableByBox(BuildContext context) { getCargoTableByBox(BuildContext context) {
return _boxes.map((b) {
return Padding( return Padding(
padding: const EdgeInsets.all(5.0), padding: const EdgeInsets.all(5.0),
child: Container( child: Container(
@@ -560,8 +768,7 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
), ),
), ),
], ],
rows: getCargoDataRow(context, b), rows: getCargoDataRow(context)),
),
), ),
), ),
) )
@@ -569,11 +776,21 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
), ),
), ),
); );
}).toList();
} }
List<MyDataRow> getBoxRow(BuildContext context) { List<MyDataRow> getBoxRow(BuildContext context) {
return _boxes.map((p) { return _boxes.map((p) {
p.cargoTypes.map((cargo) {
print('cargo => $cargo');
_cargoTypes.asMap().map((index, _cargo) {
if (_cargo.type == cargo.type) {
setState(() {
_cargoTypes[index].weight += cargo.weight;
});
print('${_cargoTypes[index].type} =>${_cargoTypes[index]}');
}
});
});
return MyDataRow( return MyDataRow(
onSelectChanged: (bool selected) {}, onSelectChanged: (bool selected) {},
cells: [ cells: [
@@ -600,24 +817,22 @@ class _InvoiceEditorState extends State<InvoiceEditor> {
}).toList(); }).toList();
} }
List<MyDataRow> getCargoDataRow(BuildContext context, Box box) { List<MyDataRow> getCargoDataRow(BuildContext context) {
var rate = 5; return _cargoTypes.map((cargo) {
return box.cargoTypes.map((p) { var amt = cargo.weight * cargo.price;
rate++;
var amt = p.weight * rate;
return MyDataRow( return MyDataRow(
onSelectChanged: (bool selected) {}, onSelectChanged: (bool selected) {},
cells: [ cells: [
MyDataCell(new Text( MyDataCell(new Text(
p.type, cargo.type,
style: textStyle, style: textStyle,
)), )),
MyDataCell(new Text( MyDataCell(new Text(
p.weight.toString(), cargo.weight.toString(),
style: textStyle, style: textStyle,
)), )),
MyDataCell(new Text( MyDataCell(new Text(
'\$${rate}', '\$${cargo.price}',
style: textStyle, style: textStyle,
)), )),
MyDataCell(new Text( MyDataCell(new Text(

View File

@@ -30,7 +30,6 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
var dateFormatter = new DateFormat('dd MMM yyyy'); var dateFormatter = new DateFormat('dd MMM yyyy');
final double dotSize = 15.0; final double dotSize = 15.0;
Invoice _invoice = new Invoice(); Invoice _invoice = new Invoice();
// String pdfPath = 'assets/Invoice-A092(A)-32.pdf';
String pdfPath = ''; String pdfPath = '';
@override @override
@@ -41,11 +40,12 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
_invoice = widget.invoice; _invoice = widget.invoice;
} }
// fromAsset('assets/demo.pdf', 'demo.pdf').then((f) { fromAsset('assets/Invoice-A092(A)-32.pdf', 'Invoice-A092(A)-32.pdf')
// setState(() { .then((f) {
// pdfPath = f.path; setState(() {
// }); pdfPath = f.path;
// }); });
});
} }
Future<File> fromAsset(String asset, String filename) async { Future<File> fromAsset(String asset, String filename) async {
@@ -73,21 +73,21 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
var owner = Provider.of<MainModel>(context).isOwner(); var owner = Provider.of<MainModel>(context).isOwner();
return Container( return Container(
padding: EdgeInsets.only(left: 15, right: 15), padding: EdgeInsets.only(left: 15, right: 15),
child: InkWell(
onTap: () {
owner
? Navigator.of(context)
.push(BottomUpPageRoute(InvoiceEditor(invoice: _invoice)))
: Navigator.pop(context);
// Navigator.of(context).push(BottomUpPageRoute(PaymentPDFScreen(
// path: pdfPath,
// )));
},
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: new Padding( child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0), padding: const EdgeInsets.symmetric(vertical: 10.0),
child: InkWell(
onTap: () {
owner
? Navigator.of(context).push(
BottomUpPageRoute(InvoiceEditor(invoice: _invoice)))
: Navigator.of(context)
.push(BottomUpPageRoute(PaymentPDFScreen(
path: pdfPath,
)));
},
child: new Row( child: new Row(
children: <Widget>[ children: <Widget>[
Container( Container(
@@ -127,6 +127,7 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
), ),
), ),
), ),
),
Padding( Padding(
padding: const EdgeInsets.all(0), padding: const EdgeInsets.all(0),
child: getStatus(_invoice.status), child: getStatus(_invoice.status),
@@ -160,7 +161,6 @@ class _InvoiceListRowState extends State<InvoiceListRow> {
), ),
], ],
), ),
),
); );
} }

View File

@@ -15,8 +15,6 @@ import 'package:flutter_icons/flutter_icons.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:timeline_list/timeline.dart';
import 'package:timeline_list/timeline_model.dart';
class PaymentPage extends StatefulWidget { class PaymentPage extends StatefulWidget {
final Invoice invoice; final Invoice invoice;
@@ -40,9 +38,7 @@ class _PaymentPageState extends State<PaymentPage> {
Invoice _invoice = new Invoice(); Invoice _invoice = new Invoice();
bool _isLoading = false; bool _isLoading = false;
List<String> _receipts = [ List<String> _receipts = [
"assets/photos/1.jpg", "assets/photos/amazon_ins.png",
"assets/photos/2.jpg",
"assets/photos/3.jpg"
]; ];
bool isNew; bool isNew;
@@ -50,6 +46,7 @@ class _PaymentPageState extends State<PaymentPage> {
void initState() { void initState() {
if (widget.invoice != null) { if (widget.invoice != null) {
_invoice = widget.invoice; _invoice = widget.invoice;
multiImgController.setImageUrls = _receipts;
} }
super.initState(); super.initState();
} }
@@ -63,8 +60,6 @@ class _PaymentPageState extends State<PaymentPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var owner = Provider.of<MainModel>(context).isOwner();
// var images = isNew ? [] : _images; // var images = isNew ? [] : _images;
return LocalProgress( return LocalProgress(
inAsyncCall: _isLoading, inAsyncCall: _isLoading,
@@ -81,6 +76,23 @@ class _PaymentPageState extends State<PaymentPage> {
body: Card( body: Card(
child: Column( child: Column(
children: <Widget>[ children: <Widget>[
Padding(
padding: const EdgeInsets.all(15.0),
child: Container(
child: Row(
children: <Widget>[
LocalText(context, 'total.amount',
color: Colors.black, fontSize: 16),
Text(
' \$ ${_invoice.amount}',
style: TextStyle(
color: primaryColor,
fontSize: 16,
fontWeight: FontWeight.bold),
)
],
)),
),
Padding( Padding(
padding: const EdgeInsets.all(15.0), padding: const EdgeInsets.all(15.0),
child: Container( child: Container(
@@ -89,7 +101,7 @@ class _PaymentPageState extends State<PaymentPage> {
LocalText(context, 'remaining_balance', LocalText(context, 'remaining_balance',
color: Colors.black, fontSize: 16), color: Colors.black, fontSize: 16),
Text( Text(
'${_invoice.amount}', ' \$ ${_invoice.amount - _invoice.receipts[0].amount}',
style: TextStyle( style: TextStyle(
color: primaryColor, color: primaryColor,
fontSize: 16, fontSize: 16,
@@ -105,21 +117,30 @@ class _PaymentPageState extends State<PaymentPage> {
title: LocalText(context, 'payment.attachment', title: LocalText(context, 'payment.attachment',
color: Colors.black, fontSize: 16), color: Colors.black, fontSize: 16),
children: <Widget>[ children: <Widget>[
Container( Padding(
padding: EdgeInsets.only(left: 20), padding: EdgeInsets.only(left: 20),
child: Row(children: <Widget>[ child: Row(
LocalText( mainAxisAlignment: MainAxisAlignment.start,
context, crossAxisAlignment: CrossAxisAlignment.start,
"invoice.payment", children: <Widget>[
color: Colors.grey, Container(
fontSize: 14, padding: EdgeInsets.only(top: 8),
child: Text(
'${dateFormatter.format(_invoice.receipts[0].date)} ',
style: TextStyle(
color: Colors.black, fontSize: 16),
), ),
MultiImageFile( ),
Container(
padding: EdgeInsets.only(left: 10),
child: MultiImageFile(
enabled: true, enabled: true,
controller: multiImgController, controller: multiImgController,
title: "Receipt File", title: "Receipt File",
) )),
])), ],
),
),
SizedBox( SizedBox(
height: 25, height: 25,
), ),

View File

@@ -85,9 +85,7 @@ class _NotificationListState extends State<NotificationList> {
children: <Widget>[ children: <Widget>[
new Text( new Text(
msg.receiverName, msg.receiverName,
style: new TextStyle( style: new TextStyle(fontSize: 15.0),
fontSize: 15.0,
color: primaryColor),
), ),
], ],
), ),
@@ -103,11 +101,14 @@ class _NotificationListState extends State<NotificationList> {
children: <Widget>[ children: <Widget>[
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text(timeFormatter.format(msg.date)), child: Text(
timeFormatter.format(msg.date),
style: TextStyle(color: Colors.grey),
),
), ),
msg.fromToday() msg.fromToday()
? Container() ? Container()
: Text(dateFormatter.format(msg.date)), : Text(dateFormatter.format(msg.date),style: TextStyle(color: Colors.grey),),
], ],
), ),
) )

View File

@@ -27,6 +27,7 @@ class _PaymentMethodEditorState extends State<PaymentMethodEditor> {
TextEditingController _accountNumberController = new TextEditingController(); TextEditingController _accountNumberController = new TextEditingController();
TextEditingController _mailController = new TextEditingController(); TextEditingController _mailController = new TextEditingController();
TextEditingController _phoneController = new TextEditingController(); TextEditingController _phoneController = new TextEditingController();
TextEditingController _linkController = new TextEditingController();
bool isNew = false; bool isNew = false;
@@ -40,6 +41,7 @@ class _PaymentMethodEditorState extends State<PaymentMethodEditor> {
_accountNumberController.text = _paymentMethod.account; _accountNumberController.text = _paymentMethod.account;
_mailController.text = _paymentMethod.mail; _mailController.text = _paymentMethod.mail;
_phoneController.text = _paymentMethod.phone; _phoneController.text = _paymentMethod.phone;
_linkController.text = _paymentMethod.link;
} else { } else {
isNew = true; isNew = true;
_nameController.text = ''; _nameController.text = '';
@@ -73,10 +75,12 @@ class _PaymentMethodEditorState extends State<PaymentMethodEditor> {
controller: _accountNameController), controller: _accountNameController),
fcsInput('Account Number', FontAwesomeIcons.moneyBill, fcsInput('Account Number', FontAwesomeIcons.moneyBill,
controller: _accountNumberController), controller: _accountNumberController),
fcsInput('E-mail', Icons.mail, // fcsInput('E-mail', Icons.mail,
controller: _mailController), // controller: _mailController),
fcsInput('Phone', Icons.phone, // fcsInput('Phone', Icons.phone,
controller: _phoneController) // controller: _phoneController),
fcsInput('Phone', Icons.link,
controller: _linkController)
], ],
), ),
), ),

View File

@@ -63,13 +63,6 @@ class _PaymentMethodPageState extends State<PaymentMethodPage> {
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
// Text(
// 'Account Name: ',
// style: TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.normal,
// fontSize: 15),
// ),
Text( Text(
method.accountName, method.accountName,
style: TextStyle( style: TextStyle(
@@ -80,18 +73,12 @@ class _PaymentMethodPageState extends State<PaymentMethodPage> {
], ],
), ),
), ),
Padding( method.account != null
? Padding(
padding: const EdgeInsets.only(left: 8.0, top: 8.0), padding: const EdgeInsets.only(left: 8.0, top: 8.0),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
// Text(
// 'Account Number: ',
// style: TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.normal,
// fontSize: 15),
// ),
Text( Text(
method.account, method.account,
style: TextStyle( style: TextStyle(
@@ -101,21 +88,14 @@ class _PaymentMethodPageState extends State<PaymentMethodPage> {
), ),
], ],
), ),
), )
Padding( : Padding(
padding: const EdgeInsets.only(left: 8.0, top: 8.0), padding: const EdgeInsets.only(left: 8.0, top: 8.0),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
// Text(
// 'Email: ',
// style: TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.normal,
// fontSize: 15),
// ),
Text( Text(
method.mail, method.link,
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
@@ -123,29 +103,7 @@ class _PaymentMethodPageState extends State<PaymentMethodPage> {
), ),
], ],
), ),
), )
Padding(
padding: const EdgeInsets.only(left: 8.0, top: 8.0),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
// Text(
// 'Phone: ',
// style: TextStyle(
// color: Colors.black,
// fontWeight: FontWeight.normal,
// fontSize: 15),
// ),
Text(
method.phone,
style: TextStyle(
color: Colors.black,
fontWeight: FontWeight.normal,
fontSize: 15),
),
],
),
),
], ],
), ),
), ),
@@ -160,7 +118,7 @@ class _PaymentMethodPageState extends State<PaymentMethodPage> {
); );
}, },
icon: Icon(Icons.add), icon: Icon(Icons.add),
label: Text(AppTranslations.of(context).text("discount.new")), label: Text(AppTranslations.of(context).text("payment.method.new")),
backgroundColor: primaryColor, backgroundColor: primaryColor,
), ),
), ),

View File

@@ -42,6 +42,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
if (widget.box != null) { if (widget.box != null) {
_box = widget.box; _box = widget.box;
_shippingAddress = _box.shippingAddress; _shippingAddress = _box.shippingAddress;
isNew = false; isNew = false;
} else { } else {
List<Package> packages = [ List<Package> packages = [
@@ -68,7 +69,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
length: 0, length: 0,
packages: packages, packages: packages,
cargoTypes: _cargoTypes, cargoTypes: _cargoTypes,
); shipmentWeight: 0);
} }
} }
@@ -111,7 +112,7 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
textAlign: TextAlign.end, textAlign: TextAlign.end,
decoration: InputDecoration( decoration: InputDecoration(
fillColor: Colors.white, fillColor: Colors.white,
labelText: 'Total Weight', labelText: 'Actual Weight',
filled: true, filled: true,
icon: Icon(FontAwesomeIcons.weightHanging, icon: Icon(FontAwesomeIcons.weightHanging,
color: primaryColor), color: primaryColor),
@@ -169,6 +170,12 @@ class _PickupBoxEditorState extends State<PickupBoxEditor> {
color: primaryColor, fontWeight: FontWeight.bold), color: primaryColor, fontWeight: FontWeight.bold),
), ),
children: [ children: [
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: fcsInputReadOnly(
"Shipment Weight", FontAwesomeIcons.weightHanging,
value: _box.shipmentWeight.toString()),
),
Padding( Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20), padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField( child: TextFormField(

View File

@@ -263,6 +263,25 @@ class _PickUpEditorState extends State<PickUpEditor> {
), ),
), ),
), ),
widget.pickUp == null
? Container()
: Padding(
padding: const EdgeInsets.only(left: 15.0),
child: fcsInputReadOnly(
"Handling Fee", FontAwesomeIcons.moneyBill,
controller: _handlingFeeController),
// 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),
),
ExpansionTile( ExpansionTile(
title: Text( title: Text(
'Pickup Location / Time', 'Pickup Location / Time',
@@ -323,20 +342,6 @@ 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),
@@ -671,7 +676,17 @@ class _PickUpEditorState extends State<PickUpEditor> {
child: new Text( child: new Text(
_box.value.weight == null _box.value.weight == null
? '' ? ''
: "Total Weight:${_box.value.weight.toString()}lb", : "Actual Weight:${_box.value.weight.toString()}lb",
style:
new TextStyle(fontSize: 14.0, color: Colors.grey),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
_box.value.shipmentWeight == null
? ''
: "Shipment Weight:${_box.value.shipmentWeight.toString()}lb",
style: style:
new TextStyle(fontSize: 14.0, color: Colors.grey), new TextStyle(fontSize: 14.0, color: Colors.grey),
), ),

View File

@@ -1,9 +1,10 @@
import 'package:fcs/model/pickup_model.dart';
import 'package:fcs/model/shipment_rate_model.dart'; import 'package:fcs/model/shipment_rate_model.dart';
import 'package:fcs/pages/shipment_rates_calculate.dart'; import 'package:fcs/pages/shipment_rates_calculate.dart';
import 'package:fcs/pages/shipment_rates_edit.dart'; import 'package:fcs/pages/shipment_rates_edit.dart';
import 'package:fcs/pages/term.dart'; import 'package:fcs/vo/custom.dart';
import 'package:fcs/vo/discount.dart';
import 'package:fcs/vo/pickup.dart'; import 'package:fcs/vo/pickup.dart';
import 'package:fcs/vo/rate.dart';
import 'package:fcs/widget/bottom_up_page_route.dart'; import 'package:fcs/widget/bottom_up_page_route.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:fcs/widget/localization/app_translations.dart'; import 'package:fcs/widget/localization/app_translations.dart';
@@ -90,26 +91,72 @@ class _ShipmentRatesState extends State<ShipmentRates> {
child: ListView( child: ListView(
// crossAxisAlignment: CrossAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[ children: <Widget>[
Container(
padding: EdgeInsets.only(left: 25, top: 10),
child: Text(
"Cargo Types",
style: TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold,
fontSize: 15),
),
),
Container( Container(
height: 135, height: 135,
child: ListView.builder( child: Column(
itemCount: shipmentRateModel.rates.length, children: getCargoWidget(shipmentRateModel.rates),
itemBuilder: (context, index) { ),
return _row( ),
shipmentRateModel.rates[index].description, Divider(
"\$ " + color: Colors.grey,
shipmentRateModel.rates[index].price.toString(), ),
'per pound'); Container(
}), padding: EdgeInsets.only(left: 25, top: 10),
child: Text(
"Custom Duties",
style: TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold,
fontSize: 15),
),
),
Container(
height: 100,
child: Column(
children: getCustonWidget(shipmentRateModel.customs),
),
),
Divider(
color: Colors.grey,
),
Container(
padding: EdgeInsets.only(left: 25, top: 10),
child: Text(
"Discounts by weight",
style: TextStyle(
color: primaryColor,
fontWeight: FontWeight.bold,
fontSize: 15),
),
),
Container(
height: 100,
child: Column(
children:
getDiscountWidget(shipmentRateModel.discountsByWeight),
),
),
Divider(
color: Colors.grey,
), ),
_row("Free delivery within Yangon \nfor shipments over", "10", _row("Free delivery within Yangon \nfor shipments over", "10",
"pounds"), "pounds"),
_row("Delivery fees", "\$ 5", "below 10 pounds"), _row("Delivery fees", "\$ 5", "below 10 pounds"),
_row("Volumetric Ratio", "\$ 166.36", "per pound"), _row("Volumetric Ratio", "166.36", "in3 per pound"),
fcsButton(context, "Terms & Conditions", callack: () { // fcsButton(context, "Terms & Conditions", callack: () {
Navigator.of(context) // Navigator.of(context)
.push(MaterialPageRoute(builder: (_) => Term())); // .push(MaterialPageRoute(builder: (_) => Term()));
}), // }),
fcsButton(context, "Estimate shipping cost", callack: () { fcsButton(context, "Estimate shipping cost", callack: () {
Navigator.of(context) Navigator.of(context)
.push(BottomUpPageRoute(ShipmentRatesCal())); .push(BottomUpPageRoute(ShipmentRatesCal()));
@@ -126,6 +173,32 @@ class _ShipmentRatesState extends State<ShipmentRates> {
); );
} }
List<Widget> getCargoWidget(List<Rate> rates) {
return rates.map((cargo) {
return Container(
child: _row(
cargo.description, "\$ " + cargo.price.toString(), 'per pound'),
);
}).toList();
}
List<Widget> getCustonWidget(List<Custom> customs) {
return customs.map((c) {
return Container(
child: _row(c.productType, "\$ " + c.fee.toString(), ''),
);
}).toList();
}
List<Widget> getDiscountWidget(List<Discount> discounts) {
return discounts.map((d) {
return Container(
child: _row(
"${d.weight.toString()} lb", "\$ " + d.discountRate.toString(), ''),
);
}).toList();
}
_row(String desc, String price, String unit) { _row(String desc, String price, String unit) {
return Container( return Container(
padding: EdgeInsets.only(left: 25, top: 5, bottom: 5), padding: EdgeInsets.only(left: 25, top: 5, bottom: 5),

View File

@@ -101,6 +101,7 @@ class _ShipmentRatesCalState extends State<ShipmentRatesCal> {
_row('Width (inches)', "", "", "10", input: true), _row('Width (inches)', "", "", "10", input: true),
_row('Height', "", "", "10", input: true), _row('Height', "", "", "10", input: true),
_row('Length', "", "", "10", input: true), _row('Length', "", "", "10", input: true),
_row('Actual Weight', "", "", "0", input: true),
Container( Container(
padding: EdgeInsets.only(left: 25, top: 15, bottom: 5), padding: EdgeInsets.only(left: 25, top: 15, bottom: 5),
child: Row( child: Row(

View File

@@ -1,10 +1,10 @@
import 'package:fcs/model/pickup_model.dart';
import 'package:fcs/model/shipment_rate_model.dart'; import 'package:fcs/model/shipment_rate_model.dart';
import 'package:fcs/pages_fcs/cargo_editor.dart'; import 'package:fcs/pages_fcs/cargo_editor.dart';
import 'package:fcs/vo/custom.dart';
import 'package:fcs/vo/discount.dart';
import 'package:fcs/vo/pickup.dart'; import 'package:fcs/vo/pickup.dart';
import 'package:fcs/vo/rate.dart'; import 'package:fcs/vo/rate.dart';
import 'package:fcs/widget/bottom_up_page_route.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:fcs/widget/my_data_table.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@@ -14,6 +14,8 @@ import 'package:flutter/material.dart';
import 'package:fcs/widget/progress.dart'; import 'package:fcs/widget/progress.dart';
import '../theme/theme.dart'; import '../theme/theme.dart';
import 'custom_editor.dart';
import 'discount_by_weight_editor.dart';
import 'util.dart'; import 'util.dart';
class ShipmentRatesEdit extends StatefulWidget { class ShipmentRatesEdit extends StatefulWidget {
@@ -150,6 +152,133 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
) )
], ],
), ),
ExpansionTile(
title: Text(
'Custom Duties',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[
Container(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: MyDataTable(
headingRowHeight: 40,
columnSpacing: 50,
columns: [
MyDataColumn(
label: Text("Produt Type",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600]))),
MyDataColumn(
label: Text("Fee",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600]))),
MyDataColumn(
label: Text("Delete",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600]))),
],
rows: getCustomsRows(shipmentRateModel.customs),
),
),
),
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,
icon: Icon(Icons.add),
onPressed: () {
Navigator.push(
context,
BottomUpPageRoute(CustomEditor()),
);
},
label: Text(
'Add Custom\nDuty',
style: TextStyle(fontSize: 12),
),
backgroundColor: primaryColor,
),
),
),
)
],
),
ExpansionTile(
title: Text(
'Discounts by weight',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[
Container(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: MyDataTable(
headingRowHeight: 40,
columnSpacing: 30,
columns: [
MyDataColumn(
label: Text("Weight",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600]))),
MyDataColumn(
label: Text("Discount Rate",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600]))),
MyDataColumn(
label: Text("Delete",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600]))),
],
rows: getDiscounts(
shipmentRateModel.discountsByWeight),
),
),
),
Container(
padding:
EdgeInsets.only(top: 20, bottom: 15, right: 15),
child: Align(
alignment: Alignment.bottomRight,
child: Container(
width: 130,
height: 40,
child: FloatingActionButton.extended(
materialTapTargetSize:
MaterialTapTargetSize.shrinkWrap,
icon: Icon(Icons.add),
onPressed: () {
Navigator.push(
context,
BottomUpPageRoute(DiscountByWeightEditor()),
);
},
label: Text(
'Add Discount',
style: TextStyle(fontSize: 12),
),
backgroundColor: primaryColor,
),
),
),
)
],
),
], ],
), ),
), ),
@@ -192,6 +321,64 @@ class _ShipmentRatesEditState extends State<ShipmentRatesEdit> {
}).toList(); }).toList();
} }
List<MyDataRow> getCustomsRows(List<Custom> customs) {
return customs.map((c) {
return MyDataRow(
onSelectChanged: (selected) {
Navigator.push(
context,
BottomUpPageRoute(CustomEditor(custom: c)),
);
},
cells: [
MyDataCell(
new Text(
c.productType,
style: textStyle,
),
),
MyDataCell(
new Text(
c.fee.toString(),
style: textStyle,
),
),
MyDataCell(IconButton(icon: Icon(Icons.delete), onPressed: null)),
],
);
}).toList();
}
List<MyDataRow> getDiscounts(List<Discount> discounts) {
return discounts.map((d) {
return MyDataRow(
onSelectChanged: (selected) {
// Navigator.push(
// context,
// BottomUpPageRoute(CargoEditor(rate: r)),
// );
},
cells: [
MyDataCell(
new Text(
"${d.weight} lb",
style: textStyle,
),
),
MyDataCell(
Center(
child: new Text(
d.discountRate.toString(),
style: textStyle,
),
),
),
MyDataCell(IconButton(icon: Icon(Icons.delete), onPressed: null)),
],
);
}).toList();
}
_row(String desc, String price, String unit) { _row(String desc, String price, String unit) {
return Container( return Container(
padding: EdgeInsets.only(left: 25, top: 5, bottom: 5), padding: EdgeInsets.only(left: 25, top: 5, bottom: 5),

View File

@@ -94,9 +94,7 @@ class _StaffListState extends State<StaffList> {
children: <Widget>[ children: <Widget>[
new Text( new Text(
user.name, user.name,
style: new TextStyle( style: new TextStyle(fontSize: 15.0),
fontSize: 15.0,
color: primaryColor),
), ),
Padding( Padding(
padding: padding:

View File

@@ -278,8 +278,7 @@ Widget getStatus(String status) {
? Text( ? Text(
status, status,
style: TextStyle( style: TextStyle(
color: Colors.red, color: Colors.red, fontSize: 18),
fontSize: 18),
) )
: status == "Paid" : status == "Paid"
? Row( ? Row(
@@ -471,6 +470,7 @@ Widget fcsInputReadOnly(String label, IconData iconData,
cursorColor: primaryColor, cursorColor: primaryColor,
maxLines: null, maxLines: null,
minLines: 1, minLines: 1,
readOnly: true,
decoration: InputDecoration( decoration: InputDecoration(
fillColor: Colors.white, fillColor: Colors.white,
border: InputBorder.none, border: InputBorder.none,
@@ -479,7 +479,7 @@ Widget fcsInputReadOnly(String label, IconData iconData,
filled: true, filled: true,
icon: Icon( icon: Icon(
iconData, iconData,
color: Colors.grey, color:primaryColor,
), ),
)); ));
// return Row( // return Row(

View File

@@ -89,7 +89,7 @@ class _BoxEditorState extends State<BoxEditor> {
length: 0, length: 0,
packages: packages, packages: packages,
cargoTypes: _cargoTypes, cargoTypes: _cargoTypes,
); shipmentWeight: 0);
} }
} }
@@ -283,7 +283,7 @@ class _BoxEditorState extends State<BoxEditor> {
textAlign: TextAlign.end, textAlign: TextAlign.end,
decoration: InputDecoration( decoration: InputDecoration(
fillColor: Colors.white, fillColor: Colors.white,
labelText: 'Total Weight', labelText: 'Actual Weight',
filled: true, filled: true,
icon: Icon(FontAwesomeIcons.weightHanging, icon: Icon(FontAwesomeIcons.weightHanging,
color: primaryColor), color: primaryColor),
@@ -369,6 +369,12 @@ class _BoxEditorState extends State<BoxEditor> {
color: primaryColor, fontWeight: FontWeight.bold), color: primaryColor, fontWeight: FontWeight.bold),
), ),
children: [ children: [
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: fcsInputReadOnly(
"Shipment Weight", FontAwesomeIcons.weightHanging,
value: _box.shipmentWeight.toString()),
),
Padding( Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20), padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField( child: TextFormField(

View File

@@ -1,7 +1,9 @@
import 'package:fcs/model/main_model.dart'; import 'package:fcs/model/main_model.dart';
import 'package:fcs/model/shipment_model.dart'; import 'package:fcs/model/shipment_model.dart';
import 'package:fcs/pages/barcode_screen_page.dart'; import 'package:fcs/pages/barcode_screen_page.dart';
import 'package:fcs/pages/shipping_address_editor.dart';
import 'package:fcs/pages/util.dart'; import 'package:fcs/pages/util.dart';
import 'package:fcs/pages_fcs/shipping_address_row.dart';
import 'package:fcs/vo/package.dart'; import 'package:fcs/vo/package.dart';
import 'package:fcs/vo/shipping_address.dart'; import 'package:fcs/vo/shipping_address.dart';
import 'package:fcs/widget/bottom_up_page_route.dart'; import 'package:fcs/widget/bottom_up_page_route.dart';
@@ -17,6 +19,7 @@ import 'package:timeline_list/timeline.dart';
import 'package:timeline_list/timeline_model.dart'; import 'package:timeline_list/timeline_model.dart';
import '../theme/theme.dart'; import '../theme/theme.dart';
import 'shipping_address_list.dart';
class PackageEditor extends StatefulWidget { class PackageEditor extends StatefulWidget {
final Package package; final Package package;
@@ -43,6 +46,13 @@ class _PackageEditorState extends State<PackageEditor> {
"assets/photos/3.jpg" "assets/photos/3.jpg"
]; ];
bool isNew; bool isNew;
ShippingAddress shippingAddress = ShippingAddress(
fullName: 'U Nyi Nyi',
addressLine1: '154-19 64th Ave.',
addressLine2: 'Flushing',
city: 'NY',
state: 'NY',
phoneNumber: '+1 (292)215-2247');
@override @override
void initState() { void initState() {
@@ -352,6 +362,7 @@ class _PackageEditorState extends State<PackageEditor> {
), ),
], ],
), ),
getShippingAddressList(context),
isNew isNew
? Container() ? Container()
: ExpansionTile( : ExpansionTile(
@@ -373,7 +384,6 @@ class _PackageEditorState extends State<PackageEditor> {
), ),
], ],
), ),
getShippingAddressList(context),
], ],
), ),
), ),
@@ -432,45 +442,152 @@ class _PackageEditorState extends State<PackageEditor> {
color: primaryColor), color: primaryColor),
), ),
children: <Widget>[ children: <Widget>[
// Column(
// children: getAddressList(context, shipmentModel.shippingAddresses),
// ),
Container( Container(
child: SingleChildScrollView( padding: EdgeInsets.only(left: 10, right: 10),
scrollDirection: Axis.horizontal, child: Column(
child: MyDataTable( children: <Widget>[
headingRowHeight: 40, Row(
columnSpacing: 50, children: <Widget>[
columns: [ Expanded(
MyDataColumn( child: new Padding(
label: Text( padding: const EdgeInsets.symmetric(vertical: 10.0),
"Full Name", child: Row(
style: TextStyle( children: <Widget>[
fontSize: 15, new Column(
color: Colors.grey[600], crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
shippingAddress.fullName == null
? ''
: shippingAddress.fullName,
style: new TextStyle(
fontSize: 15.0,
color: Colors.black,
fontWeight: FontWeight.bold),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
shippingAddress.addressLine1 == null
? ''
: shippingAddress.addressLine1,
style: new TextStyle(
fontSize: 14.0, color: Colors.grey),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
shippingAddress.addressLine2 == null
? ''
: shippingAddress.addressLine2,
style: new TextStyle(
fontSize: 14.0, color: Colors.grey),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
shippingAddress.city == null
? ''
: shippingAddress.city,
style: new TextStyle(
fontSize: 14.0, color: Colors.grey),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
shippingAddress.state == null
? ''
: shippingAddress.state,
style: new TextStyle(
fontSize: 14.0, color: Colors.grey),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
shippingAddress.phoneNumber == null
? ''
: "Phone:${shippingAddress.phoneNumber}",
style: new TextStyle(
fontSize: 14.0, color: Colors.grey),
), ),
)),
MyDataColumn(
label: Text(
"Phone Number",
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: 130,
height: 40,
child: FloatingActionButton.extended(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onPressed: () async {
var address = await Navigator.push(
context,
BottomUpPageRoute(ShippingAddressList()),
);
print('address => ${address}');
setState(() {
if (address != null) {
this.shippingAddress = address;
}
});
},
icon: Icon(Icons.add),
label: Text(
'Add Shipping\nAddress',
style: TextStyle(fontSize: 12),
),
backgroundColor: primaryColor,
),
),
),
)
],
),
); );
} }
List<Widget> getAddressList(
BuildContext context, List<ShippingAddress> addresses) {
return addresses.asMap().entries.map((s) {
return InkWell(
onTap: () {
Navigator.push(
context,
BottomUpPageRoute(ShippingAddressEditor(shippingAddress: s.value)),
);
},
child: ShippingAddressRow(shippingAddress: s.value, index: s.key),
);
}).toList();
}
List<MyDataRow> getAddressRows(List<ShippingAddress> addresses) { List<MyDataRow> getAddressRows(List<ShippingAddress> addresses) {
return addresses.map((s) { return addresses.map((s) {
return MyDataRow( return MyDataRow(
onSelectChanged: (selected) { onSelectChanged: (selected) {},
},
cells: [ cells: [
MyDataCell( MyDataCell(
new Text( new Text(

View File

@@ -0,0 +1,106 @@
import 'package:fcs/model/shipment_model.dart';
import 'package:fcs/pages/search_page.dart';
import 'package:fcs/pages_fcs/shipping_address_row.dart';
import 'package:fcs/vo/shipping_address.dart';
import 'package:fcs/widget/bottom_up_page_route.dart';
import 'package:fcs/widget/localization/app_translations.dart';
import 'package:fcs/widget/progress.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../theme/theme.dart';
class ShippingAddressList extends StatefulWidget {
@override
_ShippingAddressListState createState() => _ShippingAddressListState();
}
class _ShippingAddressListState extends State<ShippingAddressList> {
bool _isLoading = false;
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
var shipmentModel = Provider.of<ShipmentModel>(context);
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: Text(AppTranslations.of(context).text("shipping_address")),
actions: <Widget>[
IconButton(
icon: Icon(
Icons.search,
color: Colors.white,
),
iconSize: 30,
onPressed: () => showPlacesSearch(context),
),
],
),
body: Column(
children: <Widget>[
Expanded(
child: Column(
children:
getAddressList(context, shipmentModel.shippingAddresses),
),
),
Container(
padding: EdgeInsets.only(top: 20, bottom: 15, right: 15),
child: Align(
alignment: Alignment.bottomRight,
child: Container(
width: 130,
height: 40,
child: FloatingActionButton.extended(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onPressed: () {
Navigator.push(
context,
BottomUpPageRoute(ShippingAddressList()),
);
},
icon: Icon(Icons.add),
label: Text(
'Add Shipping\nAddress',
style: TextStyle(fontSize: 12),
),
backgroundColor: primaryColor,
),
),
),
),
],
)),
);
}
List<Widget> getAddressList(
BuildContext context, List<ShippingAddress> addresses) {
return addresses.asMap().entries.map((s) {
return InkWell(
onTap: () {
Navigator.pop(context, s.value);
},
child: ShippingAddressRow(shippingAddress: s.value, index: s.key),
);
}).toList();
}
}

View File

@@ -24,6 +24,7 @@ class Box {
int width; int width;
int height; int height;
int length; int length;
int shipmentWeight;
int rate; int rate;
int weight; int weight;
@@ -60,6 +61,7 @@ class Box {
this.width, this.width,
this.height, this.height,
this.length, this.length,
this.shipmentWeight,
this.rate, this.rate,
this.weight, this.weight,
this.packageType, this.packageType,

6
lib/vo/custom.dart Normal file
View File

@@ -0,0 +1,6 @@
class Custom{
String id;
String productType;
int fee;
Custom({this.productType,this.fee});
}

View File

@@ -3,6 +3,14 @@ class Discount {
String customer; String customer;
String status; String status;
double amount; double amount;
int weight;
int discountRate;
Discount({this.code, this.customer, this.amount, this.status}); Discount(
{this.code,
this.customer,
this.amount,
this.status,
this.weight,
this.discountRate});
} }

View File

@@ -4,7 +4,13 @@ class PaymentMethod {
String account; String account;
String phone; String phone;
String mail; String mail;
String link;
PaymentMethod( PaymentMethod(
{this.name, this.accountName, this.account, this.phone, this.mail}); {this.name,
this.accountName,
this.account,
this.phone,
this.mail,
this.link});
} }

View File

@@ -1,37 +1,33 @@
import 'dart:math'; import 'dart:math';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class DimensionBox extends StatelessWidget { class Dimension {
final double length; final double length;
final double width; final double width;
final double height; final double height;
DimensionBox({ Dimension(this.length, this.width, this.height);
Key key, }
this.length,
this.width, class DimensionBox extends StatelessWidget {
this.height, final Dimension dimension;
}) : super(key: key); final Color color;
DimensionBox({Key key, this.dimension, this.color}) : super(key: key);
Widget build(BuildContext context) { Widget build(BuildContext context) {
return CustomPaint( return CustomPaint(
size: Size.infinite, size: Size.infinite,
painter: painter: DimensionBoxPainter(dimension: dimension, color: color),
DimensionBoxPainter(length: length, width: width, height: height),
); );
} }
} }
class DimensionBoxPainter extends CustomPainter { class DimensionBoxPainter extends CustomPainter {
final double avatarRadius = 10; final double avatarRadius = 10;
final double length; final Dimension dimension;
final double width; final Color color;
final double height;
DimensionBoxPainter({this.length, this.width, this.height}); DimensionBoxPainter({this.color, this.dimension});
//3
final Color color = Colors.blueAccent;
//4 //4
@override @override
@@ -52,13 +48,13 @@ class DimensionBoxPainter extends CustomPainter {
); );
// _drawCurvedShape(canvas, curvedShapeBounds, avatarBounds); // _drawCurvedShape(canvas, curvedShapeBounds, avatarBounds);
_drawCube( _drawCube(canvas, shapeBounds, dimension.length * 10, dimension.width * 10,
canvas, shapeBounds, length * 10, width * 10, height * 10, Colors.teal); dimension.height * 10, color);
} }
void _drawBackground(Canvas canvas, Rect shapeBounds, Rect avatarBounds) { void _drawBackground(Canvas canvas, Rect shapeBounds, Rect avatarBounds) {
//1 //1
final paint = Paint()..color = Colors.amberAccent; final paint = Paint()..color = color;
//2 //2
final backgroundPath = Path() final backgroundPath = Path()
@@ -125,12 +121,12 @@ class DimensionBoxPainter extends CustomPainter {
..close(); ..close();
canvas.drawPath(topFacePath, paintTop); canvas.drawPath(topFacePath, paintTop);
_drawText("length\n${length.toInt()}\"", canvas, _drawText("length\n${dimension.length.toInt()}\"", canvas,
shapeBounds.bottomCenter.dx - 100, shapeBounds.bottomCenter.dy - 40); shapeBounds.bottomCenter.dx - 100, shapeBounds.bottomCenter.dy - 40);
_drawText("width\n${width.toInt()}\"", canvas, _drawText("width\n${dimension.width.toInt()}\"", canvas,
shapeBounds.bottomCenter.dx + 100, shapeBounds.bottomCenter.dy - 40); shapeBounds.bottomCenter.dx + 100, shapeBounds.bottomCenter.dy - 40);
_drawText( _drawText(
"height\n${height.toInt()}\"", "height\n${dimension.height.toInt()}\"",
canvas, canvas,
shapeBounds.bottomCenter.dx, shapeBounds.bottomCenter.dx,
shapeBounds.bottomCenter.dy - (h > 30 ? h / 2 : h) * 1.2); shapeBounds.bottomCenter.dy - (h > 30 ? h / 2 : h) * 1.2);