Merge branch 'master' of sma/fcs into master
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
|
import 'package:fcs/domain/entities/user.dart';
|
||||||
import 'package:fcs/helpers/theme.dart';
|
import 'package:fcs/helpers/theme.dart';
|
||||||
|
import 'package:fcs/pages/main/util.dart';
|
||||||
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
import 'package:fcs/pages/widgets/local_app_bar.dart';
|
||||||
import 'package:fcs/pages/widgets/local_button.dart';
|
import 'package:fcs/pages/widgets/local_button.dart';
|
||||||
import 'package:fcs/pages/widgets/local_text.dart';
|
import 'package:fcs/pages/widgets/local_text.dart';
|
||||||
@@ -7,6 +9,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:pin_input_text_field/pin_input_text_field.dart';
|
import 'package:pin_input_text_field/pin_input_text_field.dart';
|
||||||
|
|
||||||
class PinLoginPage extends StatefulWidget {
|
class PinLoginPage extends StatefulWidget {
|
||||||
|
//final User user;
|
||||||
const PinLoginPage({super.key});
|
const PinLoginPage({super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -16,12 +19,17 @@ class PinLoginPage extends StatefulWidget {
|
|||||||
class _PinLoginPageState extends State<PinLoginPage> {
|
class _PinLoginPageState extends State<PinLoginPage> {
|
||||||
bool _isLoading = false;
|
bool _isLoading = false;
|
||||||
late String pin;
|
late String pin;
|
||||||
|
//late User _user;
|
||||||
TextEditingController _fcsIdCtl = new TextEditingController();
|
TextEditingController _fcsIdCtl = new TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
pin = "";
|
//_user=widget.user;
|
||||||
|
//pin = _user.pinDigit ?? "";
|
||||||
super.initState();
|
super.initState();
|
||||||
|
if (mounted) {
|
||||||
|
setState(() {});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -59,18 +67,19 @@ class _PinLoginPageState extends State<PinLoginPage> {
|
|||||||
padding: EdgeInsets.only(top: 30),
|
padding: EdgeInsets.only(top: 30),
|
||||||
child: LocalButton(
|
child: LocalButton(
|
||||||
textKey: "welcome.pinlogin",
|
textKey: "welcome.pinlogin",
|
||||||
callBack: () {},
|
callBack: _login,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
return LocalProgress(
|
return LocalProgress(
|
||||||
inAsyncCall: _isLoading,
|
inAsyncCall: _isLoading,
|
||||||
child: new Scaffold(
|
child: new Scaffold(
|
||||||
appBar: LocalAppBar(
|
// appBar: LocalAppBar(
|
||||||
backgroundColor: null,
|
// backgroundColor: primaryColor,
|
||||||
arrowColor: Colors.black,
|
|
||||||
),
|
|
||||||
|
// ),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
padding: EdgeInsets.only(top: 20, left: 15, right: 15, bottom: 20),
|
padding: EdgeInsets.only(top: 80, left: 15, right: 15, bottom: 20),
|
||||||
children: [
|
children: [
|
||||||
pinLoginLogo,
|
pinLoginLogo,
|
||||||
Padding(
|
Padding(
|
||||||
@@ -117,4 +126,29 @@ class _PinLoginPageState extends State<PinLoginPage> {
|
|||||||
this.pin = pin;
|
this.pin = pin;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
_login() async {
|
||||||
|
if (pin == "") {
|
||||||
|
showMsgDialog(context, "Error", "Invalid PIN");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pin.length < 6) {
|
||||||
|
showMsgDialog(context, "Error", "PIN must be 6 digits");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
setState(() {
|
||||||
|
_isLoading = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
try {
|
||||||
|
Navigator.pop(context, true);
|
||||||
|
} catch (e) {
|
||||||
|
showMsgDialog(context, "Error", e.toString());
|
||||||
|
} finally {
|
||||||
|
setState(() {
|
||||||
|
_isLoading = false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user