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