2020-06-26 16:04:40 +06:30
|
|
|
import 'package:fcs/model_fcs/box_model.dart';
|
|
|
|
|
import 'package:fcs/model_fcs/package_model.dart';
|
2020-08-30 21:26:37 +06:30
|
|
|
import 'package:fcs/fcs/common/theme.dart';
|
2020-06-26 16:04:40 +06:30
|
|
|
import 'package:fcs/vo/box.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';
|
|
|
|
|
|
|
|
|
|
class BoxAddition extends StatefulWidget {
|
|
|
|
|
final Box box;
|
|
|
|
|
BoxAddition({this.box});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_BoxAdditionState createState() => _BoxAdditionState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _BoxAdditionState extends State<BoxAddition> {
|
|
|
|
|
Box _box = new Box();
|
|
|
|
|
bool _isLoading = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
if (widget.box != null) {
|
|
|
|
|
_box = widget.box;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
var boxModel = Provider.of<BoxModel>(context);
|
|
|
|
|
return LocalProgress(
|
|
|
|
|
inAsyncCall: _isLoading,
|
|
|
|
|
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("box.edit.title")),
|
|
|
|
|
),
|
|
|
|
|
body: Card(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: Padding(
|
|
|
|
|
padding: const EdgeInsets.all(10.0),
|
|
|
|
|
child: ListView(children: <Widget>[
|
|
|
|
|
DropdownButtonFormField(
|
|
|
|
|
decoration: InputDecoration(
|
|
|
|
|
fillColor: Colors.white,
|
|
|
|
|
labelText: 'Box Number',
|
|
|
|
|
icon: Icon(Icons.pages)),
|
|
|
|
|
items: boxModel.processed
|
|
|
|
|
.map((e) => DropdownMenuItem(
|
2020-08-30 21:26:37 +06:30
|
|
|
child: Text(
|
|
|
|
|
'${e.shipmentNumber}-${e.receiverNumber} #${e.boxNumber}'),
|
|
|
|
|
value: e))
|
2020-06-26 16:04:40 +06:30
|
|
|
.toList(),
|
|
|
|
|
onChanged: (map) => {},
|
|
|
|
|
),
|
|
|
|
|
]),
|
|
|
|
|
)),
|
|
|
|
|
widget.box == null
|
|
|
|
|
? Align(
|
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 250,
|
|
|
|
|
child: FlatButton(
|
|
|
|
|
child: Text('Add box'),
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
)))
|
|
|
|
|
: Align(
|
|
|
|
|
alignment: Alignment.bottomCenter,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: 250,
|
|
|
|
|
child: FlatButton(
|
|
|
|
|
child: Text('Save box'),
|
|
|
|
|
color: primaryColor,
|
|
|
|
|
textColor: Colors.white,
|
|
|
|
|
onPressed: () {
|
|
|
|
|
Navigator.pop(context);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
))),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 30,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|