Merge branch 'master' of https://git.mokkon.com/tzw/fcs
This commit is contained in:
@@ -17,15 +17,15 @@ class PinLoginPage extends StatefulWidget {
|
|||||||
class _PinLoginPageState extends State<PinLoginPage> {
|
class _PinLoginPageState extends State<PinLoginPage> {
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
String pin = "";
|
String pin = "";
|
||||||
|
String prefixText = "FCS-";
|
||||||
//late User _user;
|
//late User _user;
|
||||||
final _formKey = GlobalKey<FormState>();
|
final _formKey = GlobalKey<FormState>();
|
||||||
TextEditingController _fcsIdCtl = new TextEditingController();
|
TextEditingController _fcsIdCtl = new TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
//_user=widget.user;
|
|
||||||
//pin = _user.pinDigit ?? "";
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
if (mounted) {
|
if (mounted) {
|
||||||
setState(() {});
|
setState(() {});
|
||||||
}
|
}
|
||||||
@@ -33,7 +33,16 @@ class _PinLoginPageState extends State<PinLoginPage> {
|
|||||||
|
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final fcsIdBox = TextFormField(
|
final fcsIdBox = TextFormField(
|
||||||
|
|
||||||
controller: _fcsIdCtl,
|
controller: _fcsIdCtl,
|
||||||
|
focusNode: FocusNode(),
|
||||||
|
|
||||||
|
onChanged: (value) {
|
||||||
|
_fcsIdCtl.value = TextEditingValue(
|
||||||
|
text: value.toUpperCase(),
|
||||||
|
selection: _fcsIdCtl.selection,
|
||||||
|
);
|
||||||
|
},
|
||||||
autofocus: true,
|
autofocus: true,
|
||||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||||
validator: (value) {
|
validator: (value) {
|
||||||
@@ -47,10 +56,14 @@ class _PinLoginPageState extends State<PinLoginPage> {
|
|||||||
cursorColor: primaryColor,
|
cursorColor: primaryColor,
|
||||||
keyboardType: TextInputType.text,
|
keyboardType: TextInputType.text,
|
||||||
decoration: new InputDecoration(
|
decoration: new InputDecoration(
|
||||||
|
prefixText: prefixText,
|
||||||
|
prefixStyle: TextStyle(color: Colors.black),
|
||||||
contentPadding: EdgeInsets.all(0),
|
contentPadding: EdgeInsets.all(0),
|
||||||
labelStyle: newLabelStyle(color: Colors.black54, fontSize: 17),
|
labelStyle: newLabelStyle(color: Colors.black54, fontSize: 17),
|
||||||
enabledBorder: UnderlineInputBorder(
|
enabledBorder: UnderlineInputBorder(
|
||||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
|
border: UnderlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
focusedBorder: UnderlineInputBorder(
|
focusedBorder: UnderlineInputBorder(
|
||||||
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
borderSide: BorderSide(color: primaryColor, width: 1.0)),
|
||||||
disabledBorder: UnderlineInputBorder(
|
disabledBorder: UnderlineInputBorder(
|
||||||
@@ -120,10 +133,6 @@ class _PinLoginPageState extends State<PinLoginPage> {
|
|||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: new Scaffold(
|
child: new Scaffold(
|
||||||
// appBar: LocalAppBar(
|
|
||||||
// backgroundColor: primaryColor,
|
|
||||||
|
|
||||||
// ),
|
|
||||||
body: Form(
|
body: Form(
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
@@ -167,18 +176,11 @@ class _PinLoginPageState extends State<PinLoginPage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_login() async {
|
_login() async {
|
||||||
if (pin == "" && _formKey.currentState!.validate()) {
|
|
||||||
showMsgDialog(context, "Error", "Invalid PIN");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pin.length < 6 && _formKey.currentState!.validate()) {
|
|
||||||
showMsgDialog(context, "Error", "PIN must be 6 digits");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!_formKey.currentState!.validate()) {
|
if (!_formKey.currentState!.validate()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
String fcsId = "$prefixText${_fcsIdCtl.text}";
|
||||||
|
print(fcsId);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_isLoading = true;
|
_isLoading = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user