Initial commit for complete UI

This commit is contained in:
2025-05-29 14:59:31 +05:30
commit 1f0ec17edc
170 changed files with 7211 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
import 'package:flutter/material.dart';
import 'package:hive/hive.dart';
import '../models/shop_model.dart';
class ShopProvider with ChangeNotifier {
ShopModel? _shop;
ShopModel? get shop => _shop;
final String _boxName = 'shopBox';
ShopProvider() {
_loadOrCreateDummyShop();
}
void _loadOrCreateDummyShop() async {
final box = await Hive.openBox<ShopModel>(_boxName);
if (box.isNotEmpty) {
_shop = box.getAt(0);
} else {
// Dummy data
_shop = ShopModel(
id: '1',
shopName: "Omkara Car Wash Center",
email: "omkara@gmail.com",
mobile: "8617019854",
image: "assets/images/shop_image.jpg",
address: "Bidhannagar, Kolkata, pin-700017",
);
await box.add(_shop!);
}
notifyListeners();
}
Future<void> setShop(ShopModel shop) async {
_shop = shop;
notifyListeners();
final box = await Hive.openBox<ShopModel>(_boxName);
await box.clear(); // Keep only one shop
await box.add(shop);
}
Future<void> logout() async {
_shop = null;
notifyListeners();
final box = await Hive.openBox<ShopModel>(_boxName);
await box.clear();
}
}