You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
719 B
Dart
24 lines
719 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
extension NavigationExtensions on BuildContext {
|
|
void navigateWithName(String routeName, {Object? arguments}) {
|
|
Navigator.pushNamed(this, routeName, arguments: arguments);
|
|
}
|
|
|
|
Future<void> navigateReplaceWithName(String routeName, {Object? arguments}) async {
|
|
await Navigator.pushReplacementNamed(this, routeName, arguments: arguments);
|
|
}
|
|
|
|
void navigateReplaceWithNameUntilRoute(String routeName, {Object? arguments}) {
|
|
Navigator.pushNamedAndRemoveUntil(this, routeName, (route) => false);
|
|
}
|
|
|
|
void pop() {
|
|
Navigator.of(this).pop();
|
|
}
|
|
|
|
void navigateTo(Widget page) {
|
|
Navigator.push(this, MaterialPageRoute(builder: (context) => page));
|
|
}
|
|
}
|