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 | 511 | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; |
| 512 | 512 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; |
| 513 | 513 | SWIFT_VERSION = 5.0; |
| 514 | - TARGETED_DEVICE_FAMILY = 1; | |
| 514 | + TARGETED_DEVICE_FAMILY = "1,2"; | |
| 515 | 515 | VERSIONING_SYSTEM = "apple-generic"; |
| 516 | 516 | }; |
| 517 | 517 | name = Profile; |
| ... | ... | @@ -697,7 +697,7 @@ |
| 697 | 697 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; |
| 698 | 698 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; |
| 699 | 699 | SWIFT_VERSION = 5.0; |
| 700 | - TARGETED_DEVICE_FAMILY = 1; | |
| 700 | + TARGETED_DEVICE_FAMILY = "1,2"; | |
| 701 | 701 | VERSIONING_SYSTEM = "apple-generic"; |
| 702 | 702 | }; |
| 703 | 703 | name = Debug; |
| ... | ... | @@ -725,7 +725,7 @@ |
| 725 | 725 | SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; |
| 726 | 726 | SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; |
| 727 | 727 | SWIFT_VERSION = 5.0; |
| 728 | - TARGETED_DEVICE_FAMILY = 1; | |
| 728 | + TARGETED_DEVICE_FAMILY = "1,2"; | |
| 729 | 729 | VERSIONING_SYSTEM = "apple-generic"; |
| 730 | 730 | }; |
| 731 | 731 | name = Release; | ... | ... |
lib/pages/home/home_page.dart
| 1 | 1 | import 'package:flutter/material.dart'; |
| 2 | 2 | import 'package:flutter_bloc/flutter_bloc.dart'; |
| 3 | 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 | 6 | import 'package:wow_english/common/extension/string_extension.dart'; |
| 5 | 7 | import 'package:wow_english/models/course_entity.dart'; |
| 6 | 8 | import 'package:wow_english/pages/home/widgets/home_bouns_item.dart'; |
| ... | ... | @@ -37,7 +39,11 @@ class _HomePageView extends StatelessWidget { |
| 37 | 39 | } else if (type == HeaderActionType.shop) { |
| 38 | 40 | pushNamed(AppRouteName.shop); |
| 39 | 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 | 47 | } else { |
| 42 | 48 | |
| 43 | 49 | } | ... | ... |
lib/pages/user/user_page.dart
| ... | ... | @@ -18,14 +18,12 @@ class UserPage extends StatelessWidget { |
| 18 | 18 | Widget build(BuildContext context) { |
| 19 | 19 | return BlocProvider( |
| 20 | 20 | create: (context) => UserBloc(), |
| 21 | - child: const _UserView(), | |
| 21 | + child: _UserView(), | |
| 22 | 22 | ); |
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | class _UserView extends StatelessWidget { |
| 27 | - const _UserView({super.key}); | |
| 28 | - | |
| 29 | 27 | final String bannerUrl = ''; |
| 30 | 28 | |
| 31 | 29 | @override | ... | ... |