update pin login

This commit is contained in:
tzw
2024-02-14 17:19:55 +06:30
parent ba45659d5e
commit 86aedb42af
4 changed files with 99 additions and 103 deletions

View File

@@ -1,7 +1,5 @@
import 'package:fcs/domain/vo/delivery_address.dart'; import 'package:fcs/domain/vo/delivery_address.dart';
import 'package:fcs/helpers/theme.dart';
import 'package:fcs/pages/widgets/local_text.dart'; import 'package:fcs/pages/widgets/local_text.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_vector_icons/flutter_vector_icons.dart'; import 'package:flutter_vector_icons/flutter_vector_icons.dart';

View File

@@ -357,7 +357,7 @@ class _HomePageState extends State<HomePage> {
selectedColor: Colors.white, selectedColor: Colors.white,
color: Colors.blue, color: Colors.blue,
children: <Widget>[ children: <Widget>[
Icon(MaterialCommunityIcons.account_tie), Icon(MaterialCommunityIcons.account_tie,size: 25),
], ],
onPressed: (i) => this.setState(() { onPressed: (i) => this.setState(() {
isFcs[0] = !isFcs[0]; isFcs[0] = !isFcs[0];
@@ -381,16 +381,23 @@ class _HomePageState extends State<HomePage> {
onPressed: () { onPressed: () {
Navigator.of(context).push(RightLeftPageRoute(Profile())); Navigator.of(context).push(RightLeftPageRoute(Profile()));
}, },
iconSize: 30, iconSize: 25,
icon: Icon(Icons.account_circle,color: buttonColor,), icon: Icon(
Icons.account_circle,
color: buttonColor,
),
); );
final pinLoginBtn = IconButton( final pinLoginBtn = IconButton(
onPressed: () { onPressed: () {
Navigator.of(context) Navigator.of(context)
.push(CupertinoPageRoute(builder: (context) => PinLoginPage())); .push(CupertinoPageRoute(builder: (context) => PinLoginPage()));
}, },
iconSize: 30, iconSize: 25,
icon: Icon(SimpleLineIcons.lock,color: buttonColor,), icon: Icon(
Icons.lock_outline,
color: buttonColor,
),
); );
var searchInput = Row(children: [ var searchInput = Row(children: [
@@ -471,8 +478,8 @@ class _HomePageState extends State<HomePage> {
profileBtn, profileBtn,
] ]
: <Widget>[ : <Widget>[
fcsToggle,
pinLoginBtn, pinLoginBtn,
fcsToggle,
profileBtn, profileBtn,
] ]
: <Widget>[ : <Widget>[
@@ -506,8 +513,6 @@ class _HomePageState extends State<HomePage> {
); );
} }
_lookup() async { _lookup() async {
setState(() { setState(() {
_isLoading = true; _isLoading = true;
@@ -515,7 +520,7 @@ class _HomePageState extends State<HomePage> {
try { try {
String term = _searchCtl.text; String term = _searchCtl.text;
if ( term.trim() == "") return; if (term.trim() == "") return;
var packageModel = Provider.of<PackageModel>(context, listen: false); var packageModel = Provider.of<PackageModel>(context, listen: false);
Package? package = await packageModel.lookupPackage(term); Package? package = await packageModel.lookupPackage(term);
if (package == null) { if (package == null) {

View File

@@ -16,85 +16,20 @@ 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 bool allNumberEntered; TextEditingController _fcsIdCtl = new TextEditingController();
@override @override
void initState() { void initState() {
pin = ""; pin = "";
allNumberEntered = false;
super.initState(); super.initState();
} }
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LocalProgress( final fcsIdBox = TextFormField(
inAsyncCall: _isLoading, controller: _fcsIdCtl,
child: new Scaffold( autofocus: true,
appBar: LocalAppBar( style: TextStyle(
backgroundColor: null, fontSize: 15, color: Colors.black87, fontWeight: FontWeight.w500),
arrowColor: Colors.black,
),
body: _buildLogin(context)),
);
}
Widget _buildLogin(BuildContext context) {
return ListView(
padding: EdgeInsets.only(top: 20, left: 15, right: 15, bottom: 20),
children: <Widget>[
pinLoginLogo,
Padding(
padding: EdgeInsets.only(top: 20, bottom: 20),
child: Center(
child: LocalText(
context,
"welcome.pinlogin",
color: Colors.black,
fontSize: 18,
),
),
),
LocalText(
context,
"welcome.pinlogin.fcsid",
color: Colors.grey,
),
fcsIdBox,
Padding(
padding: EdgeInsets.only(top: 20, bottom: 20),
child: LocalText(
context,
"welcome.pinlogin.pin",
color: Colors.grey,
)),
Container(
child: PinInputTextField(
pinLength: 6,
decoration: BoxLooseDecoration(
strokeColorBuilder: PinListenColorBuilder(
primaryColor, Colors.grey.shade400)),
textInputAction: TextInputAction.done,
autoFocus: true,
onChanged: _pinChange,
),
),
loginBtn,
]);
}
final pinLoginLogo = Container(
width: 70,
height: 70,
child: FittedBox(
child: Image.asset(
"assets/logo.jpg",
),
fit: BoxFit.fitHeight,
),
);
final fcsIdBox = Column(
children: <Widget>[
TextFormField(
// controller: controller,
style: textStyle,
cursorColor: primaryColor, cursorColor: primaryColor,
keyboardType: TextInputType.text, keyboardType: TextInputType.text,
decoration: new InputDecoration( decoration: new InputDecoration(
@@ -107,9 +42,19 @@ class _PinLoginPageState extends State<PinLoginPage> {
disabledBorder: UnderlineInputBorder( disabledBorder: UnderlineInputBorder(
borderSide: BorderSide(color: primaryColor, width: 1.0)), borderSide: BorderSide(color: primaryColor, width: 1.0)),
), ),
),
],
); );
final pinLoginLogo = Container(
width: 70,
height: 70,
child: FittedBox(
child: Image.asset(
"assets/logo.jpg",
),
fit: BoxFit.fitHeight,
),
);
final loginBtn = Padding( final loginBtn = Padding(
padding: EdgeInsets.only(top: 30), padding: EdgeInsets.only(top: 30),
child: LocalButton( child: LocalButton(
@@ -117,11 +62,59 @@ class _PinLoginPageState extends State<PinLoginPage> {
callBack: () {}, callBack: () {},
), ),
); );
return LocalProgress(
inAsyncCall: _isLoading,
child: new Scaffold(
appBar: LocalAppBar(
backgroundColor: null,
arrowColor: Colors.black,
),
body: ListView(
padding: EdgeInsets.only(top: 20, left: 15, right: 15, bottom: 20),
children: [
pinLoginLogo,
Padding(
padding: EdgeInsets.only(top: 20, bottom: 20),
child: Center(
child: LocalText(context, "welcome.pinlogin",
color: Colors.black, fontSize: 18),
),
),
LocalText(
context,
"welcome.pinlogin.fcsid",
color: Colors.black54,
fontSize: 15,
),
fcsIdBox,
Padding(
padding: EdgeInsets.only(top: 25, bottom: 20),
child: LocalText(
context,
"welcome.pinlogin.pin",
color: Colors.black54,
fontSize: 15,
)),
PinInputTextField(
cursor: Cursor(
color: primaryColor, enabled: true, width: 2, height: 23),
pinLength: 6,
decoration: BoxLooseDecoration(
strokeColorBuilder: PinListenColorBuilder(
primaryColor, Colors.grey.shade400)),
textInputAction: TextInputAction.done,
autoFocus: false,
onChanged: _pinChange,
),
loginBtn,
],
)),
);
}
_pinChange(pin) { _pinChange(pin) {
setState(() { setState(() {
this.pin = pin; this.pin = pin;
this.allNumberEntered = this.pin.length == 6;
}); });
} }
} }

View File

@@ -63,7 +63,7 @@ class _StaffPinEditorState extends State<StaffPinEditor> {
const SizedBox(height: 8), const SizedBox(height: 8),
PinInputTextField( PinInputTextField(
cursor: Cursor( cursor: Cursor(
color: primaryColor, enabled: true, width: 2, height: 30), color: primaryColor, enabled: true, width: 2, height: 23),
pinLength: 6, pinLength: 6,
decoration: BoxLooseDecoration( decoration: BoxLooseDecoration(
strokeColorBuilder: strokeColorBuilder:
@@ -83,7 +83,7 @@ class _StaffPinEditorState extends State<StaffPinEditor> {
PinInputTextField( PinInputTextField(
pinLength: 6, pinLength: 6,
cursor: Cursor( cursor: Cursor(
color: primaryColor, enabled: true, width: 2, height: 30), color: primaryColor, enabled: true, width: 2, height: 23),
decoration: BoxLooseDecoration( decoration: BoxLooseDecoration(
strokeColorBuilder: strokeColorBuilder:
PinListenColorBuilder(primaryColor, Colors.grey.shade400)), PinListenColorBuilder(primaryColor, Colors.grey.shade400)),