Commit 50197839933f5b9dedc76ff918d3599a49332069
1 parent
f6e620e4
选择联系人插件 iOS版本修复 && iOS返回手势拦截不生效 && iOS 小程序样式 OK
Showing
16 changed files
with
41 additions
and
86 deletions
| @@ -449,7 +449,7 @@ | @@ -449,7 +449,7 @@ | ||
| 449 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | 449 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 450 | CLANG_ENABLE_MODULES = YES; | 450 | CLANG_ENABLE_MODULES = YES; |
| 451 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | 451 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
| 452 | - CURRENT_PROJECT_VERSION = 5504; | 452 | + CURRENT_PROJECT_VERSION = 5505; |
| 453 | DEVELOPMENT_TEAM = 8J59HM8B82; | 453 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 454 | ENABLE_BITCODE = NO; | 454 | ENABLE_BITCODE = NO; |
| 455 | INFOPLIST_FILE = Runner/Info.plist; | 455 | INFOPLIST_FILE = Runner/Info.plist; |
| @@ -632,7 +632,7 @@ | @@ -632,7 +632,7 @@ | ||
| 632 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | 632 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 633 | CLANG_ENABLE_MODULES = YES; | 633 | CLANG_ENABLE_MODULES = YES; |
| 634 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | 634 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
| 635 | - CURRENT_PROJECT_VERSION = 5504; | 635 | + CURRENT_PROJECT_VERSION = 5505; |
| 636 | DEVELOPMENT_TEAM = 8J59HM8B82; | 636 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 637 | ENABLE_BITCODE = NO; | 637 | ENABLE_BITCODE = NO; |
| 638 | INFOPLIST_FILE = Runner/Info.plist; | 638 | INFOPLIST_FILE = Runner/Info.plist; |
| @@ -658,7 +658,7 @@ | @@ -658,7 +658,7 @@ | ||
| 658 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; | 658 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; |
| 659 | CLANG_ENABLE_MODULES = YES; | 659 | CLANG_ENABLE_MODULES = YES; |
| 660 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; | 660 | CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements; |
| 661 | - CURRENT_PROJECT_VERSION = 5504; | 661 | + CURRENT_PROJECT_VERSION = 5505; |
| 662 | DEVELOPMENT_TEAM = 8J59HM8B82; | 662 | DEVELOPMENT_TEAM = 8J59HM8B82; |
| 663 | ENABLE_BITCODE = NO; | 663 | ENABLE_BITCODE = NO; |
| 664 | INFOPLIST_FILE = Runner/Info.plist; | 664 | INFOPLIST_FILE = Runner/Info.plist; |
| @@ -52,6 +52,7 @@ import 'package:flutter/material.dart'; | @@ -52,6 +52,7 @@ import 'package:flutter/material.dart'; | ||
| 52 | 52 | ||
| 53 | import 'package:permission_handler/permission_handler.dart'; | 53 | import 'package:permission_handler/permission_handler.dart'; |
| 54 | import 'package:flutter_localizations/flutter_localizations.dart'; | 54 | import 'package:flutter_localizations/flutter_localizations.dart'; |
| 55 | +import 'package:pop_scope_page_transitions/pop_scope_page_transitions.dart'; | ||
| 55 | // import 'package:xbr_gaode_amap/xbr_gaode_amap.dart'; | 56 | // import 'package:xbr_gaode_amap/xbr_gaode_amap.dart'; |
| 56 | // import 'package:flutter_wxwork/flutter_wxwork.dart'; | 57 | // import 'package:flutter_wxwork/flutter_wxwork.dart'; |
| 57 | 58 | ||
| @@ -180,7 +181,7 @@ class MyAppState extends State<MyApp> { | @@ -180,7 +181,7 @@ class MyAppState extends State<MyApp> { | ||
| 180 | 181 | ||
| 181 | //初始化微信SDK | 182 | //初始化微信SDK |
| 182 | _initFluwx() async { | 183 | _initFluwx() async { |
| 183 | - Fluwx fluwx = Fluwx(); | 184 | + Fluwx fluwx = Fluwx(); |
| 184 | await fluwx.registerApi( | 185 | await fluwx.registerApi( |
| 185 | // appId: "wx85aa3cdd0f791e65", | 186 | // appId: "wx85aa3cdd0f791e65", |
| 186 | appId: "wx4d105e36a36a6139", | 187 | appId: "wx4d105e36a36a6139", |
| @@ -297,6 +298,12 @@ class MyAppState extends State<MyApp> { | @@ -297,6 +298,12 @@ class MyAppState extends State<MyApp> { | ||
| 297 | Locale('en', 'US'), | 298 | Locale('en', 'US'), |
| 298 | ], | 299 | ], |
| 299 | theme: ThemeData( | 300 | theme: ThemeData( |
| 301 | + pageTransitionsTheme: const PageTransitionsTheme( | ||
| 302 | + builders: { | ||
| 303 | + // TargetPlatform.android: PopScopePageTransitionsBuilder(), | ||
| 304 | + TargetPlatform.iOS: PopScopePageTransitionsBuilder(), | ||
| 305 | + }, | ||
| 306 | + ), | ||
| 300 | useMaterial3: false, | 307 | useMaterial3: false, |
| 301 | brightness: Brightness.light, | 308 | brightness: Brightness.light, |
| 302 | primaryColor: Colors.white, | 309 | primaryColor: Colors.white, |
| @@ -29,7 +29,7 @@ import 'package:one_key/utils/event_bus.dart'; | @@ -29,7 +29,7 @@ import 'package:one_key/utils/event_bus.dart'; | ||
| 29 | 29 | ||
| 30 | import '../../app.dart'; | 30 | import '../../app.dart'; |
| 31 | import '../../utils/common_utils.dart'; | 31 | import '../../utils/common_utils.dart'; |
| 32 | -import '../../utils/my_will_pop_scope.dart'; | 32 | + |
| 33 | 33 | ||
| 34 | class HandleOnlinePage extends StatefulWidget { | 34 | class HandleOnlinePage extends StatefulWidget { |
| 35 | final String rid; | 35 | final String rid; |
| @@ -416,7 +416,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | @@ -416,7 +416,7 @@ class HandleOnlinePageState extends State<HandleOnlinePage> { | ||
| 416 | }, | 416 | }, |
| 417 | ), | 417 | ), |
| 418 | body: SafeArea( | 418 | body: SafeArea( |
| 419 | - child: MyWillPopScope( | 419 | + child: WillPopScope( |
| 420 | child: Consumer<NotebookDetailModel>(builder: (context, model, _) { | 420 | child: Consumer<NotebookDetailModel>(builder: (context, model, _) { |
| 421 | if (model.pageStateChange!= PageState.Success) { | 421 | if (model.pageStateChange!= PageState.Success) { |
| 422 | return ExceptionPage( | 422 | return ExceptionPage( |
| @@ -63,7 +63,7 @@ import '../../provider/collect_store_provider.dart'; | @@ -63,7 +63,7 @@ import '../../provider/collect_store_provider.dart'; | ||
| 63 | import '../../provider/notebook_detail_model.dart'; | 63 | import '../../provider/notebook_detail_model.dart'; |
| 64 | import '../../provider/personnel_provider.dart'; | 64 | import '../../provider/personnel_provider.dart'; |
| 65 | import '../../provider/upload_img_provider.dart'; | 65 | import '../../provider/upload_img_provider.dart'; |
| 66 | -import '../../utils/my_will_pop_scope.dart'; | 66 | + |
| 67 | import '../../utils/screen_util.dart'; | 67 | import '../../utils/screen_util.dart'; |
| 68 | import '../../utils/upload_image_util.dart'; | 68 | import '../../utils/upload_image_util.dart'; |
| 69 | import '../../widgets/special_text/my_extended_text_selection_controls.dart'; | 69 | import '../../widgets/special_text/my_extended_text_selection_controls.dart'; |
| @@ -2585,7 +2585,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | @@ -2585,7 +2585,7 @@ class NotebookDetailPageState extends State<NotebookDetailPage> { | ||
| 2585 | onTap: () { | 2585 | onTap: () { |
| 2586 | FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘 | 2586 | FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘 |
| 2587 | }, | 2587 | }, |
| 2588 | - child:MyWillPopScope( | 2588 | + child:WillPopScope( |
| 2589 | child: Scaffold( | 2589 | child: Scaffold( |
| 2590 | backgroundColor: MyColours.color_ffffff, | 2590 | backgroundColor: MyColours.color_ffffff, |
| 2591 | resizeToAvoidBottomInset: false, | 2591 | resizeToAvoidBottomInset: false, |
| @@ -62,7 +62,6 @@ import '../../provider/remark_manager_model.dart'; | @@ -62,7 +62,6 @@ import '../../provider/remark_manager_model.dart'; | ||
| 62 | import '../../provider/store_base_info_provider.dart'; | 62 | import '../../provider/store_base_info_provider.dart'; |
| 63 | import '../../provider/table_manage_model.dart'; | 63 | import '../../provider/table_manage_model.dart'; |
| 64 | import '../../utils/event_bus.dart'; | 64 | import '../../utils/event_bus.dart'; |
| 65 | -import '../../utils/my_will_pop_scope.dart'; | ||
| 66 | import '../../utils/screen_util.dart'; | 65 | import '../../utils/screen_util.dart'; |
| 67 | import '../feast/feast_page.dart'; | 66 | import '../feast/feast_page.dart'; |
| 68 | // import 'package:sipflutterplugin/sipflutterplugin.dart'; | 67 | // import 'package:sipflutterplugin/sipflutterplugin.dart'; |
| @@ -1550,7 +1549,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | @@ -1550,7 +1549,7 @@ class HomePageState extends State<HomePage> with WidgetsBindingObserver { | ||
| 1550 | collectStoreProvider = | 1549 | collectStoreProvider = |
| 1551 | Provider.of<CollectStoreProvider>(context, listen: true); | 1550 | Provider.of<CollectStoreProvider>(context, listen: true); |
| 1552 | 1551 | ||
| 1553 | - return MyWillPopScope( | 1552 | + return new WillPopScope( |
| 1554 | child: Scaffold( | 1553 | child: Scaffold( |
| 1555 | bottomNavigationBar: BottomNavigationBar( | 1554 | bottomNavigationBar: BottomNavigationBar( |
| 1556 | iconSize: ScreenUtil().setWidth(48), | 1555 | iconSize: ScreenUtil().setWidth(48), |
| @@ -20,7 +20,7 @@ import 'package:one_key/widgets/v_empty_view.dart'; | @@ -20,7 +20,7 @@ import 'package:one_key/widgets/v_empty_view.dart'; | ||
| 20 | import 'package:provider/provider.dart'; | 20 | import 'package:provider/provider.dart'; |
| 21 | import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; | 21 | import 'package:scrollable_positioned_list/scrollable_positioned_list.dart'; |
| 22 | 22 | ||
| 23 | -import '../../utils/my_will_pop_scope.dart'; | 23 | + |
| 24 | 24 | ||
| 25 | /* | 25 | /* |
| 26 | 已选菜品 | 26 | 已选菜品 |
| @@ -468,7 +468,7 @@ class _MessageHasOrderFoodPageState extends State<MessageHasOrderFoodPage> { | @@ -468,7 +468,7 @@ class _MessageHasOrderFoodPageState extends State<MessageHasOrderFoodPage> { | ||
| 468 | } | 468 | } |
| 469 | }, | 469 | }, |
| 470 | ), | 470 | ), |
| 471 | - body: MyWillPopScope(child: Consumer<OrderFoodProvider>( | 471 | + body: WillPopScope(child: Consumer<OrderFoodProvider>( |
| 472 | builder: (context, model, _) { | 472 | builder: (context, model, _) { |
| 473 | if (model.pageState != PageState.Success) { | 473 | if (model.pageState != PageState.Success) { |
| 474 | return ExceptionPage( | 474 | return ExceptionPage( |
| @@ -19,7 +19,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | @@ -19,7 +19,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 19 | import 'package:one_key/widgets/v_empty_view.dart'; | 19 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 20 | import 'package:provider/provider.dart'; | 20 | import 'package:provider/provider.dart'; |
| 21 | 21 | ||
| 22 | -import '../../../../utils/my_will_pop_scope.dart'; | 22 | + |
| 23 | 23 | ||
| 24 | class SellerMyMarketingRecordsDetailPage extends StatefulWidget { | 24 | class SellerMyMarketingRecordsDetailPage extends StatefulWidget { |
| 25 | final String? idstr; | 25 | final String? idstr; |
| @@ -159,7 +159,7 @@ class _SellerMyMarketingRecordsDetailPageState | @@ -159,7 +159,7 @@ class _SellerMyMarketingRecordsDetailPageState | ||
| 159 | } | 159 | } |
| 160 | }, | 160 | }, |
| 161 | ), | 161 | ), |
| 162 | - body: MyWillPopScope( | 162 | + body: WillPopScope( |
| 163 | child: Padding( | 163 | child: Padding( |
| 164 | padding: EdgeInsets.symmetric( | 164 | padding: EdgeInsets.symmetric( |
| 165 | horizontal: ScreenUtil().setWidth(30), | 165 | horizontal: ScreenUtil().setWidth(30), |
| @@ -14,7 +14,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | @@ -14,7 +14,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 14 | import 'package:one_key/widgets/v_empty_view.dart'; | 14 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 15 | import 'package:provider/provider.dart'; | 15 | import 'package:provider/provider.dart'; |
| 16 | 16 | ||
| 17 | -import '../../utils/my_will_pop_scope.dart'; | 17 | + |
| 18 | 18 | ||
| 19 | class InvoiceDetailPage extends StatefulWidget { | 19 | class InvoiceDetailPage extends StatefulWidget { |
| 20 | final bool? fromNotify; | 20 | final bool? fromNotify; |
| @@ -472,7 +472,7 @@ class _InvoiceDetailPageState extends State<InvoiceDetailPage> { | @@ -472,7 +472,7 @@ class _InvoiceDetailPageState extends State<InvoiceDetailPage> { | ||
| 472 | } | 472 | } |
| 473 | }, | 473 | }, |
| 474 | ), | 474 | ), |
| 475 | - body:MyWillPopScope( | 475 | + body:WillPopScope( |
| 476 | child: SingleChildScrollView( | 476 | child: SingleChildScrollView( |
| 477 | child: Padding( | 477 | child: Padding( |
| 478 | padding: EdgeInsets.all(ScreenUtil().setWidth(20)), | 478 | padding: EdgeInsets.all(ScreenUtil().setWidth(20)), |
| @@ -17,7 +17,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | @@ -17,7 +17,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 17 | import 'package:one_key/widgets/v_empty_view.dart'; | 17 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 18 | import 'package:provider/provider.dart'; | 18 | import 'package:provider/provider.dart'; |
| 19 | 19 | ||
| 20 | -import '../../utils/my_will_pop_scope.dart'; | 20 | + |
| 21 | 21 | ||
| 22 | class OnlineCheckDetailPage extends StatefulWidget { | 22 | class OnlineCheckDetailPage extends StatefulWidget { |
| 23 | final String? rid; | 23 | final String? rid; |
| @@ -976,7 +976,7 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { | @@ -976,7 +976,7 @@ class _OnlineCheckDetailPageState extends State<OnlineCheckDetailPage> { | ||
| 976 | } | 976 | } |
| 977 | }, | 977 | }, |
| 978 | ), | 978 | ), |
| 979 | - body: MyWillPopScope( | 979 | + body: WillPopScope( |
| 980 | child: SingleChildScrollView( | 980 | child: SingleChildScrollView( |
| 981 | child: Padding( | 981 | child: Padding( |
| 982 | padding: EdgeInsets.all(ScreenUtil().setWidth(20)), | 982 | padding: EdgeInsets.all(ScreenUtil().setWidth(20)), |
| @@ -25,7 +25,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | @@ -25,7 +25,7 @@ import 'package:one_key/widgets/system_app_bar.dart'; | ||
| 25 | import 'package:one_key/widgets/v_empty_view.dart'; | 25 | import 'package:one_key/widgets/v_empty_view.dart'; |
| 26 | import 'package:provider/provider.dart'; | 26 | import 'package:provider/provider.dart'; |
| 27 | 27 | ||
| 28 | -import '../../utils/my_will_pop_scope.dart'; | 28 | + |
| 29 | 29 | ||
| 30 | class OnlineCheckEditPage extends StatefulWidget { | 30 | class OnlineCheckEditPage extends StatefulWidget { |
| 31 | final bool fromNotify; | 31 | final bool fromNotify; |
| @@ -694,7 +694,7 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { | @@ -694,7 +694,7 @@ class _OnlineCheckEditPageState extends State<OnlineCheckEditPage> { | ||
| 694 | } | 694 | } |
| 695 | }, | 695 | }, |
| 696 | ), | 696 | ), |
| 697 | - body: MyWillPopScope( | 697 | + body: WillPopScope( |
| 698 | child: InkWell( | 698 | child: InkWell( |
| 699 | onTap: () { | 699 | onTap: () { |
| 700 | _focusNode.unfocus(); | 700 | _focusNode.unfocus(); |
| @@ -29,7 +29,7 @@ import 'package:one_key/utils/event_bus.dart'; | @@ -29,7 +29,7 @@ import 'package:one_key/utils/event_bus.dart'; | ||
| 29 | 29 | ||
| 30 | import '../../app.dart'; | 30 | import '../../app.dart'; |
| 31 | import '../../utils/common_utils.dart'; | 31 | import '../../utils/common_utils.dart'; |
| 32 | -import '../../utils/my_will_pop_scope.dart'; | 32 | + |
| 33 | 33 | ||
| 34 | class HandleOnlinePageSim extends StatefulWidget { | 34 | class HandleOnlinePageSim extends StatefulWidget { |
| 35 | final String rid; | 35 | final String rid; |
| @@ -417,7 +417,7 @@ class HandleOnlinePageSimState extends State<HandleOnlinePageSim> { | @@ -417,7 +417,7 @@ class HandleOnlinePageSimState extends State<HandleOnlinePageSim> { | ||
| 417 | }, | 417 | }, |
| 418 | ), | 418 | ), |
| 419 | body: SafeArea( | 419 | body: SafeArea( |
| 420 | - child: MyWillPopScope( | 420 | + child: WillPopScope( |
| 421 | child: Consumer<NotebookDetailModel>(builder: (context, model, _) { | 421 | child: Consumer<NotebookDetailModel>(builder: (context, model, _) { |
| 422 | if (model.pageStateSim != PageState.Success) { | 422 | if (model.pageStateSim != PageState.Success) { |
| 423 | return ExceptionPage( | 423 | return ExceptionPage( |
| @@ -64,7 +64,7 @@ import '../../pages/online_check/img_picker_widget.dart'; | @@ -64,7 +64,7 @@ import '../../pages/online_check/img_picker_widget.dart'; | ||
| 64 | import '../../pages/online_check/photo_view_wiget.dart'; | 64 | import '../../pages/online_check/photo_view_wiget.dart'; |
| 65 | import '../../provider/collect_store_provider.dart'; | 65 | import '../../provider/collect_store_provider.dart'; |
| 66 | import '../../provider/upload_img_provider.dart'; | 66 | import '../../provider/upload_img_provider.dart'; |
| 67 | -import '../../utils/my_will_pop_scope.dart'; | 67 | + |
| 68 | import '../../utils/screen_util.dart'; | 68 | import '../../utils/screen_util.dart'; |
| 69 | import '../../utils/upload_image_util.dart'; | 69 | import '../../utils/upload_image_util.dart'; |
| 70 | import '../../widgets/special_text/my_extended_text_selection_controls.dart'; | 70 | import '../../widgets/special_text/my_extended_text_selection_controls.dart'; |
| @@ -2356,7 +2356,7 @@ class NotebookDetailPageSimState extends State<NotebookDetailPageSim> { | @@ -2356,7 +2356,7 @@ class NotebookDetailPageSimState extends State<NotebookDetailPageSim> { | ||
| 2356 | FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘 | 2356 | FocusScope.of(context).requestFocus(FocusNode()); //隐藏键盘 |
| 2357 | }, | 2357 | }, |
| 2358 | child: SafeArea( | 2358 | child: SafeArea( |
| 2359 | - child: MyWillPopScope( | 2359 | + child: WillPopScope( |
| 2360 | child: Scaffold( | 2360 | child: Scaffold( |
| 2361 | backgroundColor: MyColours.color_ffffff, | 2361 | backgroundColor: MyColours.color_ffffff, |
| 2362 | resizeToAvoidBottomInset: false, | 2362 | resizeToAvoidBottomInset: false, |
| @@ -60,7 +60,7 @@ import '../../provider/notebook_detail_model.dart'; | @@ -60,7 +60,7 @@ import '../../provider/notebook_detail_model.dart'; | ||
| 60 | import '../../provider/remark_manager_model.dart'; | 60 | import '../../provider/remark_manager_model.dart'; |
| 61 | import '../../provider/store_base_info_provider.dart'; | 61 | import '../../provider/store_base_info_provider.dart'; |
| 62 | import '../../utils/event_bus.dart'; | 62 | import '../../utils/event_bus.dart'; |
| 63 | -import '../../utils/my_will_pop_scope.dart'; | 63 | + |
| 64 | import '../../utils/screen_util.dart'; | 64 | import '../../utils/screen_util.dart'; |
| 65 | 65 | ||
| 66 | // import 'package:sipflutterplugin/sipflutterplugin.dart'; | 66 | // import 'package:sipflutterplugin/sipflutterplugin.dart'; |
| @@ -1660,7 +1660,7 @@ class HomePageSimState extends State<HomePageSim> with WidgetsBindingObserver { | @@ -1660,7 +1660,7 @@ class HomePageSimState extends State<HomePageSim> with WidgetsBindingObserver { | ||
| 1660 | // ScreenUtil.init(context, width: 750, height: 1334); | 1660 | // ScreenUtil.init(context, width: 750, height: 1334); |
| 1661 | collectStoreProvider = | 1661 | collectStoreProvider = |
| 1662 | Provider.of<CollectStoreProvider>(context, listen: true); | 1662 | Provider.of<CollectStoreProvider>(context, listen: true); |
| 1663 | - return MyWillPopScope( | 1663 | + return WillPopScope( |
| 1664 | child: Scaffold( | 1664 | child: Scaffold( |
| 1665 | bottomNavigationBar: BottomNavigationBar( | 1665 | bottomNavigationBar: BottomNavigationBar( |
| 1666 | iconSize: ScreenUtil().setWidth(48), | 1666 | iconSize: ScreenUtil().setWidth(48), |
lib/utils/my_will_pop_scope.dart
deleted
100644 → 0
| 1 | -import 'dart:developer'; | ||
| 2 | -import 'dart:io'; | ||
| 3 | -import 'package:flutter/material.dart' as material; | ||
| 4 | -import 'package:flutter/src/widgets/navigator.dart'; | ||
| 5 | -import 'package:flutter/src/widgets/routes.dart'; | ||
| 6 | -import 'package:flutter/src/widgets/framework.dart'; | ||
| 7 | - | ||
| 8 | -class MyWillPopScope extends StatefulWidget { | ||
| 9 | - const MyWillPopScope({ | ||
| 10 | - super.key, | ||
| 11 | - required this.child, | ||
| 12 | - required this.onWillPop, | ||
| 13 | - }); | ||
| 14 | - | ||
| 15 | - final Widget child; | ||
| 16 | - final WillPopCallback onWillPop; | ||
| 17 | - | ||
| 18 | - @override | ||
| 19 | - State<MyWillPopScope> createState() => _WillPopScopeState(); | ||
| 20 | -} | ||
| 21 | - | ||
| 22 | -class _WillPopScopeState extends State<MyWillPopScope> { | ||
| 23 | - double startDx = 0; | ||
| 24 | - double endDx = 0; | ||
| 25 | - @override | ||
| 26 | - Widget build(BuildContext context) { | ||
| 27 | - if (Platform.isIOS) { | ||
| 28 | - return material.Listener( | ||
| 29 | - onPointerUp: (details) async { | ||
| 30 | - bool safe1 = startDx < 30; | ||
| 31 | - bool safe2 = endDx < 30; | ||
| 32 | - log( | ||
| 33 | - "\n按下手指位置(${safe1 ? '安全区' : '非安全区'}) => $startDx" | ||
| 34 | - "\n手指抬起位置(${safe2 ? '安全区' : '非安全区'}) => $endDx", | ||
| 35 | - name: "WillPopScope", | ||
| 36 | - ); | ||
| 37 | - // 左侧滑动、安全区 | ||
| 38 | - if ((endDx > startDx) && safe1 && !safe2) { | ||
| 39 | - log("ios左侧滑动返回被拦截$endDx", name: "WillPopScope"); | ||
| 40 | - widget.onWillPop(); | ||
| 41 | - } | ||
| 42 | - }, | ||
| 43 | - onPointerDown: (details) => startDx = details.localPosition.dx, | ||
| 44 | - onPointerMove: (details) => endDx = details.localPosition.dx, | ||
| 45 | - child: material.WillPopScope( | ||
| 46 | - child: widget.child, | ||
| 47 | - onWillPop: () async => false, | ||
| 48 | - ), | ||
| 49 | - ); | ||
| 50 | - } else { | ||
| 51 | - widget.onWillPop().then((value) { | ||
| 52 | - log(value ? "android触发滑动返回" : "android滑动返回被拦截", name: "WillPopScope"); | ||
| 53 | - }); | ||
| 54 | - return material.WillPopScope( | ||
| 55 | - onWillPop: widget.onWillPop, | ||
| 56 | - child: widget.child, | ||
| 57 | - ); | ||
| 58 | - } | ||
| 59 | - } | ||
| 60 | -} |
| @@ -1502,6 +1502,14 @@ packages: | @@ -1502,6 +1502,14 @@ packages: | ||
| 1502 | url: "https://pub.flutter-io.cn" | 1502 | url: "https://pub.flutter-io.cn" |
| 1503 | source: hosted | 1503 | source: hosted |
| 1504 | version: "1.5.1" | 1504 | version: "1.5.1" |
| 1505 | + pop_scope_page_transitions: | ||
| 1506 | + dependency: "direct main" | ||
| 1507 | + description: | ||
| 1508 | + name: pop_scope_page_transitions | ||
| 1509 | + sha256: "9720e515fd4babbc32ad19621b93b95c61f7e851467b0f469ee834adbff2f22e" | ||
| 1510 | + url: "https://pub.flutter-io.cn" | ||
| 1511 | + source: hosted | ||
| 1512 | + version: "0.0.1" | ||
| 1505 | protobuf: | 1513 | protobuf: |
| 1506 | dependency: transitive | 1514 | dependency: transitive |
| 1507 | description: | 1515 | description: |
| @@ -280,6 +280,7 @@ dependencies: | @@ -280,6 +280,7 @@ dependencies: | ||
| 280 | # flutter_card_swiper: ^6.1.0 | 280 | # flutter_card_swiper: ^6.1.0 |
| 281 | # flutter_swiper: ^1.1.6 | 281 | # flutter_swiper: ^1.1.6 |
| 282 | flutter_swiper_null_safety: ^1.0.2 | 282 | flutter_swiper_null_safety: ^1.0.2 |
| 283 | + pop_scope_page_transitions: ^0.0.1 | ||
| 283 | 284 | ||
| 284 | 285 | ||
| 285 | 286 |
-
Please register or login to post a comment