diff --git a/CHANGELOG.md b/CHANGELOG.md index e45ccc0c..e9b2deac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), - app:优化图片加载流程,加载更平滑。 - app:现在在头像加载失败时会使用本地默认的头像,避免头像一直空白。 - app:现在加载失败的头像更容易触发重新加载。 +- 登录:在登录界面显示注册账户的跳转链接。 ### Fixed diff --git a/lib/constants/url.dart b/lib/constants/url.dart index 66851d05..d46a6eec 100644 --- a/lib/constants/url.dart +++ b/lib/constants/url.dart @@ -9,6 +9,9 @@ const baseUrl = 'https://www.tsdm39.com'; /// Homepage of tsdm. const homePage = '$baseUrl/forum.php'; +/// Page to register new account +const signUpPage = '$baseUrl/member.php?mod=register.php'; + /// User profile page for user with given uid. const uidProfilePage = '$baseUrl/home.php?mod=space&uid='; diff --git a/lib/features/authentication/widgets/login_form.dart b/lib/features/authentication/widgets/login_form.dart index 7189902b..28abd9d7 100644 --- a/lib/features/authentication/widgets/login_form.dart +++ b/lib/features/authentication/widgets/login_form.dart @@ -2,6 +2,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:go_router/go_router.dart'; import 'package:tsdm_client/constants/layout.dart'; +import 'package:tsdm_client/constants/url.dart'; +import 'package:tsdm_client/extensions/build_context.dart'; import 'package:tsdm_client/features/authentication/bloc/authentication_bloc.dart'; import 'package:tsdm_client/features/authentication/repository/models/models.dart'; import 'package:tsdm_client/features/authentication/widgets/captcha_image.dart'; @@ -237,16 +239,23 @@ class _LoginFormState extends State with LoggerMixin { : tr.answerEmpty, ), sizedBoxW12H12, - Row( - children: [ - Expanded( - child: DebounceFilledButton( - shouldDebounce: pending, - onPressed: () async => _login(context, loginField, state), - child: Text(tr.login), - ), + DebounceFilledButton( + shouldDebounce: pending, + onPressed: () async => _login(context, loginField, state), + child: Text(tr.login), + ), + sizedBoxW12H12, + Center( + child: TextButton( + child: Text( + tr.signUpHint, + style: const TextStyle(decoration: TextDecoration.underline), ), - ], + onPressed: () async => context.dispatchAsUrl( + signUpPage, + external: true, + ), + ), ), ], ), diff --git a/lib/i18n/strings.i18n.json b/lib/i18n/strings.i18n.json index c33cc3d3..755e30b4 100644 --- a/lib/i18n/strings.i18n.json +++ b/lib/i18n/strings.i18n.json @@ -204,7 +204,8 @@ "username": "Username", "uid": "UID", "email": "Email" - } + }, + "signUpHint": "Do not have an account? Sign up here" }, "rootPage": { "initFailed": "Init failed: $err", diff --git a/lib/i18n/strings_zh-CN.i18n.json b/lib/i18n/strings_zh-CN.i18n.json index 02a2f8a2..8dba5227 100644 --- a/lib/i18n/strings_zh-CN.i18n.json +++ b/lib/i18n/strings_zh-CN.i18n.json @@ -204,7 +204,8 @@ "username": "用户名", "uid": "UID", "email": "邮箱" - } + }, + "signUpHint": "没有账号?点此注册" }, "rootPage": { "initFailed": "初始化失败: $err", diff --git a/lib/i18n/strings_zh-TW.i18n.json b/lib/i18n/strings_zh-TW.i18n.json index 8e7d7738..3ef8fd09 100644 --- a/lib/i18n/strings_zh-TW.i18n.json +++ b/lib/i18n/strings_zh-TW.i18n.json @@ -204,7 +204,8 @@ "username": "使用者名稱", "uid": "UID", "email": "信箱" - } + }, + "signUpHint": "沒有帳號?點此註冊" }, "rootPage": { "initFailed": "初始化失敗: $err",