This commit is contained in:
Patrick Alvin Alcala 2025-02-28 12:36:26 +08:00
parent 2931621069
commit 27f00e43a7
15 changed files with 252 additions and 104 deletions

View file

@ -29,16 +29,20 @@ class _AddCategoryPageState extends State<AddCategoryPage> {
try {
if (await InternetConnectionChecker.instance.hasConnection) {
await _refCategories.postCategory(_categoryController.text.toUpperCase());
final post = await _refCategories.postCategory(_categoryController.text.toUpperCase());
if (mounted) {
showNotification(context, 'Category Saved', true);
if (post && mounted) {
showNotification(context, 'Category saved', true);
WidgetsBinding.instance.addPostFrameCallback((_) {
if (mounted) {
context.push('/main');
}
});
} else {
if (mounted) {
showNotification(context, 'Category not saved', false);
}
}
} else {
if (mounted) {