122 lines
4.1 KiB
Dart
122 lines
4.1 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:fcs/model/main_model.dart';
|
|
import 'package:fcs/model/reg_model.dart';
|
|
import 'package:fcs/widget/label_widgets.dart';
|
|
import 'package:fcs/widget/progress.dart';
|
|
|
|
import '../fcs/common/theme.dart';
|
|
import '../util.dart';
|
|
import '../widget/localization/app_translations.dart';
|
|
import 'my_registeration.dart';
|
|
|
|
enum BuyerType { shop, agent }
|
|
|
|
class MyRegisterationInfo extends StatefulWidget {
|
|
@override
|
|
_MyRegisterationInfoState createState() => _MyRegisterationInfoState();
|
|
}
|
|
|
|
class _MyRegisterationInfoState extends State<MyRegisterationInfo> {
|
|
bool inProgress = true;
|
|
|
|
BuyerType buyerType = BuyerType.shop;
|
|
TextEditingController _bizName = new TextEditingController();
|
|
TextEditingController _bizAddress = new TextEditingController();
|
|
TextEditingController _status = new TextEditingController();
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
RegModel regModel = Provider.of<RegModel>(context);
|
|
MainModel mainModel = Provider.of<MainModel>(context);
|
|
buyerType =
|
|
regModel.reg.bizType == "shop" ? BuyerType.shop : BuyerType.agent;
|
|
_bizName.text = regModel.reg.bizName;
|
|
_bizAddress.text = regModel.reg.bizAddress;
|
|
_status.text = regModel.reg.status;
|
|
bool isRegBuyer = mainModel.isRegBuyer();
|
|
if (regModel.isLoaded) {
|
|
setState(() {
|
|
this.inProgress = false;
|
|
});
|
|
}
|
|
|
|
final bizNameBox =
|
|
labeledText(context, regModel.reg.bizName, "reg.biz_name");
|
|
final bizAddressBox =
|
|
labeledText(context, regModel.reg.bizAddress, "reg.biz_address");
|
|
final typeBox =
|
|
labeledText(context, regModel.reg.bizType, "buyer.type_biz");
|
|
final statusBox = labeledText(context, regModel.reg.status, "reg.status");
|
|
final dailyQuotaBox = labeledText(
|
|
context, formatNumber(regModel.reg.dailyQuota), "reg.quota",
|
|
number: true);
|
|
final dailyQuotaUsedBox = labeledText(
|
|
context, formatNumber(regModel.reg.dailyQuotaUsed), "reg.quota.used",
|
|
number: true);
|
|
final maxQuotaBox = labeledText(
|
|
context, formatNumber(regModel.reg.maxQuota), "reg.max_quota",
|
|
number: true);
|
|
final maxQuotaUsedBox = labeledText(
|
|
context, formatNumber(regModel.reg.maxQuotaUsed), "reg.max_quota.used",
|
|
number: true);
|
|
final nricFrontBox =
|
|
labeledImg(context, regModel.reg.nricFrontUrl, "reg_info.nric_front");
|
|
final nricBackBox =
|
|
labeledImg(context, regModel.reg.nricBackUrl, "reg_info.nric_back");
|
|
|
|
return LocalProgress(
|
|
inAsyncCall: inProgress,
|
|
child: Scaffold(
|
|
appBar: AppBar(
|
|
backgroundColor: primaryColor,
|
|
title: Text(AppTranslations.of(context).text("reg_info.title")),
|
|
actions: <Widget>[
|
|
!isRegBuyer
|
|
? Container()
|
|
: regModel.reg.isApproved()
|
|
? Container()
|
|
: IconButton(
|
|
icon: Icon(Icons.edit),
|
|
onPressed: () {
|
|
Navigator.of(context).push(MaterialPageRoute(
|
|
builder: (_) => MyRegisteration(
|
|
buyer: regModel.reg,
|
|
)));
|
|
},
|
|
),
|
|
],
|
|
),
|
|
body: Container(
|
|
padding: EdgeInsets.only(left: 10, right: 10, top: 10, bottom: 10),
|
|
child: ListView(
|
|
children: <Widget>[
|
|
bizNameBox,
|
|
Divider(),
|
|
bizAddressBox,
|
|
Divider(),
|
|
typeBox,
|
|
Divider(),
|
|
statusBox,
|
|
Divider(),
|
|
dailyQuotaBox,
|
|
Divider(),
|
|
dailyQuotaUsedBox,
|
|
Divider(),
|
|
maxQuotaBox,
|
|
Divider(),
|
|
maxQuotaUsedBox,
|
|
Divider(),
|
|
nricFrontBox,
|
|
Divider(),
|
|
nricBackBox,
|
|
Divider()
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|