2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/helpers/theme.dart';
|
|
|
|
|
import 'package:fcs/localization/app_translations.dart';
|
2020-10-07 14:42:07 +06:30
|
|
|
import 'package:fcs/pages/shipment/model/shipment_model.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
2020-10-07 19:53:47 +06:30
|
|
|
import 'package:fcs/pages/widgets/local_text.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/pages/widgets/progress.dart';
|
2020-10-12 03:34:05 +06:30
|
|
|
import 'package:flutter/cupertino.dart';
|
2020-05-29 15:54:26 +06:30
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
2020-10-07 14:42:07 +06:30
|
|
|
import 'shipment_editor.dart';
|
|
|
|
|
import 'shipment_list_row.dart';
|
2020-05-29 15:54:26 +06:30
|
|
|
|
2020-10-07 14:42:07 +06:30
|
|
|
class ShipmentList extends StatefulWidget {
|
2020-05-29 15:54:26 +06:30
|
|
|
@override
|
2020-10-07 14:42:07 +06:30
|
|
|
_ShipmentListState createState() => _ShipmentListState();
|
2020-05-29 15:54:26 +06:30
|
|
|
}
|
|
|
|
|
|
2020-10-07 14:42:07 +06:30
|
|
|
class _ShipmentListState extends State<ShipmentList> {
|
2020-05-29 15:54:26 +06:30
|
|
|
bool _isLoading = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2020-10-07 14:42:07 +06:30
|
|
|
var pickupModel = Provider.of<ShipmentModel>(context);
|
2020-05-29 15:54:26 +06:30
|
|
|
return LocalProgress(
|
|
|
|
|
inAsyncCall: _isLoading,
|
2020-05-31 15:00:11 +06:30
|
|
|
child: DefaultTabController(
|
|
|
|
|
length: 3,
|
|
|
|
|
child: Scaffold(
|
2020-06-26 16:17:40 +06:30
|
|
|
appBar: AppBar(
|
|
|
|
|
centerTitle: true,
|
|
|
|
|
leading: new IconButton(
|
2020-10-12 03:34:05 +06:30
|
|
|
icon: new Icon(CupertinoIcons.back),
|
2020-06-26 16:17:40 +06:30
|
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
|
|
|
),
|
|
|
|
|
backgroundColor: primaryColor,
|
2020-10-08 11:43:53 +06:30
|
|
|
title: LocalText(context, "shipment",
|
2020-10-07 19:53:47 +06:30
|
|
|
fontSize: 18, color: Colors.white),
|
2020-06-26 16:17:40 +06:30
|
|
|
actions: <Widget>[
|
|
|
|
|
IconButton(
|
|
|
|
|
icon: Icon(
|
|
|
|
|
Icons.search,
|
|
|
|
|
color: Colors.white,
|
2020-05-31 15:00:11 +06:30
|
|
|
),
|
2020-06-26 16:17:40 +06:30
|
|
|
iconSize: 30,
|
2020-10-07 02:33:06 +06:30
|
|
|
// onPressed: () => showPlacesSearch(context),
|
2020-05-29 15:54:26 +06:30
|
|
|
),
|
2020-06-26 16:17:40 +06:30
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
floatingActionButton: FloatingActionButton.extended(
|
|
|
|
|
onPressed: () {
|
|
|
|
|
_newPickup();
|
|
|
|
|
},
|
|
|
|
|
icon: Icon(Icons.add),
|
2020-10-12 03:34:05 +06:30
|
|
|
label: LocalText(context, "shipment.new", color: Colors.white),
|
2020-06-26 16:17:40 +06:30
|
|
|
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) {
|
2020-10-07 14:42:07 +06:30
|
|
|
return ShipmentListRow(pickUp: pickupModel.pickups[index]);
|
2020-06-26 16:17:40 +06:30
|
|
|
}),
|
|
|
|
|
),
|
2020-05-31 15:00:11 +06:30
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_newPickup() {
|
2020-10-14 13:54:42 +06:30
|
|
|
Navigator.of(context)
|
|
|
|
|
.push(CupertinoPageRoute(builder: (context) => ShipmentEditor()));
|
2020-05-31 15:00:11 +06:30
|
|
|
}
|
2020-05-29 15:54:26 +06:30
|
|
|
}
|