171 lines
5.5 KiB
Dart
171 lines
5.5 KiB
Dart
|
|
import 'package:fcs/model/pickup_model.dart';
|
||
|
|
import 'package:fcs/pages/pickup_list_row.dart';
|
||
|
|
import 'package:provider/provider.dart';
|
||
|
|
import 'package:fcs/model/buyer_model.dart';
|
||
|
|
import 'package:fcs/pages/search_page.dart';
|
||
|
|
import 'package:fcs/vo/buyer.dart';
|
||
|
|
import 'package:fcs/vo/popup_menu.dart';
|
||
|
|
import 'package:fcs/widget/localization/app_translations.dart';
|
||
|
|
import 'package:fcs/widget/popupmenu.dart';
|
||
|
|
|
||
|
|
import 'package:flutter/material.dart';
|
||
|
|
import 'package:fcs/widget/progress.dart';
|
||
|
|
|
||
|
|
import '../theme/theme.dart';
|
||
|
|
import '../theme/theme.dart';
|
||
|
|
import '../theme/theme.dart';
|
||
|
|
import 'buyer_list_row.dart';
|
||
|
|
import 'pickup_editor.dart';
|
||
|
|
|
||
|
|
class PickUpList extends StatefulWidget {
|
||
|
|
@override
|
||
|
|
_PickUpListState createState() => _PickUpListState();
|
||
|
|
}
|
||
|
|
|
||
|
|
class _PickUpListState extends State<PickUpList> {
|
||
|
|
Buyer buyer;
|
||
|
|
bool _isLoading = false;
|
||
|
|
|
||
|
|
@override
|
||
|
|
void initState() {
|
||
|
|
super.initState();
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
void dispose() {
|
||
|
|
super.dispose();
|
||
|
|
}
|
||
|
|
|
||
|
|
@override
|
||
|
|
Widget build(BuildContext context) {
|
||
|
|
var pickupModel = Provider.of<PickUpModel>(context);
|
||
|
|
|
||
|
|
return LocalProgress(
|
||
|
|
inAsyncCall: _isLoading,
|
||
|
|
child: Scaffold(
|
||
|
|
appBar: AppBar(
|
||
|
|
backgroundColor: primaryColor,
|
||
|
|
title: Text(AppTranslations.of(context).text("pickup.title")),
|
||
|
|
actions: <Widget>[
|
||
|
|
IconButton(
|
||
|
|
icon: Icon(
|
||
|
|
Icons.search,
|
||
|
|
color: Colors.white,
|
||
|
|
),
|
||
|
|
iconSize: 30,
|
||
|
|
onPressed: () => showPlacesSearch(context),
|
||
|
|
),
|
||
|
|
PopupMenuButton<PopupMenu>(
|
||
|
|
elevation: 3.2,
|
||
|
|
onSelected: (selected) {},
|
||
|
|
icon: Container(
|
||
|
|
width: 30,
|
||
|
|
height: 30,
|
||
|
|
decoration: new BoxDecoration(
|
||
|
|
shape: BoxShape.circle,
|
||
|
|
color: Colors.white,
|
||
|
|
),
|
||
|
|
child: Stack(
|
||
|
|
fit: StackFit.expand,
|
||
|
|
children: <Widget>[
|
||
|
|
Icon(
|
||
|
|
Icons.sort,
|
||
|
|
color: primaryColor,
|
||
|
|
),
|
||
|
|
],
|
||
|
|
)),
|
||
|
|
itemBuilder: (BuildContext context) {
|
||
|
|
return userMenu.map((PopupMenu choice) {
|
||
|
|
return PopupMenuItem<PopupMenu>(
|
||
|
|
value: choice,
|
||
|
|
child: Container(
|
||
|
|
padding: EdgeInsets.only(left: 8),
|
||
|
|
child: Row(
|
||
|
|
children: <Widget>[
|
||
|
|
Text(choice.status),
|
||
|
|
SizedBox(
|
||
|
|
width: 10,
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}).toList();
|
||
|
|
}),
|
||
|
|
PopupMenuButton<PopupMenu>(
|
||
|
|
elevation: 3.2,
|
||
|
|
onSelected: (selected) {
|
||
|
|
String status;
|
||
|
|
},
|
||
|
|
icon: Container(
|
||
|
|
width: 30,
|
||
|
|
height: 30,
|
||
|
|
decoration: new BoxDecoration(
|
||
|
|
shape: BoxShape.circle,
|
||
|
|
color: Colors.white,
|
||
|
|
),
|
||
|
|
child: Stack(
|
||
|
|
fit: StackFit.expand,
|
||
|
|
children: <Widget>[
|
||
|
|
Icon(
|
||
|
|
Icons.filter_list,
|
||
|
|
color: primaryColor,
|
||
|
|
),
|
||
|
|
],
|
||
|
|
)),
|
||
|
|
itemBuilder: (BuildContext context) {
|
||
|
|
return buyerStatusMenu.map((PopupMenu choice) {
|
||
|
|
return PopupMenuItem<PopupMenu>(
|
||
|
|
value: choice,
|
||
|
|
child: Row(
|
||
|
|
children: <Widget>[
|
||
|
|
Text(choice.status),
|
||
|
|
SizedBox(
|
||
|
|
width: 10,
|
||
|
|
),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}).toList();
|
||
|
|
}),
|
||
|
|
],
|
||
|
|
),
|
||
|
|
body: Column(
|
||
|
|
children: <Widget>[
|
||
|
|
Expanded(
|
||
|
|
child: new ListView.builder(
|
||
|
|
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]);
|
||
|
|
}),
|
||
|
|
),
|
||
|
|
Align(
|
||
|
|
alignment: Alignment.bottomCenter,
|
||
|
|
child: Center(
|
||
|
|
child: Container(
|
||
|
|
width: 250,
|
||
|
|
child: FlatButton(
|
||
|
|
shape: new RoundedRectangleBorder(
|
||
|
|
borderRadius: new BorderRadius.circular(10)),
|
||
|
|
child: Text(AppTranslations.of(context).text("pickup.new")),
|
||
|
|
color: primaryColor,
|
||
|
|
textColor: Colors.white,
|
||
|
|
onPressed: () {
|
||
|
|
Navigator.push(
|
||
|
|
context,
|
||
|
|
MaterialPageRoute(
|
||
|
|
builder: (context) => new PickUpEditor()),
|
||
|
|
);
|
||
|
|
},
|
||
|
|
),
|
||
|
|
)))
|
||
|
|
],
|
||
|
|
),
|
||
|
|
),
|
||
|
|
);
|
||
|
|
}
|
||
|
|
}
|