Files
fcs/lib/pages/fcs_shipment/fcs_shipment_list.dart

83 lines
2.7 KiB
Dart
Raw Normal View History

2020-10-07 02:33:06 +06:30
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/fcs_shipment/model/fcs_shipment_model.dart';
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/progress.dart';
2020-10-08 03:32:52 +06:30
import 'package:flutter/cupertino.dart';
2020-06-01 14:24:45 +06:30
import 'package:provider/provider.dart';
import 'package:flutter/material.dart';
2020-10-07 02:33:06 +06:30
import 'fcs_shipment_editor.dart';
import 'fcs_shipment_list_row.dart';
2020-06-01 14:24:45 +06:30
2020-10-07 02:33:06 +06:30
class FcsShipmentList extends StatefulWidget {
2020-06-01 14:24:45 +06:30
@override
2020-10-07 02:33:06 +06:30
_FcsShipmentListState createState() => _FcsShipmentListState();
2020-06-01 14:24:45 +06:30
}
2020-10-07 02:33:06 +06:30
class _FcsShipmentListState extends State<FcsShipmentList> {
2020-06-01 14:24:45 +06:30
bool _isLoading = false;
@override
void initState() {
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
2020-10-07 18:19:12 +06:30
var shipmentModel = Provider.of<FcsShipmentModel>(context);
2020-06-01 14:24:45 +06:30
return LocalProgress(
2020-10-07 18:19:12 +06:30
inAsyncCall: _isLoading,
2020-06-01 14:24:45 +06:30
child: Scaffold(
appBar: AppBar(
centerTitle: true,
leading: new IconButton(
2020-10-08 03:32:52 +06:30
icon: new Icon(CupertinoIcons.back),
2020-06-01 14:24:45 +06:30
onPressed: () => Navigator.of(context).pop(),
),
backgroundColor: primaryColor,
2020-10-07 18:19:12 +06:30
title: LocalText(context, 'FCSshipment.list.title',
2020-06-01 14:24:45 +06:30
color: Colors.white, fontSize: 20),
),
floatingActionButton: FloatingActionButton.extended(
onPressed: () {
_newShipment();
},
icon: Icon(Icons.add),
2020-10-07 18:19:12 +06:30
label: LocalText(context, "FCSshipment.add", color: Colors.white),
2020-06-01 14:24:45 +06:30
backgroundColor: primaryColor,
),
2020-10-07 18:19:12 +06:30
body: 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,
2020-10-08 03:32:52 +06:30
itemCount: shipmentModel.fcsShipments.length,
2020-10-07 18:19:12 +06:30
itemBuilder: (BuildContext context, int index) {
return FcsShipmentListRow(
2020-10-08 03:32:52 +06:30
key: ValueKey(shipmentModel.fcsShipments[index].id),
shipment: shipmentModel.fcsShipments[index]);
2020-10-07 18:19:12 +06:30
}),
),
],
)));
2020-06-01 14:24:45 +06:30
}
_newShipment() {
2020-10-07 02:33:06 +06:30
Navigator.of(context).push(BottomUpPageRoute(FcsShipmentEditor()));
2020-06-01 14:24:45 +06:30
}
}