final
This commit is contained in:
@@ -20,14 +20,13 @@ import '../../utils/util_web.dart'
|
||||
if (dart.library.io) '../../utils/util_io.dart';
|
||||
import '../../utils/utils.dart';
|
||||
|
||||
MediaQueryData mediaQuery;
|
||||
double statusBarHeight;
|
||||
double screenHeight;
|
||||
MediaQueryData? mediaQuery;
|
||||
double? statusBarHeight;
|
||||
double? screenHeight;
|
||||
|
||||
class MobileMe extends StatefulWidget {
|
||||
final Key key;
|
||||
|
||||
const MobileMe({this.key}) : super(key: key);
|
||||
const MobileMe({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<StatefulWidget> createState() {
|
||||
@@ -36,18 +35,18 @@ class MobileMe extends StatefulWidget {
|
||||
}
|
||||
|
||||
class MobileMeState extends State<MobileMe> {
|
||||
int userId;
|
||||
String accessToken;
|
||||
int? userId;
|
||||
String? accessToken;
|
||||
|
||||
bool isLoading;
|
||||
User _user;
|
||||
bool isLoading = false;
|
||||
User? _user;
|
||||
|
||||
ShopScrollCoordinator _shopCoordinator;
|
||||
ShopScrollController _pageScrollController;
|
||||
ShopScrollCoordinator? _shopCoordinator;
|
||||
ShopScrollController? _pageScrollController;
|
||||
final double _sliverAppBarInitHeight = 165.0;
|
||||
final double _appBarHeight = 85.0;
|
||||
|
||||
ShopScrollController _listScrollController1;
|
||||
ShopScrollController? _listScrollController1;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -65,16 +64,16 @@ class MobileMeState extends State<MobileMe> {
|
||||
}
|
||||
|
||||
mediaQuery ??= MediaQuery.of(context);
|
||||
screenHeight ??= mediaQuery.size.height;
|
||||
statusBarHeight ??= mediaQuery.padding.top;
|
||||
screenHeight ??= mediaQuery!.size.height;
|
||||
statusBarHeight ??= mediaQuery!.padding.top;
|
||||
|
||||
_pageScrollController ??=
|
||||
_shopCoordinator.pageScrollController(_sliverAppBarInitHeight * -1.0);
|
||||
_shopCoordinator.pinnedHeaderSliverHeightBuilder ??= () {
|
||||
return statusBarHeight + kToolbarHeight + _appBarHeight;
|
||||
_shopCoordinator!.pageScrollController(_sliverAppBarInitHeight * -1.0);
|
||||
_shopCoordinator!.pinnedHeaderSliverHeightBuilder ??= () {
|
||||
return statusBarHeight! + kToolbarHeight + _appBarHeight;
|
||||
};
|
||||
|
||||
_listScrollController1 = _shopCoordinator.newChildScrollController();
|
||||
_listScrollController1 = _shopCoordinator?.newChildScrollController();
|
||||
|
||||
Widget userInfo = GestureDetector(
|
||||
child: Container(
|
||||
@@ -88,9 +87,9 @@ class MobileMeState extends State<MobileMe> {
|
||||
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,
|
||||
@@ -116,7 +115,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null
|
||||
? _user.nickname
|
||||
? _user!.nickname
|
||||
: S.of(context).please_login,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).scaffoldBackgroundColor,
|
||||
@@ -142,7 +141,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null
|
||||
? Utils.safePhoneNumber(_user.mobile)
|
||||
? Utils.safePhoneNumber(_user!.mobile)
|
||||
: '',
|
||||
style: TextStyle(
|
||||
color:
|
||||
@@ -180,7 +179,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
);
|
||||
|
||||
Listener listener = Listener(
|
||||
onPointerUp: _shopCoordinator.onPointerUp,
|
||||
onPointerUp: _shopCoordinator?.onPointerUp,
|
||||
child: CustomScrollView(
|
||||
controller: _pageScrollController,
|
||||
physics: ClampingScrollPhysics(),
|
||||
@@ -219,7 +218,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null
|
||||
? '${_user.wallet.toStringAsFixed(2)}'
|
||||
? '${_user!.wallet.toStringAsFixed(2)}'
|
||||
: '0.00',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
@@ -262,7 +261,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null ? '${_user.coupon}' : '0',
|
||||
_user != null ? '${_user!.coupon}' : '0',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
color: Colors.orangeAccent,
|
||||
@@ -296,7 +295,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
onTap: () {
|
||||
if (_user != null) {
|
||||
Routes.router
|
||||
.navigateTo(context, '/coupons/${_user.id}');
|
||||
.navigateTo(context, '/coupons/${_user!.id}');
|
||||
} else {
|
||||
_pleaseLoginToast();
|
||||
}
|
||||
@@ -312,7 +311,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
children: <Widget>[
|
||||
Container(
|
||||
child: Text(
|
||||
_user != null ? '${_user.points}' : '0',
|
||||
_user != null ? '${_user!.points}' : '0',
|
||||
style: TextStyle(
|
||||
fontSize: 24.0,
|
||||
color: Colors.lightGreen,
|
||||
@@ -350,7 +349,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
controller: _listScrollController1,
|
||||
itemCount: 7,
|
||||
itemBuilder: (BuildContext context, int i) {
|
||||
Widget item;
|
||||
Widget? item;
|
||||
switch (i) {
|
||||
case 0:
|
||||
item = GestureDetector(
|
||||
@@ -671,7 +670,7 @@ class MobileMeState extends State<MobileMe> {
|
||||
),
|
||||
onTap: () {
|
||||
if (_user != null) {
|
||||
if (_user.email == null || _user.email.isEmpty) {
|
||||
if (_user!.email == null || _user!.email.isEmpty) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
@@ -687,7 +686,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,
|
||||
),
|
||||
@@ -816,9 +815,9 @@ class MobileMeState extends State<MobileMe> {
|
||||
|
||||
class _SliverAppBarDelegate extends SliverPersistentHeaderDelegate {
|
||||
_SliverAppBarDelegate({
|
||||
@required this.minHeight,
|
||||
@required this.maxHeight,
|
||||
@required this.child,
|
||||
required this.minHeight,
|
||||
required this.maxHeight,
|
||||
required this.child,
|
||||
});
|
||||
|
||||
final double minHeight;
|
||||
|
||||
Reference in New Issue
Block a user