From c53b0e1885b8662dc6a219598be5e9ec03812d34 Mon Sep 17 00:00:00 2001 From: lokeshramchand-ctrl Date: Wed, 13 Aug 2025 10:22:42 +0530 Subject: [PATCH] Last Commit before UI change --- Backend/.env | 2 +- Backend/index.js | 2 +- .../lib/main_pages/HomePage/homepage.dart | 217 ++++++++++++------ 3 files changed, 150 insertions(+), 71 deletions(-) diff --git a/Backend/.env b/Backend/.env index 045e4cc..dbf9372 100644 --- a/Backend/.env +++ b/Backend/.env @@ -1,4 +1,4 @@ -MONGO_URI=mongodb+srv://velar:Lokesh%401234@cluster0.mplyn1q.mongodb.net/ +MONGO_URI=mongodb+srv://velar:Lokesh%401234@cluster0.mplyn1q.mongodb.net/finance HOST=0.0.0.0 PORT=3000 CORS_ORIGIN=http://192.168.1.100:3000 diff --git a/Backend/index.js b/Backend/index.js index 192970b..d5ca55f 100644 --- a/Backend/index.js +++ b/Backend/index.js @@ -13,7 +13,7 @@ app.use(cors({ const predictRoute = require('./predict'); app.use('/api/predict', predictRoute); -mongoose.connect('mongodb+srv://velar:Lokesh%401234@cluster0.mplyn1q.mongodb.net/finance?retryWrites=true&w=majority&ssl=true&appName=VelarApp', { +mongoose.connect(PROCESS.env.MONGODB_URI, { useNewUrlParser: true, useUnifiedTopology: true, }) diff --git a/Frontend/lib/main_pages/HomePage/homepage.dart b/Frontend/lib/main_pages/HomePage/homepage.dart index 65a48b1..ce78539 100644 --- a/Frontend/lib/main_pages/HomePage/homepage.dart +++ b/Frontend/lib/main_pages/HomePage/homepage.dart @@ -1,6 +1,5 @@ // ignore_for_file: deprecated_member_use, unused_local_variable, use_super_parameters, avoid_print - import 'package:flutter/material.dart'; import 'package:google_fonts/google_fonts.dart'; import 'package:monarch/other_pages/colors.dart'; @@ -9,7 +8,6 @@ import 'package:monarch/main_pages/HomePage/hero_card.dart'; import 'package:monarch/main_pages/HomePage/navbar.dart'; import 'package:monarch/main_pages/HomePage/quick_actions.dart'; import 'package:monarch/support/transcations_recent.dart'; -//import 'package:monarch/static.dart'; class FinTrackHomePage extends StatefulWidget { const FinTrackHomePage({Key? key}) : super(key: key); @@ -20,25 +18,39 @@ class FinTrackHomePage extends StatefulWidget { class _FinTrackHomePageState extends State with TickerProviderStateMixin { - // Modern color palette - - // List to hold recent transactions - + // Animation Controllers late AnimationController _fadeController; late AnimationController _slideController; late Animation _fadeAnimation; late Animation _slideAnimation; - // Sample data for dashboard + // Navigation State + int _selectedIndex = 0; @override void initState() { super.initState(); - fetchRecentTransactions().then((transactions) { - // Do something with the transactions - }); + _initializeData(); + _setupAnimations(); + } + @override + void dispose() { + _fadeController.dispose(); + _slideController.dispose(); + super.dispose(); + } + + // Initialize data fetching + void _initializeData() { + fetchRecentTransactions().then((transactions) { + // Handle transactions data + }); + } + + // Setup animation controllers and animations + void _setupAnimations() { _fadeController = AnimationController( duration: const Duration(milliseconds: 1200), vsync: this, @@ -52,28 +64,128 @@ class _FinTrackHomePageState extends State _fadeAnimation = Tween( begin: 0.0, end: 1.0, - ).animate(CurvedAnimation(parent: _fadeController, curve: Curves.easeOut)); + ).animate(CurvedAnimation( + parent: _fadeController, + curve: Curves.easeOut, + )); _slideAnimation = Tween( begin: const Offset(0, 0.3), end: Offset.zero, - ).animate( - CurvedAnimation(parent: _slideController, curve: Curves.easeOutCubic), - ); + ).animate(CurvedAnimation( + parent: _slideController, + curve: Curves.easeOutCubic, + )); // Start animations _fadeController.forward(); _slideController.forward(); } - @override - void dispose() { - _fadeController.dispose(); - _slideController.dispose(); - super.dispose(); + // Build greeting header with enhanced styling + Widget _buildGreetingHeader() { + return Container( + margin: const EdgeInsets.only(bottom: 24), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + // Greeting Section + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Good Morning! 👋', + style: GoogleFonts.inter( + color: primaryColor, + fontSize: 28, + fontWeight: FontWeight.w700, + height: 1.2, + ), + ), + const SizedBox(height: 4), + Text( + 'Welcome back to your financial dashboard', + style: GoogleFonts.inter( + color: primaryColor.withOpacity(0.7), + fontSize: 14, + fontWeight: FontWeight.w400, + ), + ), + ], + ), + ), + + // Notification Button with enhanced design + Container( + width: 52, + height: 52, + decoration: BoxDecoration( + color: cardColor, + borderRadius: BorderRadius.circular(18), + boxShadow: [ + BoxShadow( + color: accentColor.withOpacity(0.1), + blurRadius: 12, + offset: const Offset(0, 4), + ), + ], + border: Border.all( + color: accentColor.withOpacity(0.1), + width: 1, + ), + ), + child: Material( + color: Colors.transparent, + child: InkWell( + borderRadius: BorderRadius.circular(18), + onTap: () { + // Handle notification tap + }, + child: Icon( + Icons.notifications_outlined, + color: accentColor, + size: 26, + ), + ), + ), + ), + ], + ), + ); } - int _selectedIndex = 0; + // Build main content sections + Widget _buildMainContent() { + return Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + // Balance Card Section + Container( + margin: const EdgeInsets.only(bottom: 28), + child: const BalanceCardPage(), + ), + + // Quick Actions Section + Container( + margin: const EdgeInsets.only(bottom: 28), + child: QuickActionsPage(), + ), + + // Recent Transactions Section + Container( + margin: const EdgeInsets.only(bottom: 32), + child: RecentTransactionsWidget( + recentTransactions: fetchRecentTransactions(), + ), + ), + + // Bottom spacing for FAB + const SizedBox(height: 100), + ], + ); + } @override Widget build(BuildContext context) { @@ -84,60 +196,28 @@ class _FinTrackHomePageState extends State opacity: _fadeAnimation, child: SlideTransition( position: _slideAnimation, - child: SingleChildScrollView( - padding: const EdgeInsets.all(20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Good Morning! 👋', - style: GoogleFonts.inter( - color: primaryColor, - fontSize: 24, - fontWeight: FontWeight.w700, - ), - ), - ], - ), - Container( - width: 48, - height: 48, - decoration: BoxDecoration( - color: accentColor.withOpacity(0.1), - borderRadius: BorderRadius.circular(16), - ), - child: Icon( - Icons.notifications_outlined, - color: accentColor, - size: 24, - ), - ), - ], + child: CustomScrollView( + physics: const BouncingScrollPhysics(), + slivers: [ + SliverToBoxAdapter( + child: Padding( + padding: const EdgeInsets.fromLTRB(20, 16, 20, 0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildGreetingHeader(), + _buildMainContent(), + ], + ), ), - const SizedBox(height: 16), - const BalanceCardPage(), - const SizedBox(height: 24), - QuickActionsPage(), - const SizedBox(height: 24), - RecentTransactionsWidget( - recentTransactions: fetchRecentTransactions(), - ), - const SizedBox(height: 24), - - const SizedBox(height: 32), - ], - ), + ), + ], ), ), ), ), + // Enhanced Floating Action Button floatingActionButton: CustomNavBar( currentIndex: _selectedIndex, onTap: (index) { @@ -147,7 +227,6 @@ class _FinTrackHomePageState extends State accentColor: accentColor, primaryColor: primaryColor, cardColor: cardColor, - floatingActionButtonLocation: FloatingActionButtonLocation.centerTop, ), );