Update home.dart

This commit is contained in:
string 2025-09-09 08:48:07 +05:30
parent f9043173c0
commit 13eca99151

View File

@ -10,9 +10,6 @@ import 'package:provider/provider.dart';
import 'package:base_project/view_model/system_params/system_params_view_model.dart';
import 'package:flutter/material.dart';
import '../../Entity/angulardatatype/Basicp1/Basicp1View/Basicp1_entity_list_screen.dart';
import '../../Entity/angulardatatype/Basicp1/Basicp1_viewModel/Basicp1_view_model_screen.dart';
class HomeView extends StatefulWidget {
const HomeView({super.key});
@ -90,22 +87,7 @@ class _HomeViewState extends State<HomeView> with TickerProviderStateMixin {
// NEW ITEMS
DrawerItem(
icon: Icons.data_object,
title: 'Basicp1 Management',
subtitle: 'Manage Basicp1 entities',
onTap: (context) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChangeNotifierProvider(
create: (context) => Basicp1ViewModelScreen(),
child: const Basicp1EntityListScreen(),
),
),
);
},
),
// NEW MENU
];
@override
@ -136,39 +118,36 @@ class _HomeViewState extends State<HomeView> with TickerProviderStateMixin {
);
// Page Animations
_pageFadeAnimation = Tween<double>(
begin: 0.0,
end: 1.0,
).animate(CurvedAnimation(
parent: _pageAnimationController,
curve: UIConstants.curveNormal,
));
_pageFadeAnimation = Tween<double>(begin: 0.0, end: 1.0).animate(
CurvedAnimation(
parent: _pageAnimationController,
curve: UIConstants.curveNormal,
),
);
_pageSlideAnimation = Tween<Offset>(
begin: const Offset(0, 0.3),
end: Offset.zero,
).animate(CurvedAnimation(
parent: _pageAnimationController,
curve: UIConstants.curveNormal,
));
_pageSlideAnimation =
Tween<Offset>(begin: const Offset(0, 0.3), end: Offset.zero).animate(
CurvedAnimation(
parent: _pageAnimationController,
curve: UIConstants.curveNormal,
),
);
// Cards Animations
_cardsScaleAnimation = Tween<double>(
begin: 0.8,
end: 1.0,
).animate(CurvedAnimation(
parent: _cardsAnimationController,
curve: UIConstants.curveElastic,
));
_cardsScaleAnimation = Tween<double>(begin: 0.8, end: 1.0).animate(
CurvedAnimation(
parent: _cardsAnimationController,
curve: UIConstants.curveElastic,
),
);
// Actions Animations
_actionsScaleAnimation = Tween<double>(
begin: 0.8,
end: 1.0,
).animate(CurvedAnimation(
parent: _actionsAnimationController,
curve: UIConstants.curveElastic,
));
_actionsScaleAnimation = Tween<double>(begin: 0.8, end: 1.0).animate(
CurvedAnimation(
parent: _actionsAnimationController,
curve: UIConstants.curveElastic,
),
);
}
void _startPageAnimation() async {
@ -258,9 +237,7 @@ class _HomeViewState extends State<HomeView> with TickerProviderStateMixin {
Navigator.pushNamed(context, RouteNames.profileView);
},
),
drawer: ModernDrawer(
items: _drawerItems,
),
drawer: ModernDrawer(items: _drawerItems),
body: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
@ -288,34 +265,37 @@ class _HomeViewState extends State<HomeView> with TickerProviderStateMixin {
_buildWelcomeSection(theme, colorScheme, userName),
SizedBox(
height: UIConstants.getResponsiveSpacing(
context,
mobile: UIConstants.spacing32,
tablet: UIConstants.spacing40,
desktop: UIConstants.spacing48,
)),
height: UIConstants.getResponsiveSpacing(
context,
mobile: UIConstants.spacing32,
tablet: UIConstants.spacing40,
desktop: UIConstants.spacing48,
),
),
// Dashboard Stats
_buildDashboardStats(theme, colorScheme),
SizedBox(
height: UIConstants.getResponsiveSpacing(
context,
mobile: UIConstants.spacing40,
tablet: UIConstants.spacing56,
desktop: UIConstants.spacing72,
)),
height: UIConstants.getResponsiveSpacing(
context,
mobile: UIConstants.spacing40,
tablet: UIConstants.spacing56,
desktop: UIConstants.spacing72,
),
),
// Quick Actions
_buildQuickActions(theme, colorScheme),
SizedBox(
height: UIConstants.getResponsiveSpacing(
context,
mobile: UIConstants.spacing40,
tablet: UIConstants.spacing56,
desktop: UIConstants.spacing72,
)),
height: UIConstants.getResponsiveSpacing(
context,
mobile: UIConstants.spacing40,
tablet: UIConstants.spacing56,
desktop: UIConstants.spacing72,
),
),
// Recent Activity Section
_buildRecentActivity(theme, colorScheme),
@ -344,7 +324,10 @@ class _HomeViewState extends State<HomeView> with TickerProviderStateMixin {
}
Widget _buildWelcomeSection(
ThemeData theme, ColorScheme colorScheme, String? userName) {
ThemeData theme,
ColorScheme colorScheme,
String? userName,
) {
return AnimatedBuilder(
animation: _pageAnimationController,
builder: (context, child) {
@ -407,8 +390,8 @@ class _HomeViewState extends State<HomeView> with TickerProviderStateMixin {
final crossAxisCount = UIConstants.isMobile(context)
? 2
: UIConstants.isTablet(context)
? 3
: 4;
? 3
: 4;
// Use fixed mainAxisExtent per breakpoint to avoid overflow
final double mainAxisExtent = UIConstants.isMobile(context)
@ -473,8 +456,8 @@ class _HomeViewState extends State<HomeView> with TickerProviderStateMixin {
final crossAxisCount = UIConstants.isMobile(context)
? 2
: UIConstants.isTablet(context)
? 4
: 6;
? 4
: 6;
return GridView.builder(
shrinkWrap: true,
@ -586,11 +569,7 @@ class _HomeViewState extends State<HomeView> with TickerProviderStateMixin {
color: iconColor.withOpacity(0.1),
borderRadius: BorderRadius.circular(UIConstants.radius8),
),
child: Icon(
icon,
color: iconColor,
size: UIConstants.iconSizeMedium,
),
child: Icon(icon, color: iconColor, size: UIConstants.iconSizeMedium),
),
const SizedBox(width: UIConstants.spacing16),
Expanded(