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.
HMG_Patient_App_New/lib/extensions/route_extensions.dart

28 lines
831 B
Dart

5 months ago
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 pushNavigateTo(Widget page) {
5 months ago
Navigator.push(this, MaterialPageRoute(builder: (context) => page));
}
void popUntilNamed(String routeName) {
Navigator.popUntil(this, ModalRoute.withName(routeName));
}
5 months ago
}