diff --git a/lib/main.dart b/lib/main.dart index 8cfa6046..dd8ec8d2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,17 +1,19 @@ +import 'dart:io'; + import 'package:akuCommunity/pages/sign/sign_in_page.dart'; +import 'package:ani_route/ani_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; -import 'package:flutter_screenutil/screenutil.dart'; import 'package:provider/provider.dart'; import 'package:akuCommunity/provider/cart.dart'; import 'package:flutter_picker/flutter_picker.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:oktoast/oktoast.dart'; -import 'package:akuCommunity/pages/tab_navigator.dart'; import 'package:akuCommunity/routers/router_init.dart'; void main() { + ARoute.init(true); runApp(MyApp()); } diff --git a/lib/pages/sign/sign_in_page.dart b/lib/pages/sign/sign_in_page.dart index cd9cf989..22d24905 100644 --- a/lib/pages/sign/sign_in_page.dart +++ b/lib/pages/sign/sign_in_page.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'package:akuCommunity/pages/sign/user_authentication_page.dart'; import 'package:akuCommunity/routers/page_routers.dart'; +import 'package:ani_route/ani_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:akuCommunity/utils/screenutil.dart'; @@ -129,10 +130,7 @@ class _SignInPageState extends State { InkWell _inkWellLogin() { return InkWell( onTap: () { - Navigator.pushReplacement( - context, - CupertinoPageRoute(builder: (context) => UserAuthenticationPage()), - ); + ARoute.push(context, UserAuthenticationPage()); }, child: Container( alignment: Alignment.center, @@ -190,7 +188,7 @@ class _SignInPageState extends State { double _statusHeight = MediaQuery.of(context).padding.top; ScreenUtil.init(context, width: 750, height: 1334, allowFontScaling: true); return Scaffold( - backgroundColor: Colors.white, + backgroundColor: Colors.white, appBar: _appBar(), body: SingleChildScrollView( child: Container( diff --git a/lib/pages/sign/user_authentication_page.dart b/lib/pages/sign/user_authentication_page.dart index 589e7558..ad7a414d 100644 --- a/lib/pages/sign/user_authentication_page.dart +++ b/lib/pages/sign/user_authentication_page.dart @@ -1,13 +1,14 @@ import 'package:akuCommunity/pages/tab_navigator.dart'; +import 'package:ani_route/ani_route.dart'; import 'package:flutter/material.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter_icons/flutter_icons.dart'; import 'package:akuCommunity/utils/screenutil.dart'; import 'package:akuCommunity/base/base_style.dart'; -import 'package:akuCommunity/base/assets_image.dart'; class UserAuthenticationPage extends StatefulWidget { - UserAuthenticationPage({Key key}) : super(key: key); + final BuildContext context; + UserAuthenticationPage({Key key, this.context}) : super(key: key); @override _UserAuthenticationPageState createState() => _UserAuthenticationPageState(); @@ -38,10 +39,8 @@ class _UserAuthenticationPageState extends State { MaterialButton( child: Text('跳过'), onPressed: () { - Navigator.pushReplacement( - context, - CupertinoPageRoute(builder: (context) => TabNavigator()), - ); + ARoute.pop(context); + ARoute.pushReplace(context, TabNavigator()); }, ), ], diff --git a/pubspec.lock b/pubspec.lock index 2c31c2a3..810b9b6c 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -15,6 +15,13 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "0.39.17" + ani_route: + dependency: "direct main" + description: + name: ani_route + url: "https://pub.flutter-io.cn" + source: hosted + version: "0.0.2" animate_do: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index dbf8deb5..cc6458b6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -115,6 +115,8 @@ dependencies: #用户存储路径 path_provider: ^1.6.18 + ani_route: ^0.0.2 + dev_dependencies: flutter_test: sdk: flutter