♻️ Modify prompt

This commit is contained in:
niuhuan 2023-02-16 16:40:26 +08:00
parent a5e2c567ca
commit 8cfcf450e1
2 changed files with 19 additions and 17 deletions

View File

@ -221,7 +221,7 @@ class _AccountScreenState extends State<AccountScreen> {
break; break;
} }
if ("$e".contains("email") && "$e".contains("password")) { if ("$e".contains("email") && "$e".contains("password")) {
message = "请检查账号密码"; message = "账号密码错误";
} }
alertDialog( alertDialog(
context, context,

View File

@ -16,7 +16,6 @@ class RegisterScreen extends StatefulWidget {
} }
class _RegisterScreenState extends State<RegisterScreen> { class _RegisterScreenState extends State<RegisterScreen> {
late bool _registering = false; late bool _registering = false;
late bool _registerOver = false; late bool _registerOver = false;
@ -78,6 +77,8 @@ class _RegisterScreenState extends State<RegisterScreen> {
String message = "$e"; String message = "$e";
if (message.contains("email is already exist")) { if (message.contains("email is already exist")) {
message = "账号已存在"; message = "账号已存在";
} else if (message.contains("name is already exist")) {
message = "昵称已存在";
} }
alertDialog(context, "注册失败", message); alertDialog(context, "注册失败", message);
} finally { } finally {
@ -123,10 +124,15 @@ class _RegisterScreenState extends State<RegisterScreen> {
); );
} }
return Scaffold( return Scaffold(
appBar: AppBar(title: const Text('注册'), actions: [ appBar: AppBar(
title: const Text('注册'),
actions: [
IconButton( IconButton(
onPressed: () => _register(), icon: const Icon(Icons.check),), onPressed: () => _register(),
],), icon: const Icon(Icons.check),
),
],
),
body: ListView( body: ListView(
children: [ children: [
const Divider(), const Divider(),
@ -157,7 +163,7 @@ class _RegisterScreenState extends State<RegisterScreen> {
src: _password, src: _password,
title: '密码', title: '密码',
hint: '请输入密码', hint: '请输入密码',
desc: '(大小写字母+数字/8位以上)', desc: '(大小写字母+数字/8位以上)',
isPasswd: true, isPasswd: true,
); );
if (input != null) { if (input != null) {
@ -229,16 +235,13 @@ class _RegisterScreenState extends State<RegisterScreen> {
title: const Text("生日"), title: const Text("生日"),
subtitle: Text(_birthday), subtitle: Text(_birthday),
onTap: () async { onTap: () async {
DatePicker.showDatePicker( DatePicker.showDatePicker(context,
context,
locale: LocaleType.zh, locale: LocaleType.zh,
currentTime: DateTime.parse(_birthday), currentTime: DateTime.parse(_birthday), onConfirm: (date) {
onConfirm: (date) {
setState(() { setState(() {
_birthday = formatTimeToDate(date.toString()); _birthday = formatTimeToDate(date.toString());
}); });
} });
);
}, },
), ),
const Divider(), const Divider(),
@ -364,5 +367,4 @@ class _RegisterScreenState extends State<RegisterScreen> {
return ""; return "";
} }
} }
} }