147 lines
4.2 KiB
Dart
147 lines
4.2 KiB
Dart
import 'package:fcs/model/pickup_model.dart';
|
|
import 'package:fcs/model_fcs/box_model.dart';
|
|
import 'package:fcs/model_fcs/package_model.dart';
|
|
import 'package:fcs/pages/pickup_list_row.dart';
|
|
import 'package:fcs/pages/search_page.dart';
|
|
import 'package:fcs/pages_fcs/box_editor.dart';
|
|
import 'package:fcs/pages_fcs/box_list_row.dart';
|
|
import 'package:fcs/pages_fcs/package_editor.dart';
|
|
import 'package:fcs/pages_fcs/package_list_row.dart';
|
|
import 'package:fcs/vo/buyer.dart';
|
|
import 'package:fcs/widget/bottom_up_page_route.dart';
|
|
import 'package:fcs/widget/localization/app_translations.dart';
|
|
import 'package:fcs/widget/progress.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
|
|
import '../fcs/common/helpers/theme.dart';
|
|
import 'pickup_editor.dart';
|
|
|
|
class BoxList extends StatefulWidget {
|
|
@override
|
|
_BoxListState createState() => _BoxListState();
|
|
}
|
|
|
|
class _BoxListState extends State<BoxList> {
|
|
Buyer buyer;
|
|
bool _isLoading = false;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
}
|
|
|
|
@override
|
|
void dispose() {
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return LocalProgress(
|
|
inAsyncCall: _isLoading,
|
|
child: DefaultTabController(
|
|
length: 2,
|
|
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("boxes.title")),
|
|
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"),
|
|
],
|
|
),
|
|
),
|
|
floatingActionButton: FloatingActionButton.extended(
|
|
onPressed: () {
|
|
_newPickup();
|
|
},
|
|
icon: Icon(Icons.add),
|
|
label: Text(AppTranslations.of(context).text("boxes.new")),
|
|
backgroundColor: primaryColor,
|
|
),
|
|
body: TabBarView(
|
|
children: [
|
|
_upComing(),
|
|
_completed(),
|
|
],
|
|
)),
|
|
),
|
|
);
|
|
}
|
|
|
|
_newPickup() {
|
|
Navigator.push(
|
|
context,
|
|
BottomUpPageRoute(BoxEditor()),
|
|
);
|
|
}
|
|
|
|
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 BoxListRow(
|
|
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 BoxListRow(
|
|
box: boxModel.completed[index],
|
|
isReadOnly: false,
|
|
);
|
|
}),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|