2020-09-04 15:30:10 +06:30
|
|
|
import 'package:fcs/fcs/common/pages/util.dart';
|
2020-06-29 16:15:25 +06:30
|
|
|
import 'package:fcs/vo/custom.dart';
|
|
|
|
|
import 'package:fcs/widget/localization/app_translations.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:fcs/widget/progress.dart';
|
|
|
|
|
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
2020-09-04 15:30:10 +06:30
|
|
|
import '../fcs/common/helpers/theme.dart';
|
2020-06-29 16:15:25 +06:30
|
|
|
|
|
|
|
|
class CustomEditor extends StatefulWidget {
|
|
|
|
|
final Custom custom;
|
|
|
|
|
CustomEditor({this.custom});
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
_CustomEditorState createState() => _CustomEditorState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class _CustomEditorState extends State<CustomEditor> {
|
|
|
|
|
TextEditingController _productController = new TextEditingController();
|
|
|
|
|
TextEditingController _feeController = new TextEditingController();
|
|
|
|
|
|
|
|
|
|
bool _isLoading = false;
|
|
|
|
|
Custom _custom = new Custom();
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
if (widget.custom != null) {
|
|
|
|
|
_custom = widget.custom;
|
|
|
|
|
_productController.text = _custom.productType;
|
|
|
|
|
_feeController.text = _custom.fee.toString();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
void dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext 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("custom.form.title")),
|
|
|
|
|
),
|
|
|
|
|
body: Container(
|
|
|
|
|
padding: EdgeInsets.all(18),
|
|
|
|
|
child: Column(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
Expanded(
|
|
|
|
|
child: ListView(
|
|
|
|
|
children: <Widget>[
|
|
|
|
|
fcsInput("Procut Type", FontAwesomeIcons.weightHanging,
|
|
|
|
|
controller: _productController),
|
|
|
|
|
fcsInput("Fee", Icons.attach_money,
|
|
|
|
|
controller: _feeController),
|
|
|
|
|
SizedBox(height: 30),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
widget.custom == null
|
|
|
|
|
? fcsButton(context, "Create", callack: () {})
|
|
|
|
|
: fcsButton(context, "Save", callack: () {}),
|
|
|
|
|
SizedBox(height: 10)
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|