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