From e93c9794001fa21d9d3a9c118f226f86b0509af9 Mon Sep 17 00:00:00 2001 From: pradeepkumar Date: Sat, 11 Apr 2026 02:53:25 +0530 Subject: [PATCH] feat: add speech_to_text, optimize navigation transitions, improve bottom nav rebuild performance, and fix home screen padding. --- ios/Podfile.lock | 15 ++++++ lib/core/widgets/app_bottom_nav_bar.dart | 5 +- .../presentation/screens/home_screen.dart | 1 + lib/routing/app_router.dart | 50 ++++++++++++++----- 4 files changed, 58 insertions(+), 13 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 98d32d6..8710ee3 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -9,6 +9,9 @@ PODS: - GoogleUtilities/Environment (~> 8.0) - GoogleUtilities/UserDefaults (~> 8.0) - PromisesObjC (~> 2.4) + - CwlCatchException (2.2.1): + - CwlCatchExceptionSupport (~> 2.2.1) + - CwlCatchExceptionSupport (2.2.1) - emoji_picker_flutter (0.0.1): - Flutter - FBAEMKit (18.0.2): @@ -121,6 +124,10 @@ PODS: - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS + - speech_to_text (7.2.0): + - CwlCatchException + - Flutter + - FlutterMacOS - sqflite_darwin (0.0.4): - Flutter - FlutterMacOS @@ -143,6 +150,7 @@ DEPENDENCIES: - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) + - speech_to_text (from `.symlinks/plugins/speech_to_text/darwin`) - sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - webview_flutter_wkwebview (from `.symlinks/plugins/webview_flutter_wkwebview/darwin`) @@ -151,6 +159,8 @@ SPEC REPOS: trunk: - AppAuth - AppCheckCore + - CwlCatchException + - CwlCatchExceptionSupport - FBAEMKit - FBSDKCoreKit - FBSDKCoreKit_Basics @@ -193,6 +203,8 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/path_provider_foundation/darwin" shared_preferences_foundation: :path: ".symlinks/plugins/shared_preferences_foundation/darwin" + speech_to_text: + :path: ".symlinks/plugins/speech_to_text/darwin" sqflite_darwin: :path: ".symlinks/plugins/sqflite_darwin/darwin" url_launcher_ios: @@ -203,6 +215,8 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: AppAuth: d4f13a8fe0baf391b2108511793e4b479691fb73 AppCheckCore: cc8fd0a3a230ddd401f326489c99990b013f0c4f + CwlCatchException: 7acc161b299a6de7f0a46a6ed741eae2c8b4d75a + CwlCatchExceptionSupport: 54ccab8d8c78907b57f99717fb19d4cc3bce02dc emoji_picker_flutter: 8e50ec5caac456a23a78637e02c6293ea0ac8771 FBAEMKit: 56a4f5a9607957b547b6458b17a98c5bb2736367 FBSDKCoreKit: 54f1240567e16862ab71c53c33dc347db5c524c5 @@ -231,6 +245,7 @@ SPEC CHECKSUMS: path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47 shared_preferences_foundation: 5086985c1d43c5ba4d5e69a4e8083a389e2909e6 + speech_to_text: 87bf9298952e8d9073be1b6aade6d5758db5170c sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d url_launcher_ios: bb13df5870e8c4234ca12609d04010a21be43dfa webview_flutter_wkwebview: 29eb20d43355b48fe7d07113835b9128f84e3af4 diff --git a/lib/core/widgets/app_bottom_nav_bar.dart b/lib/core/widgets/app_bottom_nav_bar.dart index 5a33c7d..7ac62d0 100644 --- a/lib/core/widgets/app_bottom_nav_bar.dart +++ b/lib/core/widgets/app_bottom_nav_bar.dart @@ -82,8 +82,11 @@ class AppBottomNavBar extends ConsumerWidget { Builder(builder: (context) { final authState = ref.watch(authProvider); final isAuth = authState.status == AuthStatus.authenticated; + // Only watch the unreadCount field — not the entire messaging + // state. This prevents the nav bar from rebuilding on every + // typing event, new message, or status change. final msgUnread = isAuth - ? ref.watch(messagingProvider).unreadCount + ? ref.watch(messagingProvider.select((s) => s.unreadCount)) : 0; return _NavItem( svgPath: 'assets/icons/nav_messages_icon.svg', diff --git a/lib/features/home/presentation/screens/home_screen.dart b/lib/features/home/presentation/screens/home_screen.dart index 8ba1e3a..288e315 100644 --- a/lib/features/home/presentation/screens/home_screen.dart +++ b/lib/features/home/presentation/screens/home_screen.dart @@ -38,6 +38,7 @@ class HomeScreen extends ConsumerWidget { ]; return ListView.builder( controller: scrollController, + padding: EdgeInsets.zero, itemCount: sections.length, itemBuilder: (_, i) => sections[i], ); diff --git a/lib/routing/app_router.dart b/lib/routing/app_router.dart index cf54b17..891124a 100644 --- a/lib/routing/app_router.dart +++ b/lib/routing/app_router.dart @@ -298,26 +298,52 @@ class _HomeRouteWrapper extends ConsumerWidget { } /// Slide from right transition for push-style navigation. +/// The entering page slides in from the right while the exiting page +/// slides slightly left + fades, giving a native iOS-like depth effect. Widget _slideTransition( BuildContext context, Animation animation, Animation secondaryAnimation, Widget child, ) { + // Entering page: slide in from right + final slideIn = Tween( + begin: const Offset(1, 0), + end: Offset.zero, + ).animate(CurvedAnimation( + parent: animation, + curve: Curves.easeOutCubic, + )); + + // Exiting page: slide slightly left + dim + final slideOut = Tween( + begin: Offset.zero, + end: const Offset(-0.25, 0), + ).animate(CurvedAnimation( + parent: secondaryAnimation, + curve: Curves.easeOutCubic, + )); + + final fadeOut = Tween(begin: 1.0, end: 0.9).animate( + CurvedAnimation(parent: secondaryAnimation, curve: Curves.easeOut), + ); + return SlideTransition( - position: Tween( - begin: const Offset(1, 0), - end: Offset.zero, - ).animate(CurvedAnimation(parent: animation, curve: Curves.easeOut)), - child: Container( - color: Colors.white, - child: child, + position: slideOut, + child: FadeTransition( + opacity: fadeOut, + child: SlideTransition( + position: slideIn, + child: DecoratedBox( + decoration: const BoxDecoration(color: Colors.white), + child: child, + ), + ), ), ); } -/// Smooth fade transition for tab-to-tab navigation. -/// Uses a white container behind to prevent content overlap during transition. +/// Smooth crossfade transition for tab-to-tab navigation. Widget _fadeTransition( BuildContext context, Animation animation, @@ -325,9 +351,9 @@ Widget _fadeTransition( Widget child, ) { return FadeTransition( - opacity: CurveTween(curve: Curves.easeIn).animate(animation), - child: Container( - color: Colors.white, + opacity: CurvedAnimation(parent: animation, curve: Curves.easeInOut), + child: DecoratedBox( + decoration: const BoxDecoration(color: Colors.white), child: child, ), );