update box

This commit is contained in:
Thinzar Win
2020-10-09 17:28:42 +06:30
parent 776ebf52ee
commit c3a44b1909
6 changed files with 693 additions and 451 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@ import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/box/model/box_model.dart';
import 'package:fcs/pages/widgets/bottom_up_page_route.dart';
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
@@ -41,7 +42,8 @@ class _BoxListState extends State<BoxList> {
onPressed: () => Navigator.of(context).pop(),
),
backgroundColor: primaryColor,
title: Text(AppTranslations.of(context).text("boxes.title")),
title: LocalText(context, "boxes.name",
color: Colors.white, fontSize: 20),
actions: <Widget>[
IconButton(
icon: Icon(

View File

@@ -0,0 +1,90 @@
import 'package:fcs/domain/entities/cargo.dart';
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/localization/app_translations.dart';
import 'package:fcs/pages/main/util.dart';
import 'package:fcs/pages/widgets/input_text.dart';
import 'package:fcs/pages/widgets/local_text.dart';
import 'package:fcs/pages/widgets/progress.dart';
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
class CargoTypeEditor extends StatefulWidget {
final Cargo cargo;
CargoTypeEditor({this.cargo});
@override
_CargoTypeEditorState createState() => _CargoTypeEditorState();
}
class _CargoTypeEditorState extends State<CargoTypeEditor> {
TextEditingController _typeController = new TextEditingController();
TextEditingController _weightController = new TextEditingController();
bool _isLoading = false;
Cargo _cargo;
@override
void initState() {
super.initState();
if (widget.cargo != null) {
_cargo = widget.cargo;
_typeController.text = _cargo.type;
_weightController.text = _cargo.weight.toString();
}
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
final typeBox = InputText(
labelTextKey: 'cargo.type',
iconData: Icons.text_format,
controller: _typeController);
final rateBox = InputText(
labelTextKey: 'cargo.weight',
iconData: FontAwesomeIcons.weightHanging,
textInputType: TextInputType.number,
controller: _weightController);
final saveBtn = fcsButton(
context,
getLocalString(context, 'box.cargo.save.btn'),
callack: () {},
);
return LocalProgress(
inAsyncCall: _isLoading,
child: Scaffold(
appBar: AppBar(
centerTitle: true,
leading: new IconButton(
icon: new Icon(Icons.close, color: primaryColor, size: 30),
onPressed: () => Navigator.of(context).pop(),
),
shadowColor: Colors.transparent,
backgroundColor: Colors.white,
title: LocalText(
context,
"cargo.form.title",
fontSize: 20,
color: primaryColor,
)),
body: Container(
padding: EdgeInsets.all(18),
child: ListView(
children: <Widget>[
typeBox,
rateBox,
SizedBox(height: 40),
saveBtn,
SizedBox(height: 20),
],
),
),
),
);
}
}