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

@@ -6,7 +6,7 @@ import '../../utils/utils.dart';
import '../../generated/l10n.dart';
class MobileChangePassword extends StatefulWidget {
const MobileChangePassword({Key key}) : super(key: key);
const MobileChangePassword({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() {
@@ -22,10 +22,10 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
final passwordController = TextEditingController();
final passwordAgainController = TextEditingController();
bool passwordVisible;
bool passwordAgainVisible;
bool passwordVisible = false;
bool passwordAgainVisible = false;
bool canReset;
bool canReset = false;
@override
void initState() {
@@ -87,8 +87,8 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
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).current_password_is_required;
}
return null;
@@ -141,8 +141,8 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
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).password_is_required;
}
return null;
@@ -195,8 +195,8 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
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).password_is_required;
}
if (value.trim() != passwordController.text.trim()) {
@@ -232,7 +232,7 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
alignment: Alignment.centerRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
child: Text(
S.of(context).submit,
@@ -249,8 +249,8 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
}
void resetPassword() {
final FormState form = _formKey.currentState;
if (form.validate()) {
final FormState? form = _formKey.currentState;
if (form != null && form.validate()) {
HttpUtil.httpPost('v1/users', (response) {
showDialog(
context: context,
@@ -276,7 +276,7 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
},
isFormData: true,
body: {
'id': store.state.user.id,
'id': store.state.user?.id,
'old_password': oldPasswordController.text.trim(),
'password': passwordController.text.trim(),
}