phase3: nullable fields/methods, casts, ?.call, condition fixes across 11 files. 108->72
This commit is contained in:
@@ -36,7 +36,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
late String accessToken;
|
||||
|
||||
late bool isLoading;
|
||||
late User _user;
|
||||
User? _user;
|
||||
|
||||
double sideSpace = 0;
|
||||
double mainSpace = 1200;
|
||||
@@ -81,9 +81,9 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
margin: EdgeInsets.only(right: 5.0),
|
||||
child: _user != null && _user.avatarUrl!.isNotEmpty
|
||||
child: _user != null && _user!.avatarUrl!.isNotEmpty
|
||||
? Util.showImage(
|
||||
'https:${_user.avatarUrl}',
|
||||
'https:${_user!.avatarUrl}',
|
||||
width: 60,
|
||||
height: 60,
|
||||
fit: BoxFit.fill,
|
||||
@@ -101,7 +101,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
),
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null ? _user.nickname : S.of(context).please_login,
|
||||
_user != null ? _user!.nickname! : S.of(context).please_login,
|
||||
style: TextStyle(
|
||||
color: Colors.black38,
|
||||
fontSize: 18.0,
|
||||
@@ -125,7 +125,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null
|
||||
? Utils.safePhoneNumber(_user.mobile!)
|
||||
? Utils.safePhoneNumber(_user!.mobile!)
|
||||
: '',
|
||||
style: TextStyle(
|
||||
color: Colors.black38,
|
||||
@@ -182,7 +182,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null
|
||||
? '${_user.wallet!.toStringAsFixed(2)}'
|
||||
? '${_user!.wallet!.toStringAsFixed(2)}'
|
||||
: '0.00',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
@@ -228,7 +228,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null ? '${_user.coupon}' : '0',
|
||||
_user != null ? '${_user!.coupon}' : '0',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
color: Colors.orangeAccent,
|
||||
@@ -262,7 +262,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
onTap: () {
|
||||
if (_user != null) {
|
||||
Routes.router.navigateTo(
|
||||
context, '/coupons/${_user.id}');
|
||||
context, '/coupons/${_user!.id}');
|
||||
} else {
|
||||
_pleaseLoginToast();
|
||||
}
|
||||
@@ -281,7 +281,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null ? '${_user.points}' : '0',
|
||||
_user != null ? '${_user!.points}' : '0',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
color: Colors.lightGreen,
|
||||
@@ -493,7 +493,7 @@ class DesktopMeState extends State<DesktopMe> {
|
||||
),
|
||||
),
|
||||
),
|
||||
onTap: tap!,
|
||||
onTap: () => tap(),
|
||||
),
|
||||
);
|
||||
return widget;
|
||||
|
||||
Reference in New Issue
Block a user