2020-10-18 02:38:46 +06:30
|
|
|
import 'package:fcs/domain/entities/carton.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/helpers/theme.dart';
|
|
|
|
|
import 'package:fcs/localization/app_translations.dart';
|
2020-10-18 02:38:46 +06:30
|
|
|
import 'package:fcs/pages/carton/model/carton_model.dart';
|
2020-10-07 02:33:06 +06:30
|
|
|
import 'package:fcs/pages/widgets/progress.dart';
|
2020-10-14 13:54:42 +06:30
|
|
|
import 'package:flutter/cupertino.dart';
|
2020-06-26 16:04:40 +06:30
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
|
|
|
|
|
|
class BoxAddition extends StatefulWidget {
|
2021-09-10 12:00:08 +06:30
|
|
|
final Carton? box;
|
2020-06-26 16:04:40 +06:30
|
|
|
BoxAddition({this.box});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_BoxAdditionState createState() => _BoxAdditionState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _BoxAdditionState extends State<BoxAddition> {
|
2020-10-18 02:38:46 +06:30
|
|
|
Carton _box = new Carton();
|
2020-06-26 16:04:40 +06:30
|
|
|
bool _isLoading = false;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
if (widget.box != null) {
|
2021-09-10 12:00:08 +06:30
|
|
|
_box = widget.box!;
|
2020-06-26 16:04:40 +06:30
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
2020-10-18 02:38:46 +06:30
|
|
|
var boxModel = Provider.of<CartonModel>(context);
|
2020-06-26 16:04:40 +06:30
|
|
|
return LocalProgress(
|
|
|
|
|
inAsyncCall: _isLoading,
|
|
|
|
|
child: Scaffold(
|
|
|
|
|
appBar: AppBar(
|
|
|
|
|
centerTitle: true,
|
|
|
|
|
leading: new IconButton(
|
2020-10-14 13:54:42 +06:30
|
|
|
icon: new Icon(CupertinoIcons.back),
|
2020-06-26 16:04:40 +06:30
|
|
|
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>[
|
2021-09-10 12:00:08 +06:30
|
|
|
DropdownButtonFormField<Object>(
|
2020-06-26 16:04:40 +06:30
|
|
|
decoration: InputDecoration(
|
|
|
|
|
fillColor: Colors.white,
|
|
|
|
|
labelText: 'Box Number',
|
|
|
|
|
icon: Icon(Icons.pages)),
|
2021-01-12 16:59:52 +06:30
|
|
|
items: [],
|
|
|
|
|
// boxModel.processed
|
|
|
|
|
// .map((e) => DropdownMenuItem(
|
|
|
|
|
// child: Text(
|
|
|
|
|
// '${e.shipmentNumber}-${e.receiverNumber} #${e.boxNumber}'),
|
|
|
|
|
// value: e))
|
|
|
|
|
// .toList(),
|
2020-06-26 16:04:40 +06:30
|
|
|
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,
|
|
|
|
|
)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|