diff --git a/lib/app.dart b/lib/app.dart index 147b2d4..50c4252 100644 --- a/lib/app.dart +++ b/lib/app.dart @@ -39,9 +39,10 @@ class _YnabAppState extends ConsumerState { @override Widget build(BuildContext context) { final selectedIndex = ref.watch(_selectedIndexProvider); + final theme = Theme.of(context); + final colorScheme = theme.colorScheme; return Scaffold( - backgroundColor: kSurfaceBg, bottomNavigationBar: NavigationBar( selectedIndex: selectedIndex, onDestinationSelected: (int index) { @@ -62,29 +63,29 @@ class _YnabAppState extends ConsumerState { Container( padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12), decoration: BoxDecoration( - color: kSurfaceBg, + color: colorScheme.surface, border: Border( - bottom: BorderSide(color: kDivider, width: 0.5), + bottom: BorderSide(color: colorScheme.outlineVariant, width: 0.5), ), ), child: Row( children: [ Text( _navItems[selectedIndex].label, - style: const TextStyle( - color: kTextPrimary, + style: TextStyle( + color: colorScheme.onSurface, fontSize: 18, fontWeight: FontWeight.w600, ), ), const Spacer(), IconButton( - icon: const Icon(Icons.add, color: kGreenAccent), + icon: Icon(Icons.add, color: colorScheme.primary), onPressed: () {}, tooltip: 'Ajouter une transaction', ), IconButton( - icon: const Icon(Icons.search, color: kTextSecondary), + icon: Icon(Icons.search, color: colorScheme.onSurfaceVariant), onPressed: () {}, tooltip: 'Rechercher', ), diff --git a/lib/screens/accounts_screen.dart b/lib/screens/accounts_screen.dart index 8093ac9..3777ec7 100644 --- a/lib/screens/accounts_screen.dart +++ b/lib/screens/accounts_screen.dart @@ -54,10 +54,10 @@ class _AccountCard extends StatelessWidget { width: 44, height: 44, decoration: BoxDecoration( - color: kSurfaceElevated, + color: Theme.of(context).colorScheme.primaryContainer, borderRadius: BorderRadius.circular(12), ), - child: Icon(_icon(), color: kTextSecondary, size: 22), + child: Icon(_icon(), color: Theme.of(context).colorScheme.onSurfaceVariant, size: 22), ), const SizedBox(width: 14), Expanded( @@ -78,7 +78,7 @@ class _AccountCard extends StatelessWidget { formatCurrency(account.balance), style: Theme.of(context).textTheme.titleMedium?.copyWith( fontWeight: FontWeight.w700, - color: account.balance >= 0 ? kGreenAccent : kRedAccent, + color: account.balance >= 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error, ), ), ], diff --git a/lib/screens/budget_screen.dart b/lib/screens/budget_screen.dart index cf61d62..0dcff66 100644 --- a/lib/screens/budget_screen.dart +++ b/lib/screens/budget_screen.dart @@ -62,7 +62,7 @@ class _CategoryGroupTile extends ConsumerWidget { Icon( expanded ? Icons.keyboard_arrow_down : Icons.keyboard_arrow_right, size: 18, - color: kTextSecondary, + color: Theme.of(context).colorScheme.onSurfaceVariant, ), const SizedBox(width: 8), Text(group.name, @@ -124,7 +124,7 @@ class _CategoryRow extends ConsumerWidget { formatCurrency(remaining), style: Theme.of(context).textTheme.bodyMedium?.copyWith( fontWeight: FontWeight.w600, - color: remaining >= 0 ? kGreenAccent : kRedAccent, + color: remaining >= 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error, ), ), ], @@ -134,9 +134,9 @@ class _CategoryRow extends ConsumerWidget { borderRadius: BorderRadius.circular(4), child: LinearProgressIndicator( value: pct, - backgroundColor: kDivider, + backgroundColor: Theme.of(context).colorScheme.outlineVariant, valueColor: AlwaysStoppedAnimation( - remaining >= 0 ? kGreenAccent : kRedAccent, + remaining >= 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error, ), minHeight: 4, ), diff --git a/lib/screens/dashboard_screen.dart b/lib/screens/dashboard_screen.dart index 218ebe4..e9de735 100644 --- a/lib/screens/dashboard_screen.dart +++ b/lib/screens/dashboard_screen.dart @@ -72,7 +72,7 @@ class _BalanceCard extends StatelessWidget { style: Theme.of(context).textTheme.headlineLarge?.copyWith( fontSize: 36, fontWeight: FontWeight.w700, - color: balance >= 0 ? kGreenAccent : kRedAccent, + color: balance >= 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error, ), ), ], @@ -101,13 +101,13 @@ class _AccountMiniCard extends StatelessWidget { margin: const EdgeInsets.only(bottom: 6), child: ListTile( dense: true, - leading: Icon(_icon(), color: kTextSecondary), + leading: Icon(_icon(), color: Theme.of(context).colorScheme.onSurfaceVariant), title: Text(account.name, style: Theme.of(context).textTheme.bodyMedium), trailing: Text( formatCurrency(account.balance), style: Theme.of(context).textTheme.bodyMedium?.copyWith( fontWeight: FontWeight.w600, - color: account.balance >= 0 ? kGreenAccent : kRedAccent, + color: account.balance >= 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error, ), ), ), @@ -127,11 +127,11 @@ class _TxItem extends StatelessWidget { dense: true, leading: CircleAvatar( radius: 18, - backgroundColor: kSurfaceElevated, + backgroundColor: Theme.of(context).colorScheme.primaryContainer, child: Icon( transaction.amount >= 0 ? Icons.arrow_downward : Icons.arrow_upward, size: 16, - color: transaction.amount >= 0 ? kGreenAccent : kRedAccent, + color: transaction.amount >= 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error, ), ), title: Text(transaction.payee, style: Theme.of(context).textTheme.bodyMedium), @@ -143,7 +143,7 @@ class _TxItem extends StatelessWidget { formatCurrency(transaction.amount), style: Theme.of(context).textTheme.bodyMedium?.copyWith( fontWeight: FontWeight.w600, - color: transaction.amount >= 0 ? kGreenAccent : kRedAccent, + color: transaction.amount >= 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error, ), ), ), diff --git a/lib/screens/transactions_screen.dart b/lib/screens/transactions_screen.dart index 08eac71..500c6c9 100644 --- a/lib/screens/transactions_screen.dart +++ b/lib/screens/transactions_screen.dart @@ -22,11 +22,11 @@ class TransactionsScreen extends ConsumerWidget { dense: true, leading: CircleAvatar( radius: 18, - backgroundColor: kSurfaceElevated, + backgroundColor: Theme.of(context).colorScheme.primaryContainer, child: Icon( t.amount >= 0 ? Icons.arrow_downward : Icons.arrow_upward, size: 16, - color: t.amount >= 0 ? kGreenAccent : kRedAccent, + color: t.amount >= 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error, ), ), title: Text(t.payee, style: Theme.of(context).textTheme.bodyMedium), @@ -42,7 +42,7 @@ class TransactionsScreen extends ConsumerWidget { formatCurrency(t.amount), style: Theme.of(context).textTheme.bodyMedium?.copyWith( fontWeight: FontWeight.w600, - color: t.amount >= 0 ? kGreenAccent : kRedAccent, + color: t.amount >= 0 ? Theme.of(context).colorScheme.primary : Theme.of(context).colorScheme.error, ), ), ], diff --git a/lib/theme/app_theme.dart b/lib/theme/app_theme.dart index e1b96c8..9d005fd 100644 --- a/lib/theme/app_theme.dart +++ b/lib/theme/app_theme.dart @@ -133,6 +133,14 @@ final ThemeData ynabDarkTheme = ThemeData( seedColor: const Color(0xFFCAD8C3), brightness: Brightness.dark, ), + cardTheme: CardThemeData( + elevation: 0, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(12), + side: const BorderSide(color: Color(0xFF43493E), width: 1), + ), + clipBehavior: Clip.antiAlias, + ), ); // Utils