reinitialising project

This commit is contained in:
2025-05-03 03:44:06 +01:00
parent f72ea71bfd
commit 2033ad79e2
16 changed files with 851 additions and 202 deletions
+29
View File
@@ -0,0 +1,29 @@
import 'package:flutter/material.dart';
class NavigationService {
//
static NavigationService instance = NavigationService();
GlobalKey<NavigatorState>? navigatorKey;
NavigationService() {
navigatorKey = GlobalKey<NavigatorState>();
}
Future<dynamic>? navigateToReplacement(String _routeName) {
return navigatorKey!.currentState!.pushReplacementNamed(_routeName);
}
Future<dynamic>? navigateTo(String _routeName) {
return navigatorKey!.currentState!.pushNamed(_routeName);
}
Future<dynamic>? navigateToRoute(MaterialPageRoute _route) {
return navigatorKey!.currentState!.push(_route);
}
// Manually Call Function
void goBack() {
return navigatorKey!.currentState!.pop();
}
}
+44
View File
@@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
class SnackBarService {
//
BuildContext? _buildContext;
static SnackBarService instance = SnackBarService();
set buildContext(BuildContext _context) {
_buildContext = _context;
}
void showSnackBarError(String _message) {
ScaffoldMessenger.of(_buildContext!).showSnackBar(
SnackBar(
duration: Duration(seconds: 2),
content: Text(
_message,
style: TextStyle(
color: Colors.white,
fontSize: 15,
),
),
backgroundColor: Colors.red,
),
);
}
void showSnackBarSuccess(String _message) {
ScaffoldMessenger.of(_buildContext!).showSnackBar(
SnackBar(
duration: Duration(seconds: 2),
content: Text(
_message,
style: TextStyle(
color: Colors.white,
fontSize: 15,
),
),
backgroundColor: Colors.green,
),
);
}
}