mirror of
https://github.com/koloideal/Casha.git
synced 2026-06-10 10:25:28 +03:00
update
This commit is contained in:
@@ -174,5 +174,15 @@ class AppStrings {
|
|||||||
String get reset => _ru ? 'Сброс' : 'Reset';
|
String get reset => _ru ? 'Сброс' : 'Reset';
|
||||||
String get apply => _ru ? 'Применить' : 'Apply';
|
String get apply => _ru ? 'Применить' : 'Apply';
|
||||||
|
|
||||||
|
String get accountsInfoTitle => _ru ? 'Счета' : 'Accounts';
|
||||||
|
String get accountsInfoBalance => _ru
|
||||||
|
? 'У каждого счёта свой баланс, валюта и цвет карточки.'
|
||||||
|
: 'Each account has its own balance, currency and card color.';
|
||||||
|
String get accountsInfoCustomize => _ru
|
||||||
|
? 'Удерживайте карточку для настройки градиента, названия и валюты.'
|
||||||
|
: 'Long-press any card to customize its gradient, name and currency.';
|
||||||
|
String get accountsInfoLimit =>
|
||||||
|
_ru ? 'Максимум 5 счетов.' : 'Maximum 5 accounts.';
|
||||||
|
|
||||||
String get dateLocale => _ru ? 'ru_RU' : 'en_US';
|
String get dateLocale => _ru ? 'ru_RU' : 'en_US';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -264,6 +264,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
)
|
)
|
||||||
: globalCurrencyInfo;
|
: globalCurrencyInfo;
|
||||||
|
|
||||||
|
final activeIndex = ref.watch(activeAccountIndexProvider);
|
||||||
|
final accountsAsync = ref.watch(accountsProvider);
|
||||||
|
final accountCount = accountsAsync.valueOrNull?.length ?? 0;
|
||||||
|
final isOnAddAccountPage =
|
||||||
|
accountCount < 5 && activeIndex == accountCount + 1;
|
||||||
|
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
backgroundColor: Theme.of(context).scaffoldBackgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
@@ -307,7 +313,9 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
floatingActionButton: FloatingActionButton.extended(
|
floatingActionButton: isOnAddAccountPage
|
||||||
|
? null
|
||||||
|
: FloatingActionButton.extended(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
HapticService.medium();
|
HapticService.medium();
|
||||||
context.push('/add');
|
context.push('/add');
|
||||||
@@ -345,6 +353,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
: null,
|
: null,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 16),
|
const SizedBox(height: 16),
|
||||||
|
if (!isOnAddAccountPage) ...[
|
||||||
SummaryRow(
|
SummaryRow(
|
||||||
income: income,
|
income: income,
|
||||||
expense: expense,
|
expense: expense,
|
||||||
@@ -373,16 +382,24 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
Text(
|
Text(
|
||||||
s.transactions,
|
s.transactions,
|
||||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
style: Theme.of(context).textTheme.titleMedium
|
||||||
|
?.copyWith(
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 12),
|
const SizedBox(height: 12),
|
||||||
],
|
],
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
if (isOnAddAccountPage) ...[
|
||||||
|
const SliverFillRemaining(
|
||||||
|
hasScrollBody: false,
|
||||||
|
child: Center(child: _AccountsInfoBlock()),
|
||||||
|
),
|
||||||
|
] else ...[
|
||||||
if (recent.isEmpty)
|
if (recent.isEmpty)
|
||||||
SliverFillRemaining(
|
SliverFillRemaining(
|
||||||
hasScrollBody: false,
|
hasScrollBody: false,
|
||||||
@@ -401,6 +418,7 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
],
|
||||||
const SliverPadding(padding: EdgeInsets.only(bottom: 80)),
|
const SliverPadding(padding: EdgeInsets.only(bottom: 80)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -408,3 +426,79 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class _AccountsInfoBlock extends ConsumerWidget {
|
||||||
|
const _AccountsInfoBlock();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final s = ref.watch(stringsProvider);
|
||||||
|
final onSurface = Theme.of(context).colorScheme.onSurface;
|
||||||
|
return Padding(
|
||||||
|
padding: const EdgeInsets.only(bottom: 60),
|
||||||
|
child: ConstrainedBox(
|
||||||
|
constraints: const BoxConstraints(maxWidth: 260),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const Icon(
|
||||||
|
Icons.account_balance_wallet_rounded,
|
||||||
|
size: 18,
|
||||||
|
color: Color(0xFF7C6DED),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Text(
|
||||||
|
s.accountsInfoTitle,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.w700,
|
||||||
|
color: onSurface,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
const SizedBox(height: 12),
|
||||||
|
_InfoRow(icon: Icons.swap_horiz_rounded, text: s.accountsInfoBalance),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
_InfoRow(icon: Icons.touch_app_rounded, text: s.accountsInfoCustomize),
|
||||||
|
const SizedBox(height: 8),
|
||||||
|
_InfoRow(icon: Icons.lock_outline_rounded, text: s.accountsInfoLimit),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _InfoRow extends StatelessWidget {
|
||||||
|
final IconData icon;
|
||||||
|
final String text;
|
||||||
|
|
||||||
|
const _InfoRow({required this.icon, required this.text});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final onSurface = Theme.of(context).colorScheme.onSurface;
|
||||||
|
return Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Icon(icon, size: 15, color: onSurface.withOpacity(0.4)),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
text,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 13,
|
||||||
|
height: 1.4,
|
||||||
|
color: onSurface.withOpacity(0.5),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user