Commit c906fd05 by tanghuan

ios手势测试

1 parent 5de5f855
import 'dart:io';
import 'package:appframe/ui/pages/adv_page.dart'; import 'package:appframe/ui/pages/adv_page.dart';
import 'package:appframe/ui/pages/im_page.dart'; import 'package:appframe/ui/pages/im_page.dart';
import 'package:appframe/ui/pages/link_page.dart'; import 'package:appframe/ui/pages/link_page.dart';
...@@ -8,130 +6,65 @@ import 'package:appframe/ui/pages/login_phone_page.dart'; ...@@ -8,130 +6,65 @@ import 'package:appframe/ui/pages/login_phone_page.dart';
import 'package:appframe/ui/pages/login_qr_page.dart'; import 'package:appframe/ui/pages/login_qr_page.dart';
import 'package:appframe/ui/pages/reload_page.dart'; import 'package:appframe/ui/pages/reload_page.dart';
import 'package:appframe/ui/pages/scan_code_page.dart'; import 'package:appframe/ui/pages/scan_code_page.dart';
import 'package:appframe/ui/pages/setting/account_page.dart';
import 'package:appframe/ui/pages/setting/account_phone_page.dart';
import 'package:appframe/ui/pages/web_page.dart'; import 'package:appframe/ui/pages/web_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart'; import 'package:go_router/go_router.dart';
// iOS平台使用Cupertino转场动画以支持侧滑返回手势
Page<dynamic> _buildPageWithTransition({
required Widget child,
required GoRouterState state,
}) {
if (Platform.isIOS) {
return CupertinoPage(
key: state.pageKey,
child: child,
);
}
return MaterialPage(
key: state.pageKey,
child: child,
);
}
final GoRouter router = GoRouter( final GoRouter router = GoRouter(
initialLocation: '/web', initialLocation: '/web',
routes: <RouteBase>[ routes: <RouteBase>[
GoRoute( GoRoute(
path: '/web', path: '/web',
pageBuilder: (BuildContext context, GoRouterState state) { builder: (BuildContext context, GoRouterState state) {
return _buildPageWithTransition( return const WebPage();
child: const WebPage(),
state: state,
);
}, },
), ),
GoRoute( GoRoute(
path: '/scanCode', path: '/scanCode',
pageBuilder: (BuildContext context, GoRouterState state) { builder: (BuildContext context, GoRouterState state) {
return _buildPageWithTransition( return const ScanCodePage();
child: const ScanCodePage(),
state: state,
);
}, },
), ),
GoRoute( GoRoute(
path: '/link', path: '/link',
pageBuilder: (BuildContext context, GoRouterState state) { builder: (BuildContext context, GoRouterState state) {
return _buildPageWithTransition( return const LinkPage();
child: const LinkPage(),
state: state,
);
}, },
), ),
GoRoute( GoRoute(
path: '/loginMain', path: '/loginMain',
pageBuilder: (BuildContext context, GoRouterState state) { builder: (BuildContext context, GoRouterState state) {
return _buildPageWithTransition( return const LoginMainPage();
child: const LoginMainPage(),
state: state,
);
}, },
), ),
GoRoute( GoRoute(
path: '/loginPhone', path: '/loginPhone',
pageBuilder: (BuildContext context, GoRouterState state) { builder: (BuildContext context, GoRouterState state) {
return _buildPageWithTransition( return const LoginPhonePage();
child: const LoginPhonePage(),
state: state,
);
}, },
), ),
GoRoute( GoRoute(
path: '/loginQr', path: '/loginQr',
pageBuilder: (BuildContext context, GoRouterState state) { builder: (BuildContext context, GoRouterState state) {
return _buildPageWithTransition( return const LoginQrPage();
child: const LoginQrPage(),
state: state,
);
},
),
GoRoute(
path: '/account',
pageBuilder: (BuildContext context, GoRouterState state) {
return _buildPageWithTransition(
child: const AccountPage(),
state: state,
);
},
),
GoRoute(
path: '/account/phone',
pageBuilder: (BuildContext context, GoRouterState state) {
return _buildPageWithTransition(
child: const AccountPhonePage(),
state: state,
);
}, },
), ),
GoRoute( GoRoute(
path: '/adv', path: '/adv',
pageBuilder: (BuildContext context, GoRouterState state) { builder: (BuildContext context, GoRouterState state) {
return _buildPageWithTransition( return const AdvPage();
child: const AdvPage(),
state: state,
);
}, },
), ),
GoRoute( GoRoute(
path: '/im', path: '/im',
pageBuilder: (BuildContext context, GoRouterState state) { builder: (BuildContext context, GoRouterState state) {
return _buildPageWithTransition( return const ImPage();
child: const ImPage(),
state: state,
);
}, },
), ),
GoRoute( GoRoute(
path: '/reload', path: '/reload',
pageBuilder: (BuildContext context, GoRouterState state) { builder: (BuildContext context, GoRouterState state) {
return _buildPageWithTransition( return const ReloadPage();
child: const ReloadPage(),
state: state,
);
}, },
), ),
], ],
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!