reason

fixed注册逻辑

...@@ -44,6 +44,7 @@ class MessageLookup extends MessageLookupByLibrary { ...@@ -44,6 +44,7 @@ class MessageLookup extends MessageLookupByLibrary {
44 MessageLookupByLibrary.simpleMessage("Phone"), 44 MessageLookupByLibrary.simpleMessage("Phone"),
45 "accountEditPageUserPhonePlaceholder": 45 "accountEditPageUserPhonePlaceholder":
46 MessageLookupByLibrary.simpleMessage("Please input Phone"), 46 MessageLookupByLibrary.simpleMessage("Please input Phone"),
47 + "agreement": MessageLookupByLibrary.simpleMessage("Agreement"),
47 "categoryBottomNavigationBarItemTitle": 48 "categoryBottomNavigationBarItemTitle":
48 MessageLookupByLibrary.simpleMessage("category"), 49 MessageLookupByLibrary.simpleMessage("category"),
49 "confirm": MessageLookupByLibrary.simpleMessage("Confirm"), 50 "confirm": MessageLookupByLibrary.simpleMessage("Confirm"),
...@@ -51,6 +52,8 @@ class MessageLookup extends MessageLookupByLibrary { ...@@ -51,6 +52,8 @@ class MessageLookup extends MessageLookupByLibrary {
51 MessageLookupByLibrary.simpleMessage("Forgot Password"), 52 MessageLookupByLibrary.simpleMessage("Forgot Password"),
52 "getVerificationCode": 53 "getVerificationCode":
53 MessageLookupByLibrary.simpleMessage("Get verification code"), 54 MessageLookupByLibrary.simpleMessage("Get verification code"),
55 + "inputEmailHint":
56 + MessageLookupByLibrary.simpleMessage("Please enter email address"),
54 "inputPasswordHint": 57 "inputPasswordHint":
55 MessageLookupByLibrary.simpleMessage("Please enter the password"), 58 MessageLookupByLibrary.simpleMessage("Please enter the password"),
56 "inputPhoneHint": 59 "inputPhoneHint":
...@@ -69,6 +72,8 @@ class MessageLookup extends MessageLookupByLibrary { ...@@ -69,6 +72,8 @@ class MessageLookup extends MessageLookupByLibrary {
69 "openYourAccount": 72 "openYourAccount":
70 MessageLookupByLibrary.simpleMessage("Open your account"), 73 MessageLookupByLibrary.simpleMessage("Open your account"),
71 "passwordLogin": MessageLookupByLibrary.simpleMessage("Password Login"), 74 "passwordLogin": MessageLookupByLibrary.simpleMessage("Password Login"),
75 + "privacy_policy":
76 + MessageLookupByLibrary.simpleMessage("Privacy Policy"),
72 "profileBottomNavigationBarItemTitle": 77 "profileBottomNavigationBarItemTitle":
73 MessageLookupByLibrary.simpleMessage("profile"), 78 MessageLookupByLibrary.simpleMessage("profile"),
74 "register": MessageLookupByLibrary.simpleMessage("Register"), 79 "register": MessageLookupByLibrary.simpleMessage("Register"),
...@@ -79,6 +84,8 @@ class MessageLookup extends MessageLookupByLibrary { ...@@ -79,6 +84,8 @@ class MessageLookup extends MessageLookupByLibrary {
79 "timelineBottomNavigationBarItemTitle": 84 "timelineBottomNavigationBarItemTitle":
80 MessageLookupByLibrary.simpleMessage("timeline"), 85 MessageLookupByLibrary.simpleMessage("timeline"),
81 "title": MessageLookupByLibrary.simpleMessage("One Poem"), 86 "title": MessageLookupByLibrary.simpleMessage("One Poem"),
87 + "user_agreement":
88 + MessageLookupByLibrary.simpleMessage("User Agreement"),
82 "verificationButton": MessageLookupByLibrary.simpleMessage( 89 "verificationButton": MessageLookupByLibrary.simpleMessage(
83 "Not really sent, just log in!"), 90 "Not really sent, just log in!"),
84 "verificationCodeLogin": 91 "verificationCodeLogin":
......
...@@ -39,11 +39,13 @@ class MessageLookup extends MessageLookupByLibrary { ...@@ -39,11 +39,13 @@ class MessageLookup extends MessageLookupByLibrary {
39 "accountEditPageUserPhone": MessageLookupByLibrary.simpleMessage("手机号"), 39 "accountEditPageUserPhone": MessageLookupByLibrary.simpleMessage("手机号"),
40 "accountEditPageUserPhonePlaceholder": 40 "accountEditPageUserPhonePlaceholder":
41 MessageLookupByLibrary.simpleMessage("请输入您的手机号"), 41 MessageLookupByLibrary.simpleMessage("请输入您的手机号"),
42 + "agreement": MessageLookupByLibrary.simpleMessage("登录即代表同意并阅读"),
42 "categoryBottomNavigationBarItemTitle": 43 "categoryBottomNavigationBarItemTitle":
43 MessageLookupByLibrary.simpleMessage("众妙"), 44 MessageLookupByLibrary.simpleMessage("众妙"),
44 "confirm": MessageLookupByLibrary.simpleMessage("确认"), 45 "confirm": MessageLookupByLibrary.simpleMessage("确认"),
45 "forgotPasswordLink": MessageLookupByLibrary.simpleMessage("忘记密码"), 46 "forgotPasswordLink": MessageLookupByLibrary.simpleMessage("忘记密码"),
46 "getVerificationCode": MessageLookupByLibrary.simpleMessage("获取验证码"), 47 "getVerificationCode": MessageLookupByLibrary.simpleMessage("获取验证码"),
48 + "inputEmailHint": MessageLookupByLibrary.simpleMessage("请输入邮箱地址"),
47 "inputPasswordHint": MessageLookupByLibrary.simpleMessage("请输入密码"), 49 "inputPasswordHint": MessageLookupByLibrary.simpleMessage("请输入密码"),
48 "inputPhoneHint": MessageLookupByLibrary.simpleMessage("请输入手机号"), 50 "inputPhoneHint": MessageLookupByLibrary.simpleMessage("请输入手机号"),
49 "inputPhoneInvalid": MessageLookupByLibrary.simpleMessage("请输入有效的手机号"), 51 "inputPhoneInvalid": MessageLookupByLibrary.simpleMessage("请输入有效的手机号"),
...@@ -57,6 +59,7 @@ class MessageLookup extends MessageLookupByLibrary { ...@@ -57,6 +59,7 @@ class MessageLookup extends MessageLookupByLibrary {
57 MessageLookupByLibrary.simpleMessage("一言"), 59 MessageLookupByLibrary.simpleMessage("一言"),
58 "openYourAccount": MessageLookupByLibrary.simpleMessage("开启你的账号"), 60 "openYourAccount": MessageLookupByLibrary.simpleMessage("开启你的账号"),
59 "passwordLogin": MessageLookupByLibrary.simpleMessage("密码登录"), 61 "passwordLogin": MessageLookupByLibrary.simpleMessage("密码登录"),
62 + "privacy_policy": MessageLookupByLibrary.simpleMessage("隐私政策"),
60 "profileBottomNavigationBarItemTitle": 63 "profileBottomNavigationBarItemTitle":
61 MessageLookupByLibrary.simpleMessage("我在"), 64 MessageLookupByLibrary.simpleMessage("我在"),
62 "register": MessageLookupByLibrary.simpleMessage("注册"), 65 "register": MessageLookupByLibrary.simpleMessage("注册"),
...@@ -66,6 +69,7 @@ class MessageLookup extends MessageLookupByLibrary { ...@@ -66,6 +69,7 @@ class MessageLookup extends MessageLookupByLibrary {
66 "timelineBottomNavigationBarItemTitle": 69 "timelineBottomNavigationBarItemTitle":
67 MessageLookupByLibrary.simpleMessage("临境"), 70 MessageLookupByLibrary.simpleMessage("临境"),
68 "title": MessageLookupByLibrary.simpleMessage("一言"), 71 "title": MessageLookupByLibrary.simpleMessage("一言"),
72 + "user_agreement": MessageLookupByLibrary.simpleMessage("用户协议"),
69 "verificationButton": 73 "verificationButton":
70 MessageLookupByLibrary.simpleMessage("并没有真正发送哦,直接登录吧!"), 74 MessageLookupByLibrary.simpleMessage("并没有真正发送哦,直接登录吧!"),
71 "verificationCodeLogin": MessageLookupByLibrary.simpleMessage("验证码登录") 75 "verificationCodeLogin": MessageLookupByLibrary.simpleMessage("验证码登录")
......
...@@ -160,6 +160,16 @@ class S { ...@@ -160,6 +160,16 @@ class S {
160 ); 160 );
161 } 161 }
162 162
163 + /// `Please enter email address`
164 + String get inputEmailHint {
165 + return Intl.message(
166 + 'Please enter email address',
167 + name: 'inputEmailHint',
168 + desc: 'Please enter email address',
169 + args: [],
170 + );
171 + }
172 +
163 /// `Please enter verification code` 173 /// `Please enter verification code`
164 String get inputVerificationCodeHint { 174 String get inputVerificationCodeHint {
165 return Intl.message( 175 return Intl.message(
...@@ -379,6 +389,36 @@ class S { ...@@ -379,6 +389,36 @@ class S {
379 args: [], 389 args: [],
380 ); 390 );
381 } 391 }
392 +
393 + /// `Agreement`
394 + String get agreement {
395 + return Intl.message(
396 + 'Agreement',
397 + name: 'agreement',
398 + desc: 'Agreement',
399 + args: [],
400 + );
401 + }
402 +
403 + /// `User Agreement`
404 + String get user_agreement {
405 + return Intl.message(
406 + 'User Agreement',
407 + name: 'user_agreement',
408 + desc: 'User Agreement',
409 + args: [],
410 + );
411 + }
412 +
413 + /// `Privacy Policy`
414 + String get privacy_policy {
415 + return Intl.message(
416 + 'Privacy Policy',
417 + name: 'privacy_policy',
418 + desc: 'Privacy Policy',
419 + args: [],
420 + );
421 + }
382 } 422 }
383 423
384 class AppLocalizationDelegate extends LocalizationsDelegate<S> { 424 class AppLocalizationDelegate extends LocalizationsDelegate<S> {
......
...@@ -66,6 +66,12 @@ ...@@ -66,6 +66,12 @@
66 "type": "text", 66 "type": "text",
67 "placeholders": {} 67 "placeholders": {}
68 }, 68 },
69 + "inputEmailHint": "Please enter email address",
70 + "@inputEmailHint": {
71 + "description": "Please enter email address",
72 + "type": "text",
73 + "placeholders": {}
74 + },
69 "inputVerificationCodeHint": "Please enter verification code", 75 "inputVerificationCodeHint": "Please enter verification code",
70 "@inputVerificationCodeHint": { 76 "@inputVerificationCodeHint": {
71 "description": "Please enter verification code", 77 "description": "Please enter verification code",
...@@ -197,5 +203,23 @@ ...@@ -197,5 +203,23 @@
197 "description": "Birthday", 203 "description": "Birthday",
198 "type": "text", 204 "type": "text",
199 "placeholders": {} 205 "placeholders": {}
206 + },
207 + "agreement": "Agreement",
208 + "@agreement": {
209 + "description": "Agreement",
210 + "type": "text",
211 + "placeholders": {}
212 + },
213 + "user_agreement": "User Agreement",
214 + "@user_agreement": {
215 + "description": "User Agreement",
216 + "type": "text",
217 + "placeholders": {}
218 + },
219 + "privacy_policy": "Privacy Policy",
220 + "@privacy_policy": {
221 + "description": "Privacy Policy",
222 + "type": "text",
223 + "placeholders": {}
200 } 224 }
201 } 225 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
10 "register": "注册", 10 "register": "注册",
11 "openYourAccount": "开启你的账号", 11 "openYourAccount": "开启你的账号",
12 "inputPhoneHint": "请输入手机号", 12 "inputPhoneHint": "请输入手机号",
13 + "inputEmailHint": "请输入邮箱地址",
13 "inputVerificationCodeHint": "请输入验证码", 14 "inputVerificationCodeHint": "请输入验证码",
14 "inputPhoneInvalid": "请输入有效的手机号", 15 "inputPhoneInvalid": "请输入有效的手机号",
15 "verificationButton": "并没有真正发送哦,直接登录吧!", 16 "verificationButton": "并没有真正发送哦,直接登录吧!",
...@@ -17,20 +18,22 @@ ...@@ -17,20 +18,22 @@
17 "confirm": "确认", 18 "confirm": "确认",
18 "resetLoginPassword": "重置登录密码", 19 "resetLoginPassword": "重置登录密码",
19 "registeredTips": "提示:未注册账号的手机号,请先", 20 "registeredTips": "提示:未注册账号的手机号,请先",
20 - "onePoemBottomNavigationBarItemTitle" : "一言", 21 + "onePoemBottomNavigationBarItemTitle": "一言",
21 - "timelineBottomNavigationBarItemTitle" : "临境", 22 + "timelineBottomNavigationBarItemTitle": "临境",
22 - "categoryBottomNavigationBarItemTitle" : "众妙", 23 + "categoryBottomNavigationBarItemTitle": "众妙",
23 "profileBottomNavigationBarItemTitle" : "我在", 24 "profileBottomNavigationBarItemTitle" : "我在",
24 - 25 + "accountEditPageUserInfo": "个人信息",
25 - "accountEditPageUserInfo" : "个人信息", 26 + "accountEditPageUserName": "姓名",
26 - "accountEditPageUserName" : "姓名", 27 + "accountEditPageUserNamePlaceholder": "请输入您的名称",
27 - "accountEditPageUserNamePlaceholder" : "请输入您的名称", 28 + "accountEditPageUserEmail": "邮箱",
28 - "accountEditPageUserEmail" : "邮箱", 29 + "accountEditPageUserEmailPlaceholder": "请输入您的邮箱",
29 - "accountEditPageUserEmailPlaceholder" : "请输入您的邮箱", 30 + "accountEditPageUserPhone": "手机号",
30 - "accountEditPageUserPhone" : "手机号", 31 + "accountEditPageUserPhonePlaceholder": "请输入您的手机号",
31 - "accountEditPageUserPhonePlaceholder" : "请输入您的手机号", 32 + "accountEditPageUserGender": "性别",
32 - "accountEditPageUserGender" : "性别", 33 + "accountEditPageUserGenderPlaceholder": "请选择性别",
33 - "accountEditPageUserGenderPlaceholder" : "请选择性别", 34 + "accountEditPageUserBirthday": "出生日期",
34 - "accountEditPageUserBirthday" : "出生日期", 35 + "accountEditPageUserBirthdayPlaceholder": "请输入出生日期",
35 - "accountEditPageUserBirthdayPlaceholder" : "请输入出生日期" 36 + "agreement": "登录即代表同意并阅读",
37 + "user_agreement": "用户协议",
38 + "privacy_policy": "隐私政策"
36 } 39 }
...\ No newline at end of file ...\ No newline at end of file
......
1 import 'package:Parlando/net/dio_utils.dart'; 1 import 'package:Parlando/net/dio_utils.dart';
2 import 'package:Parlando/net/http_api.dart'; 2 import 'package:Parlando/net/http_api.dart';
3 +import 'package:Parlando/res/constant.dart';
4 +import 'package:Parlando/routers/fluro_navigator.dart';
5 +import 'package:Parlando/routers/routers.dart';
3 import 'package:email_validator/email_validator.dart'; 6 import 'package:email_validator/email_validator.dart';
7 +import 'package:flustars/flustars.dart';
4 import 'package:flutter/gestures.dart'; 8 import 'package:flutter/gestures.dart';
5 import 'package:flutter/material.dart'; 9 import 'package:flutter/material.dart';
6 import 'package:Parlando/home/webview_page.dart'; 10 import 'package:Parlando/home/webview_page.dart';
...@@ -15,6 +19,7 @@ import 'package:Parlando/widgets/my_scroll_view.dart'; ...@@ -15,6 +19,7 @@ import 'package:Parlando/widgets/my_scroll_view.dart';
15 19
16 import 'package:flutter_gen/gen_l10n/Parlando_localizations.dart'; 20 import 'package:flutter_gen/gen_l10n/Parlando_localizations.dart';
17 import 'package:Parlando/extension/int_extension.dart'; 21 import 'package:Parlando/extension/int_extension.dart';
22 +import 'package:getwidget/getwidget.dart';
18 23
19 /// design/1注册登录/index.html#artboard11 24 /// design/1注册登录/index.html#artboard11
20 class RegisterPage extends StatefulWidget { 25 class RegisterPage extends StatefulWidget {
...@@ -34,6 +39,7 @@ class _RegisterPageState extends State<RegisterPage> ...@@ -34,6 +39,7 @@ class _RegisterPageState extends State<RegisterPage>
34 final FocusNode _nodeText2 = FocusNode(); 39 final FocusNode _nodeText2 = FocusNode();
35 final FocusNode _nodeText3 = FocusNode(); 40 final FocusNode _nodeText3 = FocusNode();
36 bool _clickable = false; 41 bool _clickable = false;
42 + bool _isLoading = false;
37 43
38 @override 44 @override
39 Map<ChangeNotifier, List<VoidCallback>?>? changeNotifier() { 45 Map<ChangeNotifier, List<VoidCallback>?>? changeNotifier() {
...@@ -70,6 +76,8 @@ class _RegisterPageState extends State<RegisterPage> ...@@ -70,6 +76,8 @@ class _RegisterPageState extends State<RegisterPage>
70 } 76 }
71 77
72 void _register() { 78 void _register() {
79 + _isLoading = true;
80 + setState(() {});
73 Map<String, String> params = <String, String>{ 81 Map<String, String> params = <String, String>{
74 "email": _nameController.text, 82 "email": _nameController.text,
75 "password": _passwordController.text, 83 "password": _passwordController.text,
...@@ -79,15 +87,24 @@ class _RegisterPageState extends State<RegisterPage> ...@@ -79,15 +87,24 @@ class _RegisterPageState extends State<RegisterPage>
79 Method.post, 87 Method.post,
80 HttpApi.register, 88 HttpApi.register,
81 params: params, 89 params: params,
82 - onSuccess: (data) {}, 90 + onSuccess: (data) {
83 - onError: (code, msg) {}, 91 + SpUtil.putString(Constant.userToken, "this is user token!");
92 + NavigatorUtils.push(context, Routes.home, clearStack: true);
93 + _isLoading = false;
94 + },
95 + onError: (code, msg) {
96 + Toast.show(msg);
97 + _isLoading = false;
98 + },
84 ); 99 );
85 } 100 }
86 101
87 @override 102 @override
88 Widget build(BuildContext context) { 103 Widget build(BuildContext context) {
89 return Scaffold( 104 return Scaffold(
90 - appBar: const MyAppBar(), 105 + appBar: const MyAppBar(
106 + isTransparent: true,
107 + ),
91 body: MyScrollView( 108 body: MyScrollView(
92 keyboardConfig: Utils.getKeyboardActionsConfig( 109 keyboardConfig: Utils.getKeyboardActionsConfig(
93 context, <FocusNode>[_nodeText1, _nodeText2, _nodeText3]), 110 context, <FocusNode>[_nodeText1, _nodeText2, _nodeText3]),
...@@ -111,7 +128,7 @@ class _RegisterPageState extends State<RegisterPage> ...@@ -111,7 +128,7 @@ class _RegisterPageState extends State<RegisterPage>
111 controller: _nameController, 128 controller: _nameController,
112 maxLength: 100, 129 maxLength: 100,
113 keyboardType: TextInputType.emailAddress, 130 keyboardType: TextInputType.emailAddress,
114 - hintText: ParlandoLocalizations.of(context).inputPhoneHint, 131 + hintText: ParlandoLocalizations.of(context).inputEmailHint,
115 ), 132 ),
116 Gaps.vGap8, 133 Gaps.vGap8,
117 MyTextField( 134 MyTextField(
...@@ -159,31 +176,35 @@ class _RegisterPageState extends State<RegisterPage> ...@@ -159,31 +176,35 @@ class _RegisterPageState extends State<RegisterPage>
159 Gaps.vGap8, 176 Gaps.vGap8,
160 Text.rich( 177 Text.rich(
161 TextSpan( 178 TextSpan(
162 - text: '登录即代表同意并阅读', 179 + text: ParlandoLocalizations.of(context).agreement,
163 style: const TextStyle(fontSize: 14, color: Color(0xFF999999)), 180 style: const TextStyle(fontSize: 14, color: Color(0xFF999999)),
164 children: [ 181 children: [
165 TextSpan( 182 TextSpan(
166 - text: '《用户协议》', 183 + text: '《${ParlandoLocalizations.of(context).user_agreement}》',
167 style: TextStyle(color: Theme.of(context).primaryColor), 184 style: TextStyle(color: Theme.of(context).primaryColor),
168 recognizer: TapGestureRecognizer() 185 recognizer: TapGestureRecognizer()
169 ..onTap = () { 186 ..onTap = () {
170 Navigator.of(context) 187 Navigator.of(context)
171 .push(MaterialPageRoute(builder: (context) { 188 .push(MaterialPageRoute(builder: (context) {
172 - return const WebViewPage( 189 + return WebViewPage(
173 - title: '《用户协议》', url: 'https://flutter.dev'); 190 + title:
191 + '《${ParlandoLocalizations.of(context).user_agreement}》',
192 + url: 'https://flutter.dev');
174 })); 193 }));
175 }, 194 },
176 ), 195 ),
177 - const TextSpan(text: ''), 196 + const TextSpan(text: ' & '),
178 TextSpan( 197 TextSpan(
179 - text: '《隐私政策》', 198 + text: '《${ParlandoLocalizations.of(context).privacy_policy}》',
180 style: TextStyle(color: Theme.of(context).primaryColor), 199 style: TextStyle(color: Theme.of(context).primaryColor),
181 recognizer: TapGestureRecognizer() 200 recognizer: TapGestureRecognizer()
182 ..onTap = () { 201 ..onTap = () {
183 Navigator.of(context) 202 Navigator.of(context)
184 .push(MaterialPageRoute(builder: (context) { 203 .push(MaterialPageRoute(builder: (context) {
185 - return const WebViewPage( 204 + return WebViewPage(
186 - title: '《隐私政策》', url: 'https://flutter.dev'); 205 + title:
206 + '《${ParlandoLocalizations.of(context).privacy_policy}》',
207 + url: 'https://flutter.dev');
187 })); 208 }));
188 }, 209 },
189 ), 210 ),
...@@ -192,9 +213,12 @@ class _RegisterPageState extends State<RegisterPage> ...@@ -192,9 +213,12 @@ class _RegisterPageState extends State<RegisterPage>
192 Gaps.vGap24, 213 Gaps.vGap24,
193 MyButton( 214 MyButton(
194 key: const Key('register'), 215 key: const Key('register'),
195 - onPressed: _clickable ? _register : null, 216 + onPressed: _clickable && !_isLoading ? _register : null,
196 text: ParlandoLocalizations.of(context).register, 217 text: ParlandoLocalizations.of(context).register,
197 - ) 218 + ),
219 + Container(
220 + child: _isLoading ? const GFLoader() : null,
221 + ),
198 ]; 222 ];
199 } 223 }
200 } 224 }
......
...@@ -488,6 +488,13 @@ packages: ...@@ -488,6 +488,13 @@ packages:
488 description: flutter 488 description: flutter
489 source: sdk 489 source: sdk
490 version: "0.0.0" 490 version: "0.0.0"
491 + getwidget:
492 + dependency: "direct main"
493 + description:
494 + name: getwidget
495 + url: "https://pub.flutter-io.cn"
496 + source: hosted
497 + version: "2.0.5"
491 glob: 498 glob:
492 dependency: transitive 499 dependency: transitive
493 description: 500 description:
......
...@@ -108,6 +108,8 @@ dependencies: ...@@ -108,6 +108,8 @@ dependencies:
108 pausable_timer: ^1.0.0+3 108 pausable_timer: ^1.0.0+3
109 email_validator: ^2.0.1 109 email_validator: ^2.0.1
110 110
111 + getwidget: ^2.0.5
112 +
111 dependency_overrides: 113 dependency_overrides:
112 decimal: 1.5.0 114 decimal: 1.5.0
113 115
......