Commit f5fc01c1b290b53d444e8df919ca8a8aacfec38c
1 parent
210d15e0
feat:修复首页进入个人信息页闪退问题
Showing
3 changed files
with
11 additions
and
7 deletions
ios/Runner.xcodeproj/project.pbxproj
| @@ -511,7 +511,7 @@ | @@ -511,7 +511,7 @@ | ||
| 511 | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; | 511 | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; |
| 512 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | 512 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; |
| 513 | SWIFT_VERSION = 5.0; | 513 | SWIFT_VERSION = 5.0; |
| 514 | - TARGETED_DEVICE_FAMILY = 1; | 514 | + TARGETED_DEVICE_FAMILY = "1,2"; |
| 515 | VERSIONING_SYSTEM = "apple-generic"; | 515 | VERSIONING_SYSTEM = "apple-generic"; |
| 516 | }; | 516 | }; |
| 517 | name = Profile; | 517 | name = Profile; |
| @@ -697,7 +697,7 @@ | @@ -697,7 +697,7 @@ | ||
| 697 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | 697 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; |
| 698 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; | 698 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; |
| 699 | SWIFT_VERSION = 5.0; | 699 | SWIFT_VERSION = 5.0; |
| 700 | - TARGETED_DEVICE_FAMILY = 1; | 700 | + TARGETED_DEVICE_FAMILY = "1,2"; |
| 701 | VERSIONING_SYSTEM = "apple-generic"; | 701 | VERSIONING_SYSTEM = "apple-generic"; |
| 702 | }; | 702 | }; |
| 703 | name = Debug; | 703 | name = Debug; |
| @@ -725,7 +725,7 @@ | @@ -725,7 +725,7 @@ | ||
| 725 | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; | 725 | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; |
| 726 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; | 726 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; |
| 727 | SWIFT_VERSION = 5.0; | 727 | SWIFT_VERSION = 5.0; |
| 728 | - TARGETED_DEVICE_FAMILY = 1; | 728 | + TARGETED_DEVICE_FAMILY = "1,2"; |
| 729 | VERSIONING_SYSTEM = "apple-generic"; | 729 | VERSIONING_SYSTEM = "apple-generic"; |
| 730 | }; | 730 | }; |
| 731 | name = Release; | 731 | name = Release; |
lib/pages/home/home_page.dart
| 1 | import 'package:flutter/material.dart'; | 1 | import 'package:flutter/material.dart'; |
| 2 | import 'package:flutter_bloc/flutter_bloc.dart'; | 2 | import 'package:flutter_bloc/flutter_bloc.dart'; |
| 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; | 3 | import 'package:flutter_screenutil/flutter_screenutil.dart'; |
| 4 | +import 'package:wow_english/app/app.dart'; | ||
| 5 | +import 'package:wow_english/common/core/user_util.dart'; | ||
| 4 | import 'package:wow_english/common/extension/string_extension.dart'; | 6 | import 'package:wow_english/common/extension/string_extension.dart'; |
| 5 | import 'package:wow_english/models/course_entity.dart'; | 7 | import 'package:wow_english/models/course_entity.dart'; |
| 6 | import 'package:wow_english/pages/home/widgets/home_bouns_item.dart'; | 8 | import 'package:wow_english/pages/home/widgets/home_bouns_item.dart'; |
| @@ -37,7 +39,11 @@ class _HomePageView extends StatelessWidget { | @@ -37,7 +39,11 @@ class _HomePageView extends StatelessWidget { | ||
| 37 | } else if (type == HeaderActionType.shop) { | 39 | } else if (type == HeaderActionType.shop) { |
| 38 | pushNamed(AppRouteName.shop); | 40 | pushNamed(AppRouteName.shop); |
| 39 | } else if (type == HeaderActionType.user) { | 41 | } else if (type == HeaderActionType.user) { |
| 40 | - pushNamed(AppRouteName.user); | 42 | + if(UserUtil.token.isEmpty) { |
| 43 | + pushNamed(AppRouteName.login); | ||
| 44 | + } else { | ||
| 45 | + pushNamed(AppRouteName.user); | ||
| 46 | + } | ||
| 41 | } else { | 47 | } else { |
| 42 | 48 | ||
| 43 | } | 49 | } |
lib/pages/user/user_page.dart
| @@ -18,14 +18,12 @@ class UserPage extends StatelessWidget { | @@ -18,14 +18,12 @@ class UserPage extends StatelessWidget { | ||
| 18 | Widget build(BuildContext context) { | 18 | Widget build(BuildContext context) { |
| 19 | return BlocProvider( | 19 | return BlocProvider( |
| 20 | create: (context) => UserBloc(), | 20 | create: (context) => UserBloc(), |
| 21 | - child: const _UserView(), | 21 | + child: _UserView(), |
| 22 | ); | 22 | ); |
| 23 | } | 23 | } |
| 24 | } | 24 | } |
| 25 | 25 | ||
| 26 | class _UserView extends StatelessWidget { | 26 | class _UserView extends StatelessWidget { |
| 27 | - const _UserView({super.key}); | ||
| 28 | - | ||
| 29 | final String bannerUrl = ''; | 27 | final String bannerUrl = ''; |
| 30 | 28 | ||
| 31 | @override | 29 | @override |