update pickup and box list

This commit is contained in:
Thinzar Win
2020-06-26 16:17:40 +06:30
parent 59cb172713
commit ace9254093
20 changed files with 1266 additions and 213 deletions

View File

@@ -18,12 +18,20 @@ class BuyingOnlinePage extends StatefulWidget {
_BuyingOnlinePagetate createState() => _BuyingOnlinePagetate();
}
class _BuyingOnlinePagetate extends State<BuyingOnlinePage> {
class _BuyingOnlinePagetate extends State<BuyingOnlinePage>
with SingleTickerProviderStateMixin {
bool _isLoading = false;
List<String> images = [
'assets/Fullname.jpeg',
'assets/FirstName&LastName.jpeg'
];
TabController _tabController;
@override
void initState() {
_tabController = TabController(vsync: this, length: 2);
super.initState();
}
@override
Widget build(BuildContext context) {
@@ -146,21 +154,58 @@ class _BuyingOnlinePagetate extends State<BuyingOnlinePage> {
)
],
),
// deliveryAddressBox,
instructionBox,
Container(
new Container(
decoration: new BoxDecoration(color: Colors.white),
child: new TabBar(
// indicatorColor: primaryColor,
labelColor: primaryColor,
labelStyle: TextStyle(fontWeight: FontWeight.bold),
unselectedLabelColor: Colors.grey,
controller: _tabController,
tabs: [
new Tab(
text: 'FULL NAME',
),
new Tab(
text: 'FIRST NAME&\nLAST NAME',
),
],
),
),
new Container(
padding: EdgeInsets.only(top:10),
height: 500,
width: 500,
child: ListView.builder(
itemCount: images.length,
scrollDirection: Axis.horizontal,
itemBuilder: (context, index) {
return Container(
padding: EdgeInsets.only(left: 0, right: 5, top: 5),
child: Image.asset(images[index], fit: BoxFit.contain),
);
}),
child: new TabBarView(
controller: _tabController,
children: <Widget>[
Container(
child:
Image.asset('assets/Fullname.png', fit: BoxFit.contain),
),
Container(
child: Image.asset('assets/FirstName&LastName.png',
fit: BoxFit.contain),
),
],
),
),
// Container(
// height: 500,
// width: 500,
// child: ListView.builder(
// itemCount: images.length,
// scrollDirection: Axis.horizontal,
// itemBuilder: (context, index) {
// return Container(
// padding: EdgeInsets.only(left: 0, right: 5, top: 5),
// child: Image.asset(images[index], fit: BoxFit.contain),
// );
// }),
// ),
SizedBox(height: 10)
],

View File

@@ -2,6 +2,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/delivery_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';
@@ -178,6 +179,10 @@ class _HomePageState extends State<HomePage> {
icon: FontAwesomeIcons.info,
btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(Term())));
final deliveryBtn = _buildBtn2("delivery.title",
icon: MaterialCommunityIcons.truck_fast,
btnCallback: () =>
Navigator.of(context).push(BottomUpPageRoute(DeliverList())));
List<Widget> widgets = [];
customer ? widgets.add(buyingBtn) : "";
@@ -188,7 +193,8 @@ class _HomePageState extends State<HomePage> {
owner ? widgets.add(fcsProfileBtn) : "";
widgets.add(shipmentCostBtn);
customer || owner ? widgets.add(packagesBtn) : "";
customer || owner ? widgets.add(boxesBtn) : "";
owner ? widgets.add(boxesBtn) : "";
owner ? widgets.add(deliveryBtn) : "";
owner ? widgets.add(customersBtn) : "";
customer || owner ? widgets.add(invoicesBtn) : "";
widgets.add(termBtn);
@@ -318,7 +324,8 @@ class _HomePageState extends State<HomePage> {
children: <Widget>[
// _buildSmallButton(
// "Policies", FontAwesomeIcons.fileContract),
_buildSmallButton("Contact Us", SimpleLineIcons.support),
_buildSmallButton(
"Contact Us", SimpleLineIcons.support),
],
)
],

View File

@@ -0,0 +1,311 @@
import 'package:fcs/model/main_model.dart';
import 'package:fcs/model/shipment_model.dart';
import 'package:fcs/model_fcs/package_model.dart';
import 'package:fcs/pages/invoice/package_addition.dart';
import 'package:fcs/pages/util.dart';
import 'package:fcs/pages_fcs/shipping_address_row.dart';
import 'package:fcs/vo/box.dart';
import 'package:fcs/vo/cargo.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/local_text.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:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:provider/provider.dart';
import '../theme/theme.dart';
import 'shipping_address_editor.dart';
class PickupBoxEditor extends StatefulWidget {
final Box box;
PickupBoxEditor({this.box});
@override
_PickupBoxEditorState createState() => _PickupBoxEditorState();
}
class _PickupBoxEditorState extends State<PickupBoxEditor> {
Box _box;
bool _isLoading = false;
bool isNew;
bool isMixBox = false;
ShippingAddress _shippingAddress = new ShippingAddress();
@override
void initState() {
super.initState();
if (widget.box != null) {
_box = widget.box;
_shippingAddress = _box.shippingAddress;
isNew = false;
} else {
List<Package> packages = [
PackageModel.packages[0],
PackageModel.packages[1],
PackageModel.packages[2]
];
List<Cargo> _cargoTypes = [
Cargo(type: 'General Cargo', weight: 25),
Cargo(type: 'Medicine', weight: 20),
Cargo(type: 'Dangerous Cargo', weight: 30)
];
var shipmentModel = Provider.of<ShipmentModel>(context, listen: false);
_shippingAddress = shipmentModel.shippingAddresses[1];
isNew = true;
_box = Box(
rate: 0,
weight: 75,
width: 0,
height: 0,
length: 0,
packages: packages,
cargoTypes: _cargoTypes,
);
}
}
@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("box.edit.title")),
),
body: Card(
child: Column(
children: <Widget>[
Expanded(
child: ListView(
children: [
ExpansionTile(
title: Text(
'Cargo Types',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: [
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: _box.weight.toString(),
textAlign: TextAlign.end,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Total Weight',
filled: true,
icon: Icon(FontAwesomeIcons.weightHanging,
color: primaryColor),
)),
),
Container(
padding: EdgeInsets.only(top: 10),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: MyDataTable(
headingRowHeight: 40,
columnSpacing: 120,
columns: [
MyDataColumn(
label: LocalText(
context,
"cargo.type",
color: Colors.grey,
),
),
MyDataColumn(
label: LocalText(
context,
"cargo.weight",
color: Colors.grey,
),
),
],
rows: getCargoRows(context),
),
),
),
Container(
padding: EdgeInsets.only(top: 20),
child: Align(
alignment: Alignment.bottomRight,
child: FloatingActionButton.extended(
icon: Icon(Icons.add),
label: Text("Add Cargo"),
backgroundColor: primaryColor,
onPressed: () {
// Navigator.of(context).push(
// BottomUpPageRoute(PackageAddition()));
},
),
),
),
SizedBox(height: 25),
],
),
ExpansionTile(
title: Text(
'Box Dimension',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: [
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: _box.width.toString(),
textAlign: TextAlign.end,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Width',
filled: true,
icon: Icon(FontAwesomeIcons.arrowCircleRight,
color: primaryColor),
)),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: _box.height.toString(),
textAlign: TextAlign.end,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Height',
filled: true,
icon: Icon(FontAwesomeIcons.arrowAltCircleUp,
color: primaryColor),
)),
),
Padding(
padding: const EdgeInsets.only(left: 20.0, right: 20),
child: TextFormField(
initialValue: _box.length.toString(),
textAlign: TextAlign.end,
decoration: InputDecoration(
fillColor: Colors.white,
labelText: 'Length',
filled: true,
icon: Icon(FontAwesomeIcons.arrowCircleUp,
color: primaryColor),
)),
),
SizedBox(height: 25),
],
),
ExpansionTile(
title: Text(
'Shipping Address',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: [
ShippingAddressRow(shippingAddress: _shippingAddress),
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: () {},
icon: Icon(Icons.add),
label: Text(
'Add Shipping\nAddress',
style: TextStyle(fontSize: 12),
),
backgroundColor: primaryColor,
),
),
),
),
SizedBox(height: 25),
],
),
],
),
),
widget.box == null
? Align(
alignment: Alignment.bottomCenter,
child: Center(
child: Container(
width: 250,
child: FlatButton(
child: Text('Create New Box'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
Navigator.pop(context);
},
),
)))
: Container(
child: Column(
children: <Widget>[
Align(
alignment: Alignment.bottomCenter,
child: Center(
child: Container(
width: 250,
child: FlatButton(
child: Text('Update Box'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
Navigator.pop(context);
},
),
))),
],
))
],
),
),
),
);
}
List<MyDataRow> getCargoRows(BuildContext context) {
if (_box == null || _box.cargoTypes == null) {
return [];
}
return _box.cargoTypes.map((c) {
return MyDataRow(
onSelectChanged: (bool selected) {},
cells: [
MyDataCell(new Text(
c.type == null ? "" : c.type,
style: textStyle,
)),
MyDataCell(
new Text(c.weight == null ? "0" : c.weight.toString(),
style: textStyle),
),
],
);
}).toList();
}
}

View File

@@ -1,8 +1,14 @@
import 'package:fcs/model/main_model.dart';
import 'package:fcs/model/pickup_model.dart';
import 'package:fcs/model/shipment_model.dart';
import 'package:fcs/model_fcs/box_model.dart';
import 'package:fcs/pages/util.dart';
import 'package:fcs/pages_fcs/shipping_address_row.dart';
import 'package:fcs/vo/box.dart';
import 'package:fcs/vo/cargo.dart';
import 'package:fcs/vo/pickup.dart';
import 'package:fcs/vo/shipping_address.dart';
import 'package:fcs/widget/bottom_up_page_route.dart';
import 'package:fcs/widget/fcs_text_field.dart';
import 'package:fcs/widget/fcs_text_field_readonly.dart';
import 'package:flutter_datetime_picker/flutter_datetime_picker.dart';
@@ -16,6 +22,7 @@ import 'package:flutter/material.dart';
import 'package:fcs/widget/progress.dart';
import '../theme/theme.dart';
import 'pickup_box_editor.dart';
class PickUpEditor extends StatefulWidget {
final PickUp pickUp;
@@ -49,6 +56,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
bool _isLoading = false;
var now = new DateTime.now();
bool isNew;
ShippingAddress _shippingAddress = new ShippingAddress();
@override
void initState() {
@@ -78,6 +86,8 @@ class _PickUpEditorState extends State<PickUpEditor> {
];
_pickUp = PickUp(cargoTypes: _cargoTypes);
}
var shipmentModel = Provider.of<ShipmentModel>(context, listen: false);
_shippingAddress = shipmentModel.shippingAddresses[1];
}
@override
@@ -216,6 +226,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
));
MainModel mainModel = Provider.of<MainModel>(context);
var boxModel = Provider.of<BoxModel>(context);
return LocalProgress(
inAsyncCall: _isLoading,
@@ -253,7 +264,11 @@ class _PickUpEditorState extends State<PickUpEditor> {
),
),
ExpansionTile(
title: Text('Pickup Location / Time'),
title: Text(
'Pickup Location / Time',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 20.0),
@@ -280,7 +295,11 @@ class _PickUpEditorState extends State<PickUpEditor> {
],
),
ExpansionTile(
title: Text('Package Information'),
title: Text(
'Package Information',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 20.0),
@@ -322,60 +341,136 @@ class _PickUpEditorState extends State<PickUpEditor> {
padding: const EdgeInsets.only(left: 20.0),
child: fcsInput("Remark", MaterialCommunityIcons.note),
),
Padding(
padding: const EdgeInsets.only(left: 3.0),
child: ExpansionTile(
leading: Icon(
SimpleLineIcons.location_pin,
color: primaryColor,
),
title: Text(
'Shipping Address',
),
children: [
ShippingAddressRow(
shippingAddress: _shippingAddress),
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: () {},
icon: Icon(Icons.add),
label: Text(
'Add Shipping\nAddress',
style: TextStyle(fontSize: 12),
),
backgroundColor: primaryColor,
),
),
),
),
],
),
),
SizedBox(height: 10.0),
],
),
ExpansionTile(
title: Text(
'Box Information',
style: TextStyle(
color: primaryColor, fontWeight: FontWeight.bold),
),
children: <Widget>[
Column(
children: getBoxList(context, boxModel.boxes),
),
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(PickupBoxEditor()),
);
},
label: Text(
'Add Box',
style: TextStyle(fontSize: 12),
),
backgroundColor: primaryColor,
),
),
),
),
SizedBox(height: 10.0),
],
),
// ExpansionTile(
// title: Text('Box Information'),
// title: Text(
// 'Shipping Address',
// style: TextStyle(
// color: primaryColor, fontWeight: FontWeight.bold),
// ),
// children: <Widget>[
// SizedBox(height: 10.0),
// Padding(
// padding: const EdgeInsets.only(left: 20.0),
// child: widget.pickUp == null
// ? fcsInput("Name", FontAwesomeIcons.user,
// controller: _recipientNameEditingController)
// : widget.pickUp.status == 'Pending'
// ? fcsInput("Name", FontAwesomeIcons.user,
// controller:
// _recipientNameEditingController)
// : fcsInputReadOnly(
// "Name", FontAwesomeIcons.user,
// controller:
// _recipientNameEditingController)),
// Padding(
// padding: const EdgeInsets.only(left: 20.0),
// child: widget.pickUp == null
// ? fcsInput("Phone Number", Icons.phone,
// controller: _recipientPhoneEditingController)
// : widget.pickUp.status == 'Pending'
// ? fcsInput("Phone Number", Icons.phone,
// controller:
// _recipientPhoneEditingController)
// : fcsInputReadOnly(
// "Phone Number", Icons.phone,
// controller:
// _recipientPhoneEditingController)),
// Padding(
// padding: const EdgeInsets.only(left: 20.0),
// child: widget.pickUp == null
// ? fcsInput("Address", Icons.location_on,
// controller:
// _recipientAddressEditingController)
// : widget.pickUp.status == 'Pending'
// ? fcsInput("Address", Icons.location_on,
// controller:
// _recipientAddressEditingController)
// : fcsInputReadOnly(
// "Address", Icons.location_on,
// controller:
// _recipientAddressEditingController)),
// ],
// ),
ExpansionTile(
title: Text('Shipping Address'),
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: widget.pickUp == null
? fcsInput("Name", FontAwesomeIcons.user,
controller: _recipientNameEditingController)
: widget.pickUp.status == 'Pending'
? fcsInput("Name", FontAwesomeIcons.user,
controller:
_recipientNameEditingController)
: fcsInputReadOnly(
"Name", FontAwesomeIcons.user,
controller:
_recipientNameEditingController)),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: widget.pickUp == null
? fcsInput("Phone Number", Icons.phone,
controller: _recipientPhoneEditingController)
: widget.pickUp.status == 'Pending'
? fcsInput("Phone Number", Icons.phone,
controller:
_recipientPhoneEditingController)
: fcsInputReadOnly(
"Phone Number", Icons.phone,
controller:
_recipientPhoneEditingController)),
Padding(
padding: const EdgeInsets.only(left: 20.0),
child: widget.pickUp == null
? fcsInput("Address", Icons.location_on,
controller:
_recipientAddressEditingController)
: widget.pickUp.status == 'Pending'
? fcsInput("Address", Icons.location_on,
controller:
_recipientAddressEditingController)
: fcsInputReadOnly(
"Address", Icons.location_on,
controller:
_recipientAddressEditingController)),
],
),
mainModel.isCustomer()
? Container()
: ExpansionTile(
@@ -413,14 +508,14 @@ class _PickUpEditorState extends State<PickUpEditor> {
: Container(
child: Column(
children: <Widget>[
widget.pickUp.status == 'Assigned'
widget.pickUp.status == 'Confirmed'
? Align(
alignment: Alignment.bottomCenter,
child: Center(
child: Container(
width: 250,
child: FlatButton(
child: Text('Complete'),
child: Text('Complete Pickup'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
@@ -434,7 +529,7 @@ class _PickUpEditorState extends State<PickUpEditor> {
child: Container(
width: 250,
child: FlatButton(
child: Text('Assign'),
child: Text('Assign Pickup'),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
@@ -442,20 +537,6 @@ class _PickUpEditorState extends State<PickUpEditor> {
},
),
))),
Align(
alignment: Alignment.bottomCenter,
child: Center(
child: Container(
width: 250,
child: FlatButton(
child: Text('Complete Pickup '),
color: primaryColor,
textColor: Colors.white,
onPressed: () {
Navigator.pop(context);
},
),
))),
Align(
alignment: Alignment.bottomCenter,
child: Center(
@@ -478,4 +559,136 @@ class _PickUpEditorState extends State<PickUpEditor> {
),
);
}
List<Widget> getBoxList(BuildContext context, List<Box> boxes) {
List<Box> _boxes = [boxes[0], boxes[1]];
return _boxes.asMap().entries.map((_box) {
ShippingAddress shippingAddress = _box.value.shippingAddress;
return InkWell(
onTap: () {
Navigator.of(context)
.push(BottomUpPageRoute(PickupBoxEditor(box: _box.value)));
},
child: Container(
padding: EdgeInsets.only(left: 10),
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: new Row(
children: <Widget>[
new Expanded(
child: new Column(
crossAxisAlignment: CrossAxisAlignment.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),
),
),
],
),
),
],
),
),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
"L${_box.value.length}xW${_box.value.weight}xH${_box.value.height}",
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
_box.value.weight == null
? ''
: "Total Weight:${_box.value.weight.toString()}lb",
style:
new TextStyle(fontSize: 14.0, color: Colors.grey),
),
),
],
)
],
),
_box.key == _boxes.length - 1
? Container()
: Divider(
color: Colors.black,
)
],
),
),
);
}).toList();
}
}

View File

@@ -2,20 +2,13 @@ import 'package:fcs/model/pickup_model.dart';
import 'package:fcs/pages/pickup_list_row.dart';
import 'package:fcs/widget/bottom_up_page_route.dart';
import 'package:provider/provider.dart';
import 'package:fcs/model/buyer_model.dart';
import 'package:fcs/pages/search_page.dart';
import 'package:fcs/vo/buyer.dart';
import 'package:fcs/vo/popup_menu.dart';
import 'package:fcs/widget/localization/app_translations.dart';
import 'package:fcs/widget/popupmenu.dart';
import 'package:flutter/material.dart';
import 'package:fcs/widget/progress.dart';
import '../theme/theme.dart';
import '../theme/theme.dart';
import '../theme/theme.dart';
import 'buyer_list_row.dart';
import 'pickup_editor.dart';
class PickUpList extends StatefulWidget {
@@ -24,7 +17,6 @@ class PickUpList extends StatefulWidget {
}
class _PickUpListState extends State<PickUpList> {
Buyer buyer;
bool _isLoading = false;
@override
@@ -39,56 +31,69 @@ class _PickUpListState extends State<PickUpList> {
@override
Widget build(BuildContext context) {
var pickupModel = Provider.of<PickUpModel>(context);
return LocalProgress(
inAsyncCall: _isLoading,
child: DefaultTabController(
length: 3,
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("pickup.title")),
actions: <Widget>[
IconButton(
icon: Icon(
Icons.search,
color: Colors.white,
),
iconSize: 30,
onPressed: () => showPlacesSearch(context),
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("pickup.title")),
actions: <Widget>[
IconButton(
icon: Icon(
Icons.search,
color: Colors.white,
),
],
bottom: TabBar(
unselectedLabelColor: Colors.grey,
tabs: [
Tab(
text: "Upcoming",
),
Tab(text: "Completed"),
Tab(text: "Canceled"),
],
iconSize: 30,
onPressed: () => showPlacesSearch(context),
),
),
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
_newPickup();
},
icon: Icon(Icons.add),
label: Text(AppTranslations.of(context).text("pickup.new")),
backgroundColor: primaryColor,
),
body: TabBarView(
children: [
//Icon(Icons.directions_car),
_upComing(),
_completed(),
_canceled()
],
)),
],
// bottom: TabBar(
// unselectedLabelColor: Colors.grey,
// tabs: [
// Tab(
// text: "Upcoming",
// ),
// Tab(text: "Completed"),
// Tab(text: "Canceled"),
// ],
// ),
),
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
_newPickup();
},
icon: Icon(Icons.add),
label: Text(AppTranslations.of(context).text("pickup.new")),
backgroundColor: primaryColor,
),
body: new ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Colors.black,
),
scrollDirection: Axis.vertical,
padding: EdgeInsets.only(top: 15),
shrinkWrap: true,
itemCount: pickupModel.pickups.length,
itemBuilder: (BuildContext context, int index) {
return PickupListRow(pickUp: pickupModel.pickups[index]);
}),
// body: TabBarView(
// children: [
// //Icon(Icons.directions_car),
// _upComing(),
// _completed(),
// _canceled()
// ],
// )
),
),
);
}

View File

@@ -1,4 +1,5 @@
import 'package:fcs/model/shipment_model.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/local_text.dart';
@@ -216,7 +217,7 @@ class _ProfileState extends State<Profile> {
));
final logoutbutton = Container(
padding: EdgeInsets.only( left: 20.0, right: 24.0),
padding: EdgeInsets.only(left: 20.0, right: 24.0),
child: Padding(
padding: EdgeInsets.symmetric(vertical: 10.0),
child: Card(
@@ -330,7 +331,7 @@ class _ProfileState extends State<Profile> {
child: Align(
alignment: Alignment.bottomRight,
child: Container(
width: 120,
width: 130,
height: 40,
child: FloatingActionButton.extended(
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
@@ -340,6 +341,7 @@ class _ProfileState extends State<Profile> {
BottomUpPageRoute(ShippingAddressEditor()),
);
},
icon: Icon(Icons.add),
label: Text(
'Add Shipping\nAddress',
style: TextStyle(fontSize: 12),
@@ -357,72 +359,14 @@ class _ProfileState extends State<Profile> {
List<Widget> getAddressList(
BuildContext context, List<ShippingAddress> addresses) {
return addresses.asMap().entries.map((s) {
return Container(
padding: EdgeInsets.only(left: 10, right: 10),
child: InkWell(
onTap: () {
Navigator.push(
context,
BottomUpPageRoute(
ShippingAddressEditor(shippingAddress: s.value)),
);
},
child: Column(
children: <Widget>[
Row(
children: <Widget>[
Expanded(
child: new Padding(
padding: const EdgeInsets.symmetric(vertical: 10.0),
child: Row(
children: <Widget>[
Padding(
padding: EdgeInsets.all(5.0),
child: Icon(
SimpleLineIcons.location_pin,
color: primaryColor,
)),
new Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
s.value.fullName == null
? ''
: s.value.fullName,
style: new TextStyle(
fontSize: 15.0, color: Colors.black),
),
),
Padding(
padding: const EdgeInsets.only(left: 8.0),
child: new Text(
s.value.phoneNumber == null
? ''
: s.value.phoneNumber,
style: new TextStyle(
fontSize: 14.0, color: Colors.grey),
),
),
],
),
],
),
),
),
IconButton(
padding: EdgeInsets.only(right: 30),
icon: Icon(Icons.delete, color: Colors.black45),
onPressed: null)
],
),
s.key == addresses.length - 1
? Container()
: Divider(color: Colors.black)
],
),
),
return InkWell(
onTap: () {
Navigator.push(
context,
BottomUpPageRoute(ShippingAddressEditor(shippingAddress: s.value)),
);
},
child: ShippingAddressRow(shippingAddress: s.value, index: s.key),
);
}).toList();
}