1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
| import 'package:fluro/fluro.dart'; import 'package:flutter/material.dart'; import 'package:test_drive/routes/application.dart';
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
class NavigatorUtil { static void push( String path, { bool replace = false, bool clearStack = false, Object? arguments, TransitionType? transition, }) { Application.router.navigateTo( navigatorKey.currentContext!, path, replace: replace, clearStack: clearStack, transition: transition ?? TransitionType.native, routeSettings: RouteSettings( arguments: arguments, ), ); }
static void replase(String path, {bool replase = true, bool clearStack = false, Object? arguments}) { Application.router.navigateTo(navigatorKey.currentContext!, path, replace: replase, clearStack: clearStack, transition: TransitionType.native, routeSettings: RouteSettings(arguments: arguments)); }
static void switchTab(String path, {bool replase = true, bool clearStack = true, Object? arguments}) { Application.router.navigateTo(navigatorKey.currentContext!, path, replace: replase, clearStack: clearStack, transition: TransitionType.native, routeSettings: RouteSettings(arguments: arguments)); }
static void back({int count = 1, Object? params}) { NavigatorState state = Navigator.of(navigatorKey.currentContext!); while (count-- > 0) { state = state..pop(params); } } }
|