add fcs shipment info

This commit is contained in:
Thinzar Win
2020-10-15 17:33:43 +06:30
parent caf600e4eb
commit 2a422fc4ea
16 changed files with 406 additions and 295 deletions

View File

@@ -1,6 +1,9 @@
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/box/model/box_model.dart';
import 'package:fcs/pages/widgets/local_popup_menu_button.dart';
import 'package:fcs/pages/widgets/local_popupmenu.dart';
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@@ -15,6 +18,7 @@ class DeliverList extends StatefulWidget {
class _DeliverListState extends State<DeliverList> {
bool _isLoading = false;
bool _showDelivered = false;
@override
void initState() {
@@ -28,102 +32,55 @@ class _DeliverListState extends State<DeliverList> {
@override
Widget build(BuildContext context) {
var boxModel = Provider.of<BoxModel>(context);
final popupMenu = LocalPopupMenuButton(
popmenus: [
LocalPopupMenu(id: 1, textKey: "delivery.popupmenu.active", selected: true),
LocalPopupMenu(id: 2, textKey: "delivery.popupmenu.delivered")
],
popupMenuCallback: (p) => this.setState(() {
_showDelivered = p.id == 2;
}),
);
return LocalProgress(
inAsyncCall: _isLoading,
child: DefaultTabController(
length: 2,
child: Scaffold(
appBar: AppBar(
centerTitle: true,
leading: new IconButton(
icon: new Icon(CupertinoIcons.back),
onPressed: () => Navigator.of(context).pop(),
),
backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("delivery")),
actions: <Widget>[
IconButton(
icon: Icon(
Icons.search,
color: Colors.white,
),
iconSize: 30,
// onPressed: () => showPlacesSearch(context),
),
],
bottom: TabBar(
unselectedLabelColor: Colors.grey,
tabs: [
Tab(
text: "Upcoming",
),
Tab(text: "Delivered"),
],
),
appBar: AppBar(
centerTitle: true,
leading: new IconButton(
icon: new Icon(CupertinoIcons.back),
onPressed: () => Navigator.of(context).pop(),
),
// floatingActionButton: FloatingActionButton.extended(
// onPressed: () {
// _newPickup();
// },
// icon: Icon(Icons.add),
// label: Text(AppTranslations.of(context).text("boxes.new")),
// backgroundColor: primaryColor,
// ),
body: TabBarView(
children: [
_upComing(),
_completed(),
],
)),
backgroundColor: primaryColor,
title: LocalText(context, "delivery",
color: Colors.white, fontSize: 20),
actions: <Widget>[
IconButton(
icon: Icon(
Icons.search,
color: Colors.white,
),
iconSize: 30,
// onPressed: () => showPlacesSearch(context),
),
popupMenu
],
),
body: new ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Colors.black,
),
scrollDirection: Axis.vertical,
padding: EdgeInsets.only(top: 15),
shrinkWrap: true,
itemCount: boxModel.boxes.length,
itemBuilder: (BuildContext context, int index) {
return DeliveryListRow(box: boxModel.boxes[index]);
}),
),
),
);
}
Widget _upComing() {
var boxModel = Provider.of<BoxModel>(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: boxModel.upcoming.length,
itemBuilder: (BuildContext context, int index) {
return DeliveryListRow(
box: boxModel.upcoming[index],
isReadOnly: false,
);
}),
),
],
);
}
Widget _completed() {
var boxModel = Provider.of<BoxModel>(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: boxModel.completed.length,
itemBuilder: (BuildContext context, int index) {
return DeliveryListRow(
box: boxModel.completed[index],
isReadOnly: false,
);
}),
),
],
);
}
}