feat: add speech_to_text, optimize navigation transitions, improve bottom nav rebuild performance, and fix home screen padding.

This commit is contained in:
pradeepkumar
2026-04-11 02:53:25 +05:30
parent 1abcc2416f
commit e93c979400
4 changed files with 58 additions and 13 deletions

View File

@@ -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',

View File

@@ -38,6 +38,7 @@ class HomeScreen extends ConsumerWidget {
];
return ListView.builder(
controller: scrollController,
padding: EdgeInsets.zero,
itemCount: sections.length,
itemBuilder: (_, i) => sections[i],
);

View File

@@ -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<double> animation,
Animation<double> secondaryAnimation,
Widget child,
) {
// Entering page: slide in from right
final slideIn = Tween<Offset>(
begin: const Offset(1, 0),
end: Offset.zero,
).animate(CurvedAnimation(
parent: animation,
curve: Curves.easeOutCubic,
));
// Exiting page: slide slightly left + dim
final slideOut = Tween<Offset>(
begin: Offset.zero,
end: const Offset(-0.25, 0),
).animate(CurvedAnimation(
parent: secondaryAnimation,
curve: Curves.easeOutCubic,
));
final fadeOut = Tween<double>(begin: 1.0, end: 0.9).animate(
CurvedAnimation(parent: secondaryAnimation, curve: Curves.easeOut),
);
return SlideTransition(
position: Tween<Offset>(
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<double> 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,
),
);