Update project

This commit is contained in:
2026-07-23 15:36:11 +05:30
parent 1197cfc161
commit 14fffa40c6
84 changed files with 20918 additions and 2761 deletions

View File

@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:animated_text_kit/animated_text_kit.dart';
import 'package:animations/animations.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:carousel_slider/carousel_slider.dart';
import 'package:connectivity_plus/connectivity_plus.dart';
import 'package:flutter/cupertino.dart';
@@ -27,8 +28,12 @@ import '../../controllers/cart_controller/cart.dart';
import '../../controllers/dashboard_controller/category.dart';
import '../../controllers/dashboard_controller/dashboard_controller.dart';
import '../../controllers/product/product_controller.dart';
import '../../controllers/tenant_controller /tenant_list.dart';
import '../../controllers/tenant_list/tenant_controller.dart';
import '../../domain/repository/authentication/auth_repository.dart';
import '../../features/Products/product_card.dart';
import '../../modules/search_model/search_model.dart';
import '../../service/firebase_analytics/analytics_service.dart';
import '../../widgets/fav_button.dart';
import '../../widgets/tenantcategory.dart';
import '../../widgets/text_widget.dart';
import '../account/demo.dart';
@@ -37,8 +42,10 @@ import '../cart/cart_view.dart';
import '../home_view.dart';
import '../product/category_products.dart';
import '../product/product_view.dart';
import '../product/products_list.dart' hide ProductItem;
import '../product/tenant_products.dart';
import '../qr_scaner/qr_scaner.dart';
import 'ai_search.dart';
class DashboardPage extends StatefulWidget {
const DashboardPage({super.key});
@@ -72,6 +79,87 @@ class _DashboardPageState extends State<DashboardPage> {
static const _kProfile = 'cached_profile';
final recommendations = [
RecommendedItem(
title: 'Cheapest Pizza\nNearby',
subtitle: 'From ₹149',
image: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcS9b5A0dGeZ4PR6cdpuvDyoMa3lO7JBRyMo8Q&s',
bgColor: Color(0xFFFFF3EC),
accentColor: Color(0xFFFF6B2C),
),
RecommendedItem(
title: 'Grocery Basket\n₹320 Less',
subtitle: 'Save more on your order',
image: 'https://images.unsplash.com/photo-1542838132-92c53300491e?w=200&fit=crop',
bgColor: Color(0xFFF0FAF0),
accentColor: Color(0xFF22A45D),
),
RecommendedItem(
title: 'Birthday\nComing Up!',
subtitle: 'Let Nearle plan it',
image: 'https://images.unsplash.com/photo-1558618666-fcd25c85cd64?w=200&fit=crop',
bgColor: Color(0xFFFDF0F8),
accentColor: Color(0xFFD63384),
),
];
final products = [
ProductItem(
name: 'Chicken Biryani',
category: 'Food · HotPot',
price: '₹189',
originalPrice: '₹240',
image: 'https://images.unsplash.com/photo-1563379091339-03b21ab4a4f8?w=300&fit=crop',
rating: 4.8,
reviewCount: 320,
),
ProductItem(
name: 'Fresh Veggie Basket',
category: 'Grocery · BigBasket',
price: '₹299',
originalPrice: '₹420',
image: 'https://images.unsplash.com/photo-1512621776951-a57141f2eefd?w=300&fit=crop',
rating: 4.5,
reviewCount: 180,
),
ProductItem(
name: 'Margherita Pizza',
category: 'Food · Dominos',
price: '₹149',
originalPrice: '₹199',
image: 'https://images.unsplash.com/photo-1565299624946-b28f40a0ae38?w=300&fit=crop',
rating: 4.6,
reviewCount: 512,
),
ProductItem(
name: 'Birthday Cake',
category: 'Bakery · CakeZone',
price: '₹549',
originalPrice: '₹699',
image: 'https://images.unsplash.com/photo-1558618666-fcd25c85cd64?w=300&fit=crop',
rating: 4.9,
reviewCount: 94,
),
ProductItem(
name: 'Mango Smoothie',
category: 'Drinks · Juice Bar',
price: '₹89',
originalPrice: '₹120',
image: 'https://images.unsplash.com/photo-1623065422902-30a2d299bbe4?w=300&fit=crop',
rating: 4.4,
reviewCount: 67,
),
ProductItem(
name: 'Paneer Butter Masala',
category: 'Food · Behrouz',
price: '₹220',
originalPrice: '₹280',
image: 'https://images.unsplash.com/photo-1631452180519-c014fe946bc7?w=300&fit=crop',
rating: 4.7,
reviewCount: 210,
),
];
bool status = true;
bool _showBackToTop = false;
RxBool showMiniCart = false.obs;
@@ -84,177 +172,6 @@ class _DashboardPageState extends State<DashboardPage> {
Icons.shopping_cart_rounded,
];
void _openCategoryBottomSheet(
BuildContext context,
List subCategories,
item,
) {
showModalBottomSheet(
context: context,
isScrollControlled: true,
backgroundColor: Colors.transparent,
builder: (_) {
return SafeArea(
top: false,
child: ClipRRect(
borderRadius:
const BorderRadius.vertical(top: Radius.circular(20)),
child: Container(
height: MediaQuery.of(context).size.height * 0.85,
color: Colors.white,
child: Column(
children: [
const SizedBox(height: 8),
// drag handle (smaller)
Container(
width: 36,
height: 4,
decoration: BoxDecoration(
color: Colors.grey.shade400,
borderRadius: BorderRadius.circular(10),
),
),
const SizedBox(height: 10),
// Title (not oversized)
const Padding(
padding: EdgeInsets.symmetric(horizontal: 14),
child: Align(
alignment: Alignment.centerLeft,
child: Text(
"Category",
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
),
),
),
),
const SizedBox(height: 10),
Expanded(
child: subCategories.isEmpty
? const Center(
child: Text("No products available"),
)
: GridView.builder(
padding:
const EdgeInsets.fromLTRB(12, 8, 12, 16),
gridDelegate:
const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
childAspectRatio: 0.78,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
),
itemCount: subCategories.length,
itemBuilder: (context, index) {
final product = subCategories[index];
return InkWell(
borderRadius:
BorderRadius.circular(14),
onTap: () {
Navigator.pop(context);
Get.to(
() => SubCategoryProductsScreen(
tenantId: item.tenantid!,
locationId: item.locationid!,
categoryId: item.categoryid!,
tenantName: item.tenantname!,
locationname:
item.locationname!,
tenantLocation: item.suburb!,
tenantImage:
item.tenantimage!,
tenantloc:
item.locationid!,
subCategoryName:
product.subcatname
.toString(),
),
);
},
child: Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius:
BorderRadius.circular(14),
border: Border.all(
color: Colors.black12,
width: 0.25,
),
boxShadow: [
BoxShadow(
color: Colors.black
.withOpacity(0.04),
blurRadius: 5,
),
],
),
child: Column(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
const SizedBox(height: 10),
ClipOval(
child: Image.network(
product.image ?? '',
width: 100,
height: 100,
fit: BoxFit.cover,
errorBuilder:
(_, __, ___) =>
const Icon(
Icons
.image_not_supported),
),
),
Padding(
padding:
const EdgeInsets.symmetric(
horizontal: 6),
child: ReusableTextWidget(
text:
product.subcatname ??
'',
color: Colors.black
.withOpacity(0.7),
fontFamily:
FontConstants
.fontFamily,
fontSize: 11.5,
fontWeight:
FontWeight.w600,
textAlign:
TextAlign.center,
maxLines: 1,
overflow: TextOverflow
.ellipsis,
),
),
const SizedBox(height: 10),
],
),
),
);
},
),
),
],
),
),
),
);
},
);
}
@override
@@ -659,7 +576,7 @@ class _DashboardPageState extends State<DashboardPage> {
borderRadius: BorderRadius.circular(14),
onTap: () => Get.to(() => const SearchScreen()),
child: Container(
height: 48,
height: 55,
padding: const EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
color: Colors.white,
@@ -710,6 +627,11 @@ class _DashboardPageState extends State<DashboardPage> {
],
),
),
IconButton(onPressed: () => Get.to(() => const SearchPage()), icon: const Icon(Icons.mic, color: Colors.black87, size: 22)),
IconButton(onPressed: () => Get.to(() => const SearchPage()), icon: const Icon(Icons.camera_alt_outlined, color: Colors.black87, size: 22)),
],
),
),
@@ -811,12 +733,226 @@ class _DashboardPageState extends State<DashboardPage> {
);
}),
const SliverToBoxAdapter(
child: SizedBox(height: 12),
),
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 16),
sliver: SliverToBoxAdapter(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Recommended for You",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black.withOpacity(0.7),
),
),
TextButton(
onPressed: () {},
child: const Text("See all"),
),
],
),
),
),
SliverToBoxAdapter(
child: SizedBox(
height: 110,
child: ListView.separated(
padding: const EdgeInsets.symmetric(horizontal: 16),
scrollDirection: Axis.horizontal,
itemCount: recommendations.length,
separatorBuilder: (_, __) => const SizedBox(width: 12),
itemBuilder: (context, index) {
final item = recommendations[index];
return Container(
width: 160,
decoration: BoxDecoration(
color: item.bgColor,
borderRadius: BorderRadius.circular(12),
),
child: Stack(
children: [
// Title + Subtitle
Positioned(
top: 14,
left: 14,
right: 14,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
item.title,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.w700,
color: Colors.black.withOpacity(0.7),
height: 1.25,
),
),
const SizedBox(height: 6),
Text(
item.subtitle,
style: TextStyle(
fontSize: 9,
fontWeight: FontWeight.w600,
color: item.accentColor,
),
),
],
),
),
// Network image bottom-right
Positioned(
bottom: 0,
right: 0,
child: ClipRRect(
borderRadius: const BorderRadius.only(
bottomRight: Radius.circular(20),
),
child: CachedNetworkImage(
imageUrl: item.image,
width: 80,
height: 80,
fit: BoxFit.contain,
placeholder: (context, url) => const SizedBox(
width: 80,
height: 80,
),
errorWidget: (context, url, error) => SizedBox(
width: 80,
height: 80,
child: Icon(
Icons.image_not_supported_rounded,
color: item.accentColor.withOpacity(0.3),
size: 28,
),
),
),
),
),
// Arrow button bottom-right corner
Positioned(
bottom: 10,
right: 10,
child: Container(
width: 26,
height: 26,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.white,
boxShadow: [
BoxShadow(
color: Colors.black.withOpacity(0.08),
blurRadius: 6,
offset: const Offset(0, 2),
),
],
),
child: Icon(
Icons.chevron_right_rounded,
size: 16,
color: item.accentColor,
),
),
),
],
),
);
},
),
),
),
const SliverToBoxAdapter(
child: SizedBox(height: 12),
),
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 16),
sliver: SliverToBoxAdapter(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Fresh picks for you",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black.withOpacity(0.7),
),
),
TextButton(
onPressed: () {
Navigator.push(context, MaterialPageRoute(builder: (context,) => const ProductsList()));
},
child: const Text("See all"),
),
],
),
),
),
const SliverToBoxAdapter(
child: SizedBox(height: 12),
),
SliverPadding(
padding: const EdgeInsets.fromLTRB(16, 0, 16, 24),
sliver: SliverGrid(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
crossAxisSpacing: 12,
mainAxisSpacing: 12,
mainAxisExtent: 270,
),
delegate: SliverChildBuilderDelegate(
(context, index) => ProductCard(item: products[index]),
childCount: products.length,
),
),
),
const SliverToBoxAdapter(
child: SizedBox(height: 12),
),
SliverPadding(
padding: const EdgeInsets.symmetric(horizontal: 16),
sliver: SliverToBoxAdapter(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"Near by Stores",
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: Colors.black.withOpacity(0.7),
),
),
TextButton(
onPressed: () {},
child: const Text("See all"),
),
],
),
),
),
@@ -898,7 +1034,7 @@ class _DashboardPageState extends State<DashboardPage> {
(context, index) {
final item = tenantController.tenants[index];
return _ZoomOnTap(
onTap: () {
onTap: () async {
Get.to(() => ProductsScreen(
tenantId: item.tenantid!,
locationId: item.locationid!,
@@ -910,6 +1046,16 @@ class _DashboardPageState extends State<DashboardPage> {
tenantloc:item.locationid!,
subCategoryName: "",
));
await AnalyticsService.logEvent(
'store_viewed',
parameters: {
'store_id': item.tenantid!,
'store_name': item.tenantname!,
'locatiom' : item.locationname!,
},
);
},
child: Container(
margin: const EdgeInsets.only(bottom: 12, top: 12),
@@ -1063,7 +1209,7 @@ class _DashboardPageState extends State<DashboardPage> {
maxLines: 1,
),
IconButton(
onPressed: () {
onPressed: () async {
// _openCategoryBottomSheet(
// context,
// item.subcategories ?? [],
@@ -1082,6 +1228,15 @@ class _DashboardPageState extends State<DashboardPage> {
subCategoryName: "",
));
await AnalyticsService.logEvent(
'store_viewed',
parameters: {
'store_id': item.tenantid!,
'store_name': item.tenantname!,
'locatiom' : item.locationname!,
},
);
},
icon: Icon(Icons.arrow_circle_right_outlined,
color: Colors.black.withOpacity(0.6),
@@ -1113,7 +1268,7 @@ class _DashboardPageState extends State<DashboardPage> {
final product = item.subcategories![index];
return InkWell(
borderRadius: BorderRadius.circular(16),
onTap: () {
onTap: () async {
// Get.to(() => SubCategoryProductsScreen(
// tenantId: item.tenantid!,
@@ -1139,6 +1294,15 @@ class _DashboardPageState extends State<DashboardPage> {
subCategoryName: "",
));
await AnalyticsService.logEvent(
'store_viewed',
parameters: {
'store_id': item.tenantid!,
'store_name': item.tenantname!,
'locatiom' : item.locationname!,
},
);
},
child: Container(
margin:
@@ -1247,11 +1411,6 @@ class _DashboardPageState extends State<DashboardPage> {
),
),
),
Obx(() {
if (cartController.cartItems.isEmpty) return const SizedBox();
final tenant = cartController.currentTenant.value;
@@ -1374,45 +1533,12 @@ class _DashboardPageState extends State<DashboardPage> {
),
);
}),
],),
),
);
}
Widget _chip(String emoji, String label) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 6),
decoration: BoxDecoration(
color: Color(0xFFF8F4FF),
borderRadius: BorderRadius.circular(30),
border: Border.all(color: Color(0xFFE0D4FF), width: 1),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(emoji, style: TextStyle(fontSize: 13)),
SizedBox(width: 5),
Text(
label,
style: TextStyle(fontSize: 11, fontWeight: FontWeight.w500, color: Color(0xFF333333)),
),
],
),
);
}
@@ -1628,23 +1754,6 @@ class _DashboardPageState extends State<DashboardPage> {
);
}
Widget _buildBannerShimmer() {
return SliverToBoxAdapter(
child: Shimmer.fromColors(
baseColor: Colors.grey.shade300,
highlightColor: Colors.grey.shade100,
child: Container(
margin: const EdgeInsets.symmetric(horizontal: 10, vertical: 10),
height: 180,
width: double.infinity,
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.circular(14),
),
),
),
);
}
Widget _buildListShimmer(BuildContext context) {
return SliverList(
@@ -1834,4 +1943,5 @@ class _ZoomOnTapState extends State<_ZoomOnTap> {
),
);
}
}
}