mirror of
https://github.com/qinglong-app/qinglong_app.git
synced 2025-10-09 16:48:19 +08:00
登录页支持切换账号
This commit is contained in:
@@ -45,8 +45,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
if (!widget.doNotLoadLocalData) {
|
||||
_hostController.text = getIt<UserInfoViewModel>().host ?? "";
|
||||
useSecretLogin = getIt<UserInfoViewModel>().useSecretLogined;
|
||||
if (getIt<UserInfoViewModel>().userName != null &&
|
||||
getIt<UserInfoViewModel>().userName!.isNotEmpty) {
|
||||
if (getIt<UserInfoViewModel>().userName != null && getIt<UserInfoViewModel>().userName!.isNotEmpty) {
|
||||
if (getIt<UserInfoViewModel>().useSecretLogined) {
|
||||
_cIdController.text = getIt<UserInfoViewModel>().userName!;
|
||||
} else {
|
||||
@@ -56,8 +55,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
} else {
|
||||
rememberPassword = false;
|
||||
}
|
||||
if (getIt<UserInfoViewModel>().passWord != null &&
|
||||
getIt<UserInfoViewModel>().passWord!.isNotEmpty) {
|
||||
if (getIt<UserInfoViewModel>().passWord != null && getIt<UserInfoViewModel>().passWord!.isNotEmpty) {
|
||||
if (getIt<UserInfoViewModel>().useSecretLogined) {
|
||||
_cSecretController.text = getIt<UserInfoViewModel>().passWord!;
|
||||
} else {
|
||||
@@ -76,313 +74,335 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ColoredBox(
|
||||
color: ref.watch(themeProvider).themeColor.settingBgColor(),
|
||||
child: SizedBox(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
child: Image.asset(
|
||||
"assets/images/login_bg.png",
|
||||
width: MediaQuery.of(context).size.width,
|
||||
return SafeArea(
|
||||
child: ColoredBox(
|
||||
color: ref.watch(themeProvider).themeColor.settingBgColor(),
|
||||
child: SizedBox(
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
child: Image.asset(
|
||||
"assets/images/login_bg.png",
|
||||
width: MediaQuery.of(context).size.width,
|
||||
),
|
||||
),
|
||||
),
|
||||
Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 40,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height / 8,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Image.asset(
|
||||
"assets/images/login_tip.png",
|
||||
height: 45,
|
||||
Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 40,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height / 10,
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Image.asset(
|
||||
"assets/images/login_tip.png",
|
||||
height: 45,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
GestureDetector(
|
||||
onDoubleTap: () {
|
||||
if (debugBtnIsShow()) {
|
||||
dismissDebugBtn();
|
||||
} else {
|
||||
showDebugBtn(context,
|
||||
btnColor: ref
|
||||
.watch(themeProvider)
|
||||
.primaryColor);
|
||||
}
|
||||
WidgetsBinding.instance?.endOfFrame;
|
||||
},
|
||||
child: ColorFiltered(
|
||||
colorFilter: ColorFilter.mode(
|
||||
ref.watch(themeProvider).primaryColor,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
child: Image.asset(
|
||||
"assets/images/ql.png",
|
||||
height: 45,
|
||||
GestureDetector(
|
||||
onDoubleTap: () {
|
||||
if (debugBtnIsShow()) {
|
||||
dismissDebugBtn();
|
||||
} else {
|
||||
showDebugBtn(context, btnColor: ref.watch(themeProvider).primaryColor);
|
||||
}
|
||||
WidgetsBinding.instance?.endOfFrame;
|
||||
},
|
||||
child: ColorFiltered(
|
||||
colorFilter: ColorFilter.mode(
|
||||
ref.watch(themeProvider).primaryColor,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
child: Image.asset(
|
||||
"assets/images/ql.png",
|
||||
height: 45,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height / 15,
|
||||
),
|
||||
const Text(
|
||||
"域名:",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
],
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
controller: _hostController,
|
||||
decoration: const InputDecoration(
|
||||
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||
hintText: "http://1.1.1.1:5700",
|
||||
SizedBox(
|
||||
height: MediaQuery.of(context).size.height / 15,
|
||||
),
|
||||
autofocus: false,
|
||||
),
|
||||
FlipCard(
|
||||
key: cardKey,
|
||||
flipOnTouch: false,
|
||||
onFlipDone: (back) {
|
||||
useSecretLogin = back;
|
||||
setState(() {});
|
||||
},
|
||||
direction: FlipDirection.HORIZONTAL,
|
||||
front: SizedBox(
|
||||
height: 200,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
const Text(
|
||||
"用户名:",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
controller: _userNameController,
|
||||
decoration: const InputDecoration(
|
||||
contentPadding:
|
||||
EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||
hintText: "请输入用户名",
|
||||
),
|
||||
autofocus: false,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
const Text(
|
||||
"密码:",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
controller: _passwordController,
|
||||
obscureText: true,
|
||||
decoration: const InputDecoration(
|
||||
contentPadding:
|
||||
EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||
hintText: "请输入密码",
|
||||
),
|
||||
autofocus: false,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
const Text(
|
||||
"域名:",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
back: SizedBox(
|
||||
height: 200,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
const Text(
|
||||
"client_id:",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
controller: _cIdController,
|
||||
decoration: const InputDecoration(
|
||||
contentPadding:
|
||||
EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||
hintText: "请输入client_id",
|
||||
),
|
||||
autofocus: false,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
const Text(
|
||||
"client_secret:",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
controller: _cSecretController,
|
||||
obscureText: true,
|
||||
decoration: const InputDecoration(
|
||||
contentPadding:
|
||||
EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||
hintText: "请输入client_secret",
|
||||
),
|
||||
autofocus: false,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 25,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: rememberPassword,
|
||||
onChanged: (checked) {
|
||||
rememberPassword = checked ?? false;
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
const Text(
|
||||
"记住密码/client",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
const Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
cardKey.currentState?.toggleCard();
|
||||
WidgetsBinding.instance
|
||||
?.addPostFrameCallback((timeStamp) {
|
||||
TextField(
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
loginByUserName() ? "client_id登录" : "账号登录",
|
||||
style: const TextStyle(
|
||||
},
|
||||
controller: _hostController,
|
||||
decoration: const InputDecoration(
|
||||
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||
hintText: "http://1.1.1.1:5700",
|
||||
),
|
||||
autofocus: false,
|
||||
),
|
||||
FlipCard(
|
||||
key: cardKey,
|
||||
flipOnTouch: false,
|
||||
onFlipDone: (back) {
|
||||
useSecretLogin = back;
|
||||
setState(() {});
|
||||
},
|
||||
direction: FlipDirection.HORIZONTAL,
|
||||
front: SizedBox(
|
||||
height: 200,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
const Text(
|
||||
"用户名:",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
controller: _userNameController,
|
||||
decoration: const InputDecoration(
|
||||
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||
hintText: "请输入用户名",
|
||||
),
|
||||
autofocus: false,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
const Text(
|
||||
"密码:",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
controller: _passwordController,
|
||||
obscureText: true,
|
||||
decoration: const InputDecoration(
|
||||
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||
hintText: "请输入密码",
|
||||
),
|
||||
autofocus: false,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
back: SizedBox(
|
||||
height: 200,
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
const Text(
|
||||
"client_id:",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
controller: _cIdController,
|
||||
decoration: const InputDecoration(
|
||||
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||
hintText: "请输入client_id",
|
||||
),
|
||||
autofocus: false,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 15,
|
||||
),
|
||||
const Text(
|
||||
"client_secret:",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
TextField(
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
controller: _cSecretController,
|
||||
obscureText: true,
|
||||
decoration: const InputDecoration(
|
||||
contentPadding: EdgeInsets.fromLTRB(0, 5, 0, 5),
|
||||
hintText: "请输入client_secret",
|
||||
),
|
||||
autofocus: false,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 25,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Checkbox(
|
||||
value: rememberPassword,
|
||||
onChanged: (checked) {
|
||||
rememberPassword = checked ?? false;
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
const Text(
|
||||
"记住密码/client",
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 40,
|
||||
),
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width - 80,
|
||||
child: IgnorePointer(
|
||||
ignoring: !canClickLoginBtn(),
|
||||
child: CupertinoButton(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
const Spacer(),
|
||||
GestureDetector(
|
||||
onTap: () {
|
||||
cardKey.currentState?.toggleCard();
|
||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
||||
setState(() {});
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
loginByUserName() ? "client_id登录" : "账号登录",
|
||||
style: const TextStyle(
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
color: canClickLoginBtn()
|
||||
? ref.watch(themeProvider).primaryColor
|
||||
: ref
|
||||
.watch(themeProvider)
|
||||
.primaryColor
|
||||
.withOpacity(0.4),
|
||||
child: isLoading
|
||||
? const CupertinoActivityIndicator()
|
||||
: const Text(
|
||||
"登 录",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 40,
|
||||
),
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width - 80,
|
||||
child: IgnorePointer(
|
||||
ignoring: !canClickLoginBtn(),
|
||||
child: CupertinoButton(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 5,
|
||||
),
|
||||
color: canClickLoginBtn() ? ref.watch(themeProvider).primaryColor : ref.watch(themeProvider).primaryColor.withOpacity(0.4),
|
||||
child: isLoading
|
||||
? const CupertinoActivityIndicator()
|
||||
: const Text(
|
||||
"登 录",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
),
|
||||
onPressed: () {
|
||||
Http.pushedLoginPage = false;
|
||||
Utils.hideKeyBoard(context);
|
||||
if (loginByUserName()) {
|
||||
login(_userNameController.text,
|
||||
_passwordController.text);
|
||||
} else {
|
||||
login(_cIdController.text,
|
||||
_cSecretController.text);
|
||||
}
|
||||
},
|
||||
onPressed: () {
|
||||
Http.pushedLoginPage = false;
|
||||
Utils.hideKeyBoard(context);
|
||||
if (loginByUserName()) {
|
||||
login(_userNameController.text, _passwordController.text);
|
||||
} else {
|
||||
login(_cIdController.text, _cSecretController.text);
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
height: 30,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
bottom: 10,
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
child: Center(
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
child: PopupMenuButton<UserInfoBean>(
|
||||
onSelected: (UserInfoBean result) {
|
||||
selected(result);
|
||||
},
|
||||
itemBuilder: (BuildContext context) => <PopupMenuEntry<UserInfoBean>>[
|
||||
...getIt<UserInfoViewModel>()
|
||||
.historyAccounts
|
||||
.map((e) => PopupMenuItem<UserInfoBean>(
|
||||
value: e,
|
||||
child: buildCell(e),
|
||||
))
|
||||
.toList(),
|
||||
],
|
||||
child: Text(
|
||||
"切换账号",
|
||||
style: TextStyle(
|
||||
color: ref.watch(themeProvider).primaryColor,
|
||||
fontSize: 14,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -400,8 +420,7 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
isLoading = true;
|
||||
setState(() {});
|
||||
|
||||
helper = LoginHelper(useSecretLogin, _hostController.text, userName,
|
||||
password, rememberPassword);
|
||||
helper = LoginHelper(useSecretLogin, _hostController.text, userName, password, rememberPassword);
|
||||
var response = await helper!.login();
|
||||
dealLoginResponse(response);
|
||||
}
|
||||
@@ -426,11 +445,9 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
|
||||
if (_hostController.text.isEmpty) return false;
|
||||
if (!loginByUserName()) {
|
||||
return _cIdController.text.isNotEmpty &&
|
||||
_cSecretController.text.isNotEmpty;
|
||||
return _cIdController.text.isNotEmpty && _cSecretController.text.isNotEmpty;
|
||||
} else {
|
||||
return _userNameController.text.isNotEmpty &&
|
||||
_passwordController.text.isNotEmpty;
|
||||
return _userNameController.text.isNotEmpty && _passwordController.text.isNotEmpty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -501,11 +518,49 @@ class _LoginPageState extends ConsumerState<LoginPage> {
|
||||
void update() async {
|
||||
String? result = await UpdateUtils().checkUpdate();
|
||||
if (result != null && result.isNotEmpty) {
|
||||
UpdateDialog updateDialog = UpdateDialog(context,
|
||||
title: "发现新版本", updateContent: "版本号:v${result}", onUpdate: () {
|
||||
UpdateDialog updateDialog = UpdateDialog(context, title: "发现新版本", updateContent: "版本号:v${result}", onUpdate: () {
|
||||
UpdateUtils.launchURL(result);
|
||||
});
|
||||
updateDialog.show();
|
||||
}
|
||||
}
|
||||
|
||||
Widget buildCell(UserInfoBean bean) {
|
||||
return ListTile(
|
||||
title: Text(
|
||||
bean.host ?? "",
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
subtitle: Padding(
|
||||
padding: const EdgeInsets.only(top: 10.0),
|
||||
child: Text(
|
||||
bean.userName ?? "",
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void selected(UserInfoBean result) {
|
||||
_hostController.text = result.host ?? "";
|
||||
if (result.useSecretLogined) {
|
||||
_cIdController.text = result.userName ?? "";
|
||||
_cSecretController.text = result.password ?? "";
|
||||
if (cardKey.currentState?.isFront ?? false) {
|
||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
||||
cardKey.currentState?.toggleCard();
|
||||
});
|
||||
}
|
||||
} else {
|
||||
_userNameController.text = result.userName ?? "";
|
||||
_passwordController.text = result.password ?? "";
|
||||
if (!(cardKey.currentState?.isFront ?? false)) {
|
||||
WidgetsBinding.instance?.addPostFrameCallback((timeStamp) {
|
||||
cardKey.currentState?.toggleCard();
|
||||
});
|
||||
}
|
||||
}
|
||||
rememberPassword = true;
|
||||
setState(() {});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user