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/shipment/model/pickup_model.dart';
|
|
|
|
|
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
|
|
|
|
|
import 'package:fcs/pages/widgets/progress.dart';
|
2020-05-29 15:54:26 +06:30
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
|
|
import 'pickup_editor.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'pickup_list_row.dart';
|
2020-05-29 15:54:26 +06:30
|
|
|
|
|
|
|
|
class PickUpList extends StatefulWidget {
|
|
|
|
|
@override
|
|
|
|
|
_PickUpListState createState() => _PickUpListState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _PickUpListState extends State<PickUpList> {
|
|
|
|
|
bool _isLoading = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2020-06-26 16:17:40 +06:30
|
|
|
var pickupModel = Provider.of<PickUpModel>(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(
|
|
|
|
|
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,
|
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
|
|
|
],
|
|
|
|
|
// 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()
|
|
|
|
|
// ],
|
|
|
|
|
// )
|
|
|
|
|
),
|
2020-05-31 15:00:11 +06:30
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_newPickup() {
|
2020-06-02 15:30:11 +06:30
|
|
|
Navigator.of(context).push(BottomUpPageRoute(PickUpEditor()));
|
2020-05-31 15:00:11 +06:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _upComing() {
|
|
|
|
|
var pickupModel = Provider.of<PickUpModel>(context);
|
|
|
|
|
return Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: new ListView.separated(
|
|
|
|
|
separatorBuilder: (context, index) => Divider(
|
|
|
|
|
color: Colors.black,
|
2020-05-29 15:54:26 +06:30
|
|
|
),
|
2020-05-31 15:00:11 +06:30
|
|
|
scrollDirection: Axis.vertical,
|
|
|
|
|
padding: EdgeInsets.only(top: 15),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
itemCount: pickupModel.upcoming.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return PickupListRow(pickUp: pickupModel.upcoming[index]);
|
|
|
|
|
}),
|
2020-05-29 15:54:26 +06:30
|
|
|
),
|
2020-05-31 15:00:11 +06:30
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _completed() {
|
|
|
|
|
var pickupModel = Provider.of<PickUpModel>(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: pickupModel.completed.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return PickupListRow(pickUp: pickupModel.completed[index]);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget _canceled() {
|
|
|
|
|
var pickupModel = Provider.of<PickUpModel>(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: pickupModel.canceled.length,
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
return PickupListRow(pickUp: pickupModel.canceled[index]);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
],
|
2020-05-29 15:54:26 +06:30
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|