phase3: bulk null-safety fixes

- validator: (String value) -> (String? value) [30 files]
- ElevatedButton.styleFrom(primary:) -> backgroundColor: [31 files]
- global Key? param fix [129 files]
This commit is contained in:
2026-07-24 20:27:16 +08:00
parent e2f815e141
commit 1f85ae1e63
41 changed files with 107 additions and 107 deletions

View File

@@ -230,7 +230,7 @@ class CreateOnlineStore1State extends State<CreateOnlineStore1> {
fontSize: 18.0
),
autofocus: true,
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).domains_separated_comma;
}

View File

@@ -93,7 +93,7 @@ class MobileChangeMobileOrEmailState extends State<MobileChangeMobileOrEmail> {
fontSize: 18.0
),
autofocus: true,
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
if (widget.isMobile) {
return S
@@ -190,7 +190,7 @@ class MobileChangeMobileOrEmailState extends State<MobileChangeMobileOrEmail> {
style: TextStyle(
fontSize: 18.0
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).verification_code_is_required;
}
@@ -223,7 +223,7 @@ class MobileChangeMobileOrEmailState extends State<MobileChangeMobileOrEmail> {
alignment: Alignment.centerRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
child: Text(
S.of(context).submit_to_change,

View File

@@ -87,7 +87,7 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
style: TextStyle(
fontSize: 18.0
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).current_password_is_required;
}
@@ -141,7 +141,7 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
style: TextStyle(
fontSize: 18.0
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).password_is_required;
}
@@ -195,7 +195,7 @@ class MobileChangePasswordState extends State<MobileChangePassword> {
style: TextStyle(
fontSize: 18.0
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).password_is_required;
}
@@ -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,

View File

@@ -114,7 +114,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
child: Text(
S.of(context).ok,
@@ -1632,7 +1632,7 @@ class MobileCheckoutState extends State<MobileCheckout> with SingleTickerProvide
),
labelText: S.of(context).enter_coupon_code,
),
validator: (String value) {
validator: (String? value) {
return null;
},
),

View File

@@ -248,7 +248,7 @@ class MobileCouponsState extends State<MobileCoupons> {
Container(
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),

View File

@@ -109,7 +109,7 @@ class MobileEditAddressState extends State<MobileEditAddress> {
.of(context)
.contact_name,
),
validator: (String value) {
validator: (String? value) {
if (value
.trim()
.isEmpty) {
@@ -164,7 +164,7 @@ class MobileEditAddressState extends State<MobileEditAddress> {
.of(context)
.mobile_phone_number,
),
validator: (String value) {
validator: (String? value) {
if (value
.trim()
.isEmpty) {
@@ -196,7 +196,7 @@ class MobileEditAddressState extends State<MobileEditAddress> {
.of(context)
.street_line_1,
),
validator: (String value) {
validator: (String? value) {
if (value
.trim()
.isEmpty) {
@@ -250,7 +250,7 @@ class MobileEditAddressState extends State<MobileEditAddress> {
.of(context)
.city,
),
validator: (String value) {
validator: (String? value) {
if (value
.trim()
.isEmpty) {
@@ -320,7 +320,7 @@ class MobileEditAddressState extends State<MobileEditAddress> {
.of(context)
.postal_code,
),
validator: (String value) {
validator: (String? value) {
if (value
.trim()
.isEmpty) {
@@ -365,7 +365,7 @@ class MobileEditAddressState extends State<MobileEditAddress> {
.of(context)
.email,
),
validator: (String value) {
validator: (String? value) {
if (value.isNotEmpty && !EmailValidator.validate(value)) {
return S
.of(context)

View File

@@ -90,7 +90,7 @@ class MobileForgotPasswordState extends State<MobileForgotPassword> {
fontSize: 18.0
),
autofocus: true,
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).mobile_or_email_is_required;
}
@@ -173,7 +173,7 @@ class MobileForgotPasswordState extends State<MobileForgotPassword> {
style: TextStyle(
fontSize: 18.0
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).verification_code_is_required;
}
@@ -206,7 +206,7 @@ class MobileForgotPasswordState extends State<MobileForgotPassword> {
alignment: Alignment.centerRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
child: Text(
S.of(context).verify,

View File

@@ -103,7 +103,7 @@ class MobileLoginState extends State<MobileLogin> {
fontSize: 18.0
),
autofocus: true,
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).this_field_is_required;
}
@@ -143,7 +143,7 @@ class MobileLoginState extends State<MobileLogin> {
fontSize: 18.0
),
obscureText: passwordVisible,
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).password_is_required;
}
@@ -196,7 +196,7 @@ class MobileLoginState extends State<MobileLogin> {
padding: EdgeInsets.only(top: 20.0, left: 16.0, right: 16.0, bottom: 20.0),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
child: Text(
S.of(context).login,

View File

@@ -687,7 +687,7 @@ class MobileMeState extends State<MobileMe> {
),
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
textStyle: TextStyle(
color: Colors.white,
),

View File

@@ -96,7 +96,7 @@ class MobileNewAddressState extends State<MobileNewAddress> {
),
labelText: S.of(context).contact_name,
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).contact_name_is_required;
}
@@ -140,7 +140,7 @@ class MobileNewAddressState extends State<MobileNewAddress> {
),
labelText: S.of(context).mobile_phone_number,
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).mobile_phone_number_is_required;
}
@@ -165,7 +165,7 @@ class MobileNewAddressState extends State<MobileNewAddress> {
),
labelText: S.of(context).street_line_1,
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).street_line_1_is_required;
}
@@ -209,7 +209,7 @@ class MobileNewAddressState extends State<MobileNewAddress> {
),
labelText: S.of(context).city,
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).city_is_required;
}
@@ -255,7 +255,7 @@ class MobileNewAddressState extends State<MobileNewAddress> {
),
labelText: S.of(context).postal_code,
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).postal_code_is_required;
}
@@ -290,7 +290,7 @@ class MobileNewAddressState extends State<MobileNewAddress> {
),
labelText: S.of(context).email,
),
validator: (String value) {
validator: (String? value) {
if (value.isNotEmpty && !EmailValidator.validate(value)) {
return S.of(context).email_is_not_valid;
}

View File

@@ -210,7 +210,7 @@ class MobileNewCommentState extends State<MobileNewComment> {
Navigator.of(context).pop();
},
style: TextButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
),
TextButton(

View File

@@ -110,7 +110,7 @@ class MobileNewTicketState extends State<MobileNewTicket> {
fontSize: 18.0
),
autofocus: true,
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).this_field_is_required;
}
@@ -162,7 +162,7 @@ class MobileNewTicketState extends State<MobileNewTicket> {
padding: EdgeInsets.only(top: 20.0, left: 16.0, right: 16.0, bottom: 20.0),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
child: Text(
S.of(context).submit,
@@ -374,7 +374,7 @@ class MobileNewTicketState extends State<MobileNewTicket> {
ElevatedButton(
child: Text(S.of(context).yes_i_am_sure),
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
onPressed: () {
Navigator.of(context).pop();

View File

@@ -87,7 +87,7 @@ class MobileNewUserState extends State<MobileNewUser> {
fontSize: 18.0
),
autofocus: true,
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).mobile_or_email_is_required;
}
@@ -170,7 +170,7 @@ class MobileNewUserState extends State<MobileNewUser> {
style: TextStyle(
fontSize: 18.0
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).verification_code_is_required;
}
@@ -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,

View File

@@ -1145,7 +1145,7 @@ class MobileOrderDetailState extends State<MobileOrderDetail> {
S.of(context).no,
),
style: TextButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
onPressed: () {
Navigator.of(context).pop();

View File

@@ -234,7 +234,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
),
),
style: ElevatedButton.styleFrom(
primary: Colors.redAccent,
backgroundColor: Colors.redAccent,
),
onPressed: () {
Routes.router.navigateTo(context, '/paynow/${order.id}');
@@ -249,7 +249,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
),
),
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
onPressed: () {
Utils.orderAgain(context, order.cartInfo);
@@ -266,7 +266,7 @@ class MobileOrdersState extends State<MobileOrders> with SingleTickerProviderSta
),
),
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
onPressed: () {
Utils.orderAgain(context, order.cartInfo);

View File

@@ -96,7 +96,7 @@ class MobileRenewLicenseState extends State<MobileRenewLicense> {
fontSize: 18.0
),
autofocus: true,
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).please_enter_group_number;
}

View File

@@ -104,7 +104,7 @@ class MobileResetPasswordState extends State<MobileResetPassword> {
style: TextStyle(
fontSize: 18.0
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).password_is_required;
}
@@ -158,7 +158,7 @@ class MobileResetPasswordState extends State<MobileResetPassword> {
style: TextStyle(
fontSize: 18.0
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).password_is_required;
}
@@ -195,7 +195,7 @@ class MobileResetPasswordState extends State<MobileResetPassword> {
alignment: Alignment.centerRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
child: Text(
S.of(context).submit,

View File

@@ -105,7 +105,7 @@ class MobileSetPasswordState extends State<MobileSetPassword> {
style: TextStyle(
fontSize: 18.0
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).password_is_required;
}
@@ -159,7 +159,7 @@ class MobileSetPasswordState extends State<MobileSetPassword> {
style: TextStyle(
fontSize: 18.0
),
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).password_is_required;
}
@@ -196,7 +196,7 @@ class MobileSetPasswordState extends State<MobileSetPassword> {
alignment: Alignment.centerRight,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
child: Text(
S.of(context).submit,

View File

@@ -392,7 +392,7 @@ class MobileUserProfileState extends State<MobileUserProfile> {
fontSize: 18.0
),
autofocus: true,
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).nickname_is_required;
}

View File

@@ -293,7 +293,7 @@ class MobileViewTicketState extends State<MobileViewTicket> {
fontSize: 18.0
),
autofocus: false,
validator: (String value) {
validator: (String? value) {
if (value.trim().isEmpty) {
return S.of(context).this_field_is_required;
}
@@ -338,7 +338,7 @@ class MobileViewTicketState extends State<MobileViewTicket> {
padding: EdgeInsets.only(top: 20.0, left: 16.0, right: 16.0, bottom: 20.0),
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
child: Text(
S.of(context).reply,
@@ -641,7 +641,7 @@ class MobileViewTicketState extends State<MobileViewTicket> {
ElevatedButton(
child: Text(S.of(context).yes_i_am_sure),
style: ElevatedButton.styleFrom(
primary: Theme.of(context).primaryColor,
backgroundColor: Theme.of(context).primaryColor,
),
onPressed: () {
Navigator.of(context).pop();