This commit is contained in:
Patrick Alvin Alcala 2025-02-28 17:02:46 +08:00
parent 6a6b5f45fa
commit 5f0d2e60d2
8 changed files with 70 additions and 57 deletions

View file

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:internet_connection_checker/internet_connection_checker.dart';
import 'package:pharmacy_mobile/functions/checkexisting_function.dart';
import 'package:pharmacy_mobile/tables/ref_categories.dart';
import 'package:pharmacy_mobile/widgets/button_widget.dart';
import 'package:pharmacy_mobile/widgets/form_border_widget2.dart';
@ -29,6 +30,13 @@ class _AddCategoryPageState extends State<AddCategoryPage> {
try {
if (await InternetConnectionChecker.instance.hasConnection) {
final existing = await checkExisting(_refCategories, _categoryController);
if (existing && mounted) {
showNotification(context, 'Category already listed', false);
return;
}
final post = await _refCategories.postCategory(_categoryController.text.toUpperCase());
if (post && mounted) {