reason

fixed注册逻辑

......@@ -44,6 +44,7 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Phone"),
"accountEditPageUserPhonePlaceholder":
MessageLookupByLibrary.simpleMessage("Please input Phone"),
"agreement": MessageLookupByLibrary.simpleMessage("Agreement"),
"categoryBottomNavigationBarItemTitle":
MessageLookupByLibrary.simpleMessage("category"),
"confirm": MessageLookupByLibrary.simpleMessage("Confirm"),
......@@ -51,6 +52,8 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("Forgot Password"),
"getVerificationCode":
MessageLookupByLibrary.simpleMessage("Get verification code"),
"inputEmailHint":
MessageLookupByLibrary.simpleMessage("Please enter email address"),
"inputPasswordHint":
MessageLookupByLibrary.simpleMessage("Please enter the password"),
"inputPhoneHint":
......@@ -69,6 +72,8 @@ class MessageLookup extends MessageLookupByLibrary {
"openYourAccount":
MessageLookupByLibrary.simpleMessage("Open your account"),
"passwordLogin": MessageLookupByLibrary.simpleMessage("Password Login"),
"privacy_policy":
MessageLookupByLibrary.simpleMessage("Privacy Policy"),
"profileBottomNavigationBarItemTitle":
MessageLookupByLibrary.simpleMessage("profile"),
"register": MessageLookupByLibrary.simpleMessage("Register"),
......@@ -79,6 +84,8 @@ class MessageLookup extends MessageLookupByLibrary {
"timelineBottomNavigationBarItemTitle":
MessageLookupByLibrary.simpleMessage("timeline"),
"title": MessageLookupByLibrary.simpleMessage("One Poem"),
"user_agreement":
MessageLookupByLibrary.simpleMessage("User Agreement"),
"verificationButton": MessageLookupByLibrary.simpleMessage(
"Not really sent, just log in!"),
"verificationCodeLogin":
......
......@@ -39,11 +39,13 @@ class MessageLookup extends MessageLookupByLibrary {
"accountEditPageUserPhone": MessageLookupByLibrary.simpleMessage("手机号"),
"accountEditPageUserPhonePlaceholder":
MessageLookupByLibrary.simpleMessage("请输入您的手机号"),
"agreement": MessageLookupByLibrary.simpleMessage("登录即代表同意并阅读"),
"categoryBottomNavigationBarItemTitle":
MessageLookupByLibrary.simpleMessage("众妙"),
"confirm": MessageLookupByLibrary.simpleMessage("确认"),
"forgotPasswordLink": MessageLookupByLibrary.simpleMessage("忘记密码"),
"getVerificationCode": MessageLookupByLibrary.simpleMessage("获取验证码"),
"inputEmailHint": MessageLookupByLibrary.simpleMessage("请输入邮箱地址"),
"inputPasswordHint": MessageLookupByLibrary.simpleMessage("请输入密码"),
"inputPhoneHint": MessageLookupByLibrary.simpleMessage("请输入手机号"),
"inputPhoneInvalid": MessageLookupByLibrary.simpleMessage("请输入有效的手机号"),
......@@ -57,6 +59,7 @@ class MessageLookup extends MessageLookupByLibrary {
MessageLookupByLibrary.simpleMessage("一言"),
"openYourAccount": MessageLookupByLibrary.simpleMessage("开启你的账号"),
"passwordLogin": MessageLookupByLibrary.simpleMessage("密码登录"),
"privacy_policy": MessageLookupByLibrary.simpleMessage("隐私政策"),
"profileBottomNavigationBarItemTitle":
MessageLookupByLibrary.simpleMessage("我在"),
"register": MessageLookupByLibrary.simpleMessage("注册"),
......@@ -66,6 +69,7 @@ class MessageLookup extends MessageLookupByLibrary {
"timelineBottomNavigationBarItemTitle":
MessageLookupByLibrary.simpleMessage("临境"),
"title": MessageLookupByLibrary.simpleMessage("一言"),
"user_agreement": MessageLookupByLibrary.simpleMessage("用户协议"),
"verificationButton":
MessageLookupByLibrary.simpleMessage("并没有真正发送哦,直接登录吧!"),
"verificationCodeLogin": MessageLookupByLibrary.simpleMessage("验证码登录")
......
......@@ -160,6 +160,16 @@ class S {
);
}
/// `Please enter email address`
String get inputEmailHint {
return Intl.message(
'Please enter email address',
name: 'inputEmailHint',
desc: 'Please enter email address',
args: [],
);
}
/// `Please enter verification code`
String get inputVerificationCodeHint {
return Intl.message(
......@@ -379,6 +389,36 @@ class S {
args: [],
);
}
/// `Agreement`
String get agreement {
return Intl.message(
'Agreement',
name: 'agreement',
desc: 'Agreement',
args: [],
);
}
/// `User Agreement`
String get user_agreement {
return Intl.message(
'User Agreement',
name: 'user_agreement',
desc: 'User Agreement',
args: [],
);
}
/// `Privacy Policy`
String get privacy_policy {
return Intl.message(
'Privacy Policy',
name: 'privacy_policy',
desc: 'Privacy Policy',
args: [],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
......
......@@ -66,6 +66,12 @@
"type": "text",
"placeholders": {}
},
"inputEmailHint": "Please enter email address",
"@inputEmailHint": {
"description": "Please enter email address",
"type": "text",
"placeholders": {}
},
"inputVerificationCodeHint": "Please enter verification code",
"@inputVerificationCodeHint": {
"description": "Please enter verification code",
......@@ -197,5 +203,23 @@
"description": "Birthday",
"type": "text",
"placeholders": {}
},
"agreement": "Agreement",
"@agreement": {
"description": "Agreement",
"type": "text",
"placeholders": {}
},
"user_agreement": "User Agreement",
"@user_agreement": {
"description": "User Agreement",
"type": "text",
"placeholders": {}
},
"privacy_policy": "Privacy Policy",
"@privacy_policy": {
"description": "Privacy Policy",
"type": "text",
"placeholders": {}
}
}
\ No newline at end of file
......
......@@ -10,6 +10,7 @@
"register": "注册",
"openYourAccount": "开启你的账号",
"inputPhoneHint": "请输入手机号",
"inputEmailHint": "请输入邮箱地址",
"inputVerificationCodeHint": "请输入验证码",
"inputPhoneInvalid": "请输入有效的手机号",
"verificationButton": "并没有真正发送哦,直接登录吧!",
......@@ -17,20 +18,22 @@
"confirm": "确认",
"resetLoginPassword": "重置登录密码",
"registeredTips": "提示:未注册账号的手机号,请先",
"onePoemBottomNavigationBarItemTitle" : "一言",
"timelineBottomNavigationBarItemTitle" : "临境",
"categoryBottomNavigationBarItemTitle" : "众妙",
"onePoemBottomNavigationBarItemTitle": "一言",
"timelineBottomNavigationBarItemTitle": "临境",
"categoryBottomNavigationBarItemTitle": "众妙",
"profileBottomNavigationBarItemTitle" : "我在",
"accountEditPageUserInfo" : "个人信息",
"accountEditPageUserName" : "姓名",
"accountEditPageUserNamePlaceholder" : "请输入您的名称",
"accountEditPageUserEmail" : "邮箱",
"accountEditPageUserEmailPlaceholder" : "请输入您的邮箱",
"accountEditPageUserPhone" : "手机号",
"accountEditPageUserPhonePlaceholder" : "请输入您的手机号",
"accountEditPageUserGender" : "性别",
"accountEditPageUserGenderPlaceholder" : "请选择性别",
"accountEditPageUserBirthday" : "出生日期",
"accountEditPageUserBirthdayPlaceholder" : "请输入出生日期"
"accountEditPageUserInfo": "个人信息",
"accountEditPageUserName": "姓名",
"accountEditPageUserNamePlaceholder": "请输入您的名称",
"accountEditPageUserEmail": "邮箱",
"accountEditPageUserEmailPlaceholder": "请输入您的邮箱",
"accountEditPageUserPhone": "手机号",
"accountEditPageUserPhonePlaceholder": "请输入您的手机号",
"accountEditPageUserGender": "性别",
"accountEditPageUserGenderPlaceholder": "请选择性别",
"accountEditPageUserBirthday": "出生日期",
"accountEditPageUserBirthdayPlaceholder": "请输入出生日期",
"agreement": "登录即代表同意并阅读",
"user_agreement": "用户协议",
"privacy_policy": "隐私政策"
}
\ No newline at end of file
......
import 'package:Parlando/net/dio_utils.dart';
import 'package:Parlando/net/http_api.dart';
import 'package:Parlando/res/constant.dart';
import 'package:Parlando/routers/fluro_navigator.dart';
import 'package:Parlando/routers/routers.dart';
import 'package:email_validator/email_validator.dart';
import 'package:flustars/flustars.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:Parlando/home/webview_page.dart';
......@@ -15,6 +19,7 @@ import 'package:Parlando/widgets/my_scroll_view.dart';
import 'package:flutter_gen/gen_l10n/Parlando_localizations.dart';
import 'package:Parlando/extension/int_extension.dart';
import 'package:getwidget/getwidget.dart';
/// design/1注册登录/index.html#artboard11
class RegisterPage extends StatefulWidget {
......@@ -34,6 +39,7 @@ class _RegisterPageState extends State<RegisterPage>
final FocusNode _nodeText2 = FocusNode();
final FocusNode _nodeText3 = FocusNode();
bool _clickable = false;
bool _isLoading = false;
@override
Map<ChangeNotifier, List<VoidCallback>?>? changeNotifier() {
......@@ -70,6 +76,8 @@ class _RegisterPageState extends State<RegisterPage>
}
void _register() {
_isLoading = true;
setState(() {});
Map<String, String> params = <String, String>{
"email": _nameController.text,
"password": _passwordController.text,
......@@ -79,15 +87,24 @@ class _RegisterPageState extends State<RegisterPage>
Method.post,
HttpApi.register,
params: params,
onSuccess: (data) {},
onError: (code, msg) {},
onSuccess: (data) {
SpUtil.putString(Constant.userToken, "this is user token!");
NavigatorUtils.push(context, Routes.home, clearStack: true);
_isLoading = false;
},
onError: (code, msg) {
Toast.show(msg);
_isLoading = false;
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: const MyAppBar(),
appBar: const MyAppBar(
isTransparent: true,
),
body: MyScrollView(
keyboardConfig: Utils.getKeyboardActionsConfig(
context, <FocusNode>[_nodeText1, _nodeText2, _nodeText3]),
......@@ -111,7 +128,7 @@ class _RegisterPageState extends State<RegisterPage>
controller: _nameController,
maxLength: 100,
keyboardType: TextInputType.emailAddress,
hintText: ParlandoLocalizations.of(context).inputPhoneHint,
hintText: ParlandoLocalizations.of(context).inputEmailHint,
),
Gaps.vGap8,
MyTextField(
......@@ -159,31 +176,35 @@ class _RegisterPageState extends State<RegisterPage>
Gaps.vGap8,
Text.rich(
TextSpan(
text: '登录即代表同意并阅读',
text: ParlandoLocalizations.of(context).agreement,
style: const TextStyle(fontSize: 14, color: Color(0xFF999999)),
children: [
TextSpan(
text: '《用户协议》',
text: '《${ParlandoLocalizations.of(context).user_agreement}》',
style: TextStyle(color: Theme.of(context).primaryColor),
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) {
return const WebViewPage(
title: '《用户协议》', url: 'https://flutter.dev');
return WebViewPage(
title:
'《${ParlandoLocalizations.of(context).user_agreement}》',
url: 'https://flutter.dev');
}));
},
),
const TextSpan(text: ''),
const TextSpan(text: ' & '),
TextSpan(
text: '《隐私政策》',
text: '《${ParlandoLocalizations.of(context).privacy_policy}》',
style: TextStyle(color: Theme.of(context).primaryColor),
recognizer: TapGestureRecognizer()
..onTap = () {
Navigator.of(context)
.push(MaterialPageRoute(builder: (context) {
return const WebViewPage(
title: '《隐私政策》', url: 'https://flutter.dev');
return WebViewPage(
title:
'《${ParlandoLocalizations.of(context).privacy_policy}》',
url: 'https://flutter.dev');
}));
},
),
......@@ -192,9 +213,12 @@ class _RegisterPageState extends State<RegisterPage>
Gaps.vGap24,
MyButton(
key: const Key('register'),
onPressed: _clickable ? _register : null,
onPressed: _clickable && !_isLoading ? _register : null,
text: ParlandoLocalizations.of(context).register,
)
),
Container(
child: _isLoading ? const GFLoader() : null,
),
];
}
}
......
......@@ -488,6 +488,13 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
getwidget:
dependency: "direct main"
description:
name: getwidget
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.0.5"
glob:
dependency: transitive
description:
......
......@@ -108,6 +108,8 @@ dependencies:
pausable_timer: ^1.0.0+3
email_validator: ^2.0.1
getwidget: ^2.0.5
dependency_overrides:
decimal: 1.5.0
......