This commit is contained in:
PhyoThandar
2020-06-25 15:34:41 +06:30
parent 0007c193b4
commit a41edffe02
4 changed files with 272 additions and 108 deletions

View File

@@ -1,7 +1,12 @@
import 'package:fcs/model/main_model.dart';
import 'package:fcs/model/shipment_model.dart';
import 'package:fcs/pages/barcode_screen_page.dart';
import 'package:fcs/pages/util.dart';
import 'package:fcs/vo/package.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/my_data_table.dart';
import 'package:fcs/widget/progress.dart';
import 'package:flutter/material.dart';
import 'package:flutter_icons/flutter_icons.dart';
@@ -141,6 +146,50 @@ class _PackageEditorState extends State<PackageEditor> {
fontWeight: FontWeight.bold),
),
children: [
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "zdf-sdfl-37sdfks",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Tracking ID',
hintText: 'Tracking ID',
filled: true,
suffixIcon: IconButton(
icon: Icon(
Ionicons.ios_barcode,
color: primaryColor,
),
onPressed: () {
Navigator.push(
context,
BottomUpPageRoute(
BarcodeScreenPage()),
);
}),
icon: Icon(Octicons.package,
color: primaryColor),
),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "FCS-0203-390-2",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'FCS_ID',
hintText: 'FCS_ID',
filled: true,
icon: Icon(Feather.user,
color: primaryColor),
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {})),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
@@ -172,38 +221,6 @@ class _PackageEditorState extends State<PackageEditor> {
),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "zdf-sdfl-37sdfks",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Tracking ID',
hintText: 'Tracking ID',
filled: true,
icon: Icon(Octicons.package,
color: primaryColor),
),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: TextFormField(
initialValue: isNew ? "" : "FCS-0203-390-2",
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'FCS_ID',
hintText: 'FCS_ID',
filled: true,
icon: Icon(Feather.user,
color: primaryColor),
suffixIcon: IconButton(
icon: Icon(Icons.search),
onPressed: () {})),
),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
@@ -266,6 +283,15 @@ class _PackageEditorState extends State<PackageEditor> {
color: primaryColor),
)),
),
Padding(
padding: const EdgeInsets.only(
left: 20.0, right: 20),
child: fcsInput(
"Remark",
MaterialCommunityIcons.note,
),
),
SizedBox(height: 5),
],
)
: Container(),
@@ -346,7 +372,8 @@ class _PackageEditorState extends State<PackageEditor> {
position: TimelinePosition.Left),
),
],
)
),
getShippingAddressList(context),
],
),
),
@@ -392,4 +419,74 @@ class _PackageEditorState extends State<PackageEditor> {
),
);
}
Widget getShippingAddressList(BuildContext context) {
var shipmentModel = Provider.of<ShipmentModel>(context);
return Container(
// padding: EdgeInsets.only(top: 5, left: 10),
child: ExpansionTile(
title: Text(
"Shipping Addresses",
style: TextStyle(
fontWeight: FontWeight.bold,
fontStyle: FontStyle.normal,
color: primaryColor),
),
children: <Widget>[
Container(
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: MyDataTable(
headingRowHeight: 40,
columnSpacing: 50,
columns: [
MyDataColumn(
label: Text(
"Full Name",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600],
),
)),
MyDataColumn(
label: Text(
"Phone Number",
style: TextStyle(
fontSize: 15,
color: Colors.grey[600],
),
)),
],
rows: getAddressRows(shipmentModel.shippingAddresses),
),
),
),
],
),
);
}
List<MyDataRow> getAddressRows(List<ShippingAddress> addresses) {
return addresses.map((s) {
return MyDataRow(
onSelectChanged: (selected) {
},
cells: [
MyDataCell(
new Text(
s.fullName,
style: textStyle,
),
),
MyDataCell(
new Text(
s.phoneNumber,
style: textStyle,
),
),
],
);
}).toList();
}
}

View File

@@ -9,12 +9,12 @@ import 'package:fcs/vo/buyer.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/gestures.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:flutter_icons/flutter_icons.dart';
import 'package:provider/provider.dart';
import '../theme/theme.dart';
import 'pickup_editor.dart';
class PackageList extends StatefulWidget {
@override
@@ -40,7 +40,7 @@ class _PackageListState extends State<PackageList> {
return LocalProgress(
inAsyncCall: _isLoading,
child: DefaultTabController(
length: 2,
length: 5,
child: Scaffold(
appBar: AppBar(
centerTitle: true,
@@ -51,19 +51,19 @@ class _PackageListState extends State<PackageList> {
backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("package.title")),
actions: <Widget>[
IconButton(
icon: Icon(
FontAwesomeIcons.barcode,
color: Colors.white,
),
iconSize: 30,
onPressed: () {
Navigator.push(
context,
BottomUpPageRoute(BarcodeScreenPage()),
);
},
),
// IconButton(
// icon: Icon(
// Ionicons.ios_barcode,
// color: Colors.white,
// ),
// iconSize: 30,
// onPressed: () {
// Navigator.push(
// context,
// BottomUpPageRoute(BarcodeScreenPage()),
// );
// },
// ),
IconButton(
icon: Icon(
Icons.search,
@@ -74,12 +74,20 @@ class _PackageListState extends State<PackageList> {
),
],
bottom: TabBar(
dragStartBehavior: DragStartBehavior.start,
unselectedLabelColor: Colors.grey,
tabs: [
Tab(
text: "Received",
),
Tab(text: "Processed"),
Tab(
text: "Shipped",
),
Tab(text: "Arrived"),
Tab(
text: "Delivered",
),
],
),
),
@@ -95,6 +103,9 @@ class _PackageListState extends State<PackageList> {
children: [
_upComing(),
_completed(),
_shipped(),
_arrived(),
_delivered(),
],
)),
),
@@ -155,4 +166,76 @@ class _PackageListState extends State<PackageList> {
],
);
}
Widget _shipped() {
var packageModel = Provider.of<PackageModel>(context);
return Column(
children: <Widget>[
Expanded(
child: new ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Colors.black,
),
scrollDirection: Axis.vertical,
padding: EdgeInsets.only(top: 15),
shrinkWrap: true,
itemCount: packageModel.shipped.length,
itemBuilder: (BuildContext context, int index) {
return PackageListRow(
package: packageModel.shipped[index],
isReadOnly: false,
);
}),
),
],
);
}
Widget _arrived() {
var packageModel = Provider.of<PackageModel>(context);
return Column(
children: <Widget>[
Expanded(
child: new ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Colors.black,
),
scrollDirection: Axis.vertical,
padding: EdgeInsets.only(top: 15),
shrinkWrap: true,
itemCount: packageModel.arrived.length,
itemBuilder: (BuildContext context, int index) {
return PackageListRow(
package: packageModel.arrived[index],
isReadOnly: false,
);
}),
),
],
);
}
Widget _delivered() {
var packageModel = Provider.of<PackageModel>(context);
return Column(
children: <Widget>[
Expanded(
child: new ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Colors.black,
),
scrollDirection: Axis.vertical,
padding: EdgeInsets.only(top: 15),
shrinkWrap: true,
itemCount: packageModel.delivered.length,
itemBuilder: (BuildContext context, int index) {
return PackageListRow(
package: packageModel.delivered[index],
isReadOnly: false,
);
}),
),
],
);
}
}