This commit is contained in:
2026-07-12 04:33:48 +08:00
parent f8a90ad305
commit e7ce0f7bae
151 changed files with 2765 additions and 2947 deletions

View File

@@ -1,9 +1,9 @@
import 'package:countdown/countdown.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:fluttertoast/fluttertoast.dart';
import '../../vendor/countdown/countdown.dart';
import '../../constants.dart';
import '../../generated/l10n.dart';
import '../../routes.dart';
@@ -11,7 +11,7 @@ import '../../utils/http_util.dart';
import '../../utils/utils.dart';
class MobileNewUser extends StatefulWidget {
const MobileNewUser({Key key}) : super(key: key);
const MobileNewUser({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() {
@@ -28,9 +28,9 @@ class MobileNewUserState extends State<MobileNewUser> {
bool usernameEnable = true;
final codeController = TextEditingController();
bool enableGetCode;
String getCodeText;
bool canRegister;
bool enableGetCode = false;
String? getCodeText;
bool canRegister = false;
var countDownListener;
@@ -87,8 +87,8 @@ class MobileNewUserState extends State<MobileNewUser> {
fontSize: 18.0
),
autofocus: true,
validator: (String value) {
if (value.trim().isEmpty) {
validator: (String? value) {
if (value == null || value.trim().isEmpty) {
return S.of(context).mobile_or_email_is_required;
}
return null;
@@ -155,7 +155,7 @@ class MobileNewUserState extends State<MobileNewUser> {
borderRadius: BorderRadius.all(Radius.circular(10.0)),
),
child: Text(
getCodeText,
'${getCodeText}',
style: TextStyle(
color: enableGetCode ? Colors.black87 : Colors.black26,
fontSize: 14.0
@@ -170,8 +170,8 @@ class MobileNewUserState extends State<MobileNewUser> {
style: TextStyle(
fontSize: 18.0
),
validator: (String value) {
if (value.trim().isEmpty) {
validator: (String? value) {
if (value == null || value.trim().isEmpty) {
return S.of(context).verification_code_is_required;
}
return null;
@@ -203,7 +203,7 @@ class MobileNewUserState extends State<MobileNewUser> {
alignment: Alignment.centerRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
child: Text(
S.of(context).register,
@@ -236,8 +236,8 @@ class MobileNewUserState extends State<MobileNewUser> {
}
void register() {
final FormState form = _formKey.currentState;
if (form.validate()) {
final FormState? form = _formKey.currentState;
if (form != null && form.validate()) {
HttpUtil.httpPost('v1/users', (response) {
Routes.router.navigateTo(context, '/set-password/${usernameController.text.trim()}/${codeController.text.trim()}', replace: true);
},