mirror of
https://github.com/koloideal/Casha.git
synced 2026-06-10 10:25:28 +03:00
update
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../../core/l10n/app_strings.dart';
|
||||
import '../../../shared/providers/amount_format_provider.dart';
|
||||
import '../../../shared/utils/currency_utils.dart';
|
||||
import '../../settings/provider.dart';
|
||||
@@ -9,11 +10,13 @@ class BudgetProgress extends ConsumerWidget {
|
||||
final double spent;
|
||||
final double budget;
|
||||
final CurrencyInfo currencyInfo;
|
||||
final AppStrings strings;
|
||||
const BudgetProgress({
|
||||
super.key,
|
||||
required this.spent,
|
||||
required this.budget,
|
||||
required this.currencyInfo,
|
||||
required this.strings,
|
||||
});
|
||||
|
||||
Border? _themeBorder(BuildContext context) {
|
||||
@@ -51,7 +54,7 @@ class BudgetProgress extends ConsumerWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Monthly Budget',
|
||||
strings.monthlyBudget,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(
|
||||
context,
|
||||
@@ -95,7 +98,7 @@ class BudgetProgress extends ConsumerWidget {
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Text(
|
||||
'Spent: ${formatAmount(currencyInfo.symbol, spent, fmt)}',
|
||||
'${strings.spent}: ${formatAmount(currencyInfo.symbol, spent, fmt)}',
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(
|
||||
context,
|
||||
@@ -103,7 +106,7 @@ class BudgetProgress extends ConsumerWidget {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'Limit: ${formatAmount(currencyInfo.symbol, budget, fmt)}',
|
||||
'${strings.limit}: ${formatAmount(currencyInfo.symbol, budget, fmt)}',
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(
|
||||
context,
|
||||
|
||||
@@ -2,6 +2,8 @@ import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_colorpicker/flutter_colorpicker.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../../core/l10n/app_strings.dart';
|
||||
import '../../../core/l10n/locale_provider.dart';
|
||||
import '../../../core/services/card_color_service.dart';
|
||||
import '../../../core/services/haptic_service.dart';
|
||||
import '../../settings/provider.dart';
|
||||
@@ -96,6 +98,10 @@ class _FullScreenBlurOverlayState extends State<FullScreenBlurOverlay> {
|
||||
),
|
||||
child: StatefulBuilder(
|
||||
builder: (ctx, setPanelState) {
|
||||
final s = AppStrings(
|
||||
ProviderScope.containerOf(widget.context).read(localeProvider),
|
||||
);
|
||||
|
||||
void onHSVChanged(HSVColor hsv) {
|
||||
setPanelState(() {});
|
||||
dash.setState(() {
|
||||
@@ -125,7 +131,7 @@ class _FullScreenBlurOverlayState extends State<FullScreenBlurOverlay> {
|
||||
children: [
|
||||
Expanded(
|
||||
child: PanelTab(
|
||||
label: 'Primary',
|
||||
label: s.colorPrimary,
|
||||
isSelected: dash.editingPrimary,
|
||||
color: dash.tempPrimary,
|
||||
isDimmed: isSolid,
|
||||
@@ -142,7 +148,7 @@ class _FullScreenBlurOverlayState extends State<FullScreenBlurOverlay> {
|
||||
const SizedBox(width: 6),
|
||||
Expanded(
|
||||
child: PanelTab(
|
||||
label: 'Secondary',
|
||||
label: s.colorSecondary,
|
||||
isSelected: !dash.editingPrimary,
|
||||
color: dash.tempSecondary,
|
||||
isDimmed: isSolid,
|
||||
@@ -196,7 +202,7 @@ class _FullScreenBlurOverlayState extends State<FullScreenBlurOverlay> {
|
||||
),
|
||||
),
|
||||
child: Text(
|
||||
'Solid',
|
||||
s.colorSolid,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: isSolid
|
||||
@@ -391,10 +397,10 @@ class _FullScreenBlurOverlayState extends State<FullScreenBlurOverlay> {
|
||||
.map((type) {
|
||||
final isSelected = dash.tempGradientType == type;
|
||||
final label = switch (type) {
|
||||
GradientType.linear => 'Linear',
|
||||
GradientType.linearReverse => 'Reverse',
|
||||
GradientType.radial => 'Radial',
|
||||
GradientType.sweep => 'Sweep',
|
||||
GradientType.linear => s.gradientLinear,
|
||||
GradientType.linearReverse => s.gradientReverse,
|
||||
GradientType.radial => s.gradientRadial,
|
||||
GradientType.sweep => s.gradientSweep,
|
||||
GradientType.solid => '',
|
||||
};
|
||||
final icon = switch (type) {
|
||||
@@ -498,8 +504,8 @@ class _FullScreenBlurOverlayState extends State<FullScreenBlurOverlay> {
|
||||
dash.overlayEntry?.markNeedsBuild();
|
||||
},
|
||||
icon: const Icon(Icons.restart_alt_rounded, size: 15),
|
||||
label: const Text('Reset',
|
||||
style: TextStyle(fontSize: 13)),
|
||||
label: Text(s.reset,
|
||||
style: const TextStyle(fontSize: 13)),
|
||||
style: OutlinedButton.styleFrom(
|
||||
foregroundColor: Theme.of(widget.context)
|
||||
.colorScheme
|
||||
@@ -529,8 +535,8 @@ class _FullScreenBlurOverlayState extends State<FullScreenBlurOverlay> {
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(12)),
|
||||
),
|
||||
child: const Text('Apply',
|
||||
style: TextStyle(
|
||||
child: Text(s.apply,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.w700, fontSize: 14)),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../../core/constants.dart';
|
||||
import '../../../core/l10n/app_strings.dart';
|
||||
import '../../../core/services/haptic_service.dart';
|
||||
import '../provider.dart';
|
||||
|
||||
class FilterChips extends ConsumerWidget {
|
||||
const FilterChips({super.key});
|
||||
final AppStrings strings;
|
||||
const FilterChips({super.key, required this.strings});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -16,13 +18,13 @@ class FilterChips extends ConsumerWidget {
|
||||
return Row(
|
||||
children: [
|
||||
_FilterChip(
|
||||
label: 'All Time',
|
||||
label: strings.filterAllTime,
|
||||
isSelected: timeFilter == TimeFilter.allTime,
|
||||
onTap: () => ref.read(timeFilterProvider.notifier).state = TimeFilter.allTime,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
_FilterChip(
|
||||
label: 'Month',
|
||||
label: strings.filterMonth,
|
||||
isSelected: timeFilter == TimeFilter.lastMonth,
|
||||
onTap: () => ref.read(timeFilterProvider.notifier).state = TimeFilter.lastMonth,
|
||||
),
|
||||
@@ -37,20 +39,20 @@ class FilterChips extends ConsumerWidget {
|
||||
),
|
||||
),
|
||||
_FilterChip(
|
||||
label: 'All',
|
||||
label: strings.filterAll,
|
||||
isSelected: typeFilter == TransactionFilter.all,
|
||||
onTap: () => ref.read(transactionFilterProvider.notifier).state = TransactionFilter.all,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
_FilterChip(
|
||||
label: 'Income',
|
||||
label: strings.filterIncome,
|
||||
isSelected: typeFilter == TransactionFilter.income,
|
||||
color: AppColors.income,
|
||||
onTap: () => ref.read(transactionFilterProvider.notifier).state = TransactionFilter.income,
|
||||
),
|
||||
const SizedBox(width: 6),
|
||||
_FilterChip(
|
||||
label: 'Expense',
|
||||
label: strings.filterExpense,
|
||||
isSelected: typeFilter == TransactionFilter.expense,
|
||||
color: AppColors.expense,
|
||||
onTap: () => ref.read(transactionFilterProvider.notifier).state = TransactionFilter.expense,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../../core/l10n/app_strings.dart';
|
||||
import '../provider.dart';
|
||||
|
||||
class SearchBar extends StatelessWidget {
|
||||
@@ -7,12 +8,14 @@ class SearchBar extends StatelessWidget {
|
||||
final FocusNode focusNode;
|
||||
final VoidCallback onTap;
|
||||
final WidgetRef ref;
|
||||
final AppStrings strings;
|
||||
const SearchBar({
|
||||
super.key,
|
||||
required this.controller,
|
||||
required this.focusNode,
|
||||
required this.onTap,
|
||||
required this.ref,
|
||||
required this.strings,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -23,7 +26,7 @@ class SearchBar extends StatelessWidget {
|
||||
focusNode: focusNode,
|
||||
onTap: onTap,
|
||||
decoration: InputDecoration(
|
||||
hintText: 'Search transactions...',
|
||||
hintText: strings.searchHint,
|
||||
prefixIcon: Icon(
|
||||
Icons.search_rounded,
|
||||
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.6),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import '../../../core/constants.dart';
|
||||
import '../../../core/l10n/app_strings.dart';
|
||||
import '../../../shared/providers/amount_format_provider.dart';
|
||||
import '../../../shared/utils/currency_utils.dart';
|
||||
import '../../settings/provider.dart';
|
||||
@@ -10,11 +11,13 @@ class SummaryRow extends StatelessWidget {
|
||||
final double income;
|
||||
final double expense;
|
||||
final CurrencyInfo currencyInfo;
|
||||
final AppStrings strings;
|
||||
const SummaryRow({
|
||||
super.key,
|
||||
required this.income,
|
||||
required this.expense,
|
||||
required this.currencyInfo,
|
||||
required this.strings,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -23,7 +26,7 @@ class SummaryRow extends StatelessWidget {
|
||||
children: [
|
||||
Expanded(
|
||||
child: SummaryCard(
|
||||
label: 'Income',
|
||||
label: strings.income,
|
||||
amount: income,
|
||||
color: AppColors.income,
|
||||
icon: Icons.arrow_downward_rounded,
|
||||
@@ -33,7 +36,7 @@ class SummaryRow extends StatelessWidget {
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: SummaryCard(
|
||||
label: 'Expenses',
|
||||
label: strings.expenses,
|
||||
amount: expense,
|
||||
color: AppColors.expense,
|
||||
icon: Icons.arrow_upward_rounded,
|
||||
|
||||
@@ -3,6 +3,8 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import '../../../core/constants.dart';
|
||||
import '../../../core/l10n/app_strings.dart';
|
||||
import '../../../core/l10n/locale_provider.dart';
|
||||
import '../../../shared/models/transaction.dart';
|
||||
import '../../../shared/providers/amount_format_provider.dart';
|
||||
import '../../../shared/utils/currency_utils.dart';
|
||||
@@ -18,6 +20,7 @@ class TransactionTile extends ConsumerWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final s = ref.watch(stringsProvider);
|
||||
final fmt = ref.watch(amountFormatProvider);
|
||||
final isIncome = transaction.type == TransactionType.income;
|
||||
final color = isIncome ? AppColors.income : AppColors.expense;
|
||||
@@ -51,7 +54,7 @@ class TransactionTile extends ConsumerWidget {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
transaction.category,
|
||||
s.categoryLabel(transaction.category),
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
@@ -69,7 +72,7 @@ class TransactionTile extends ConsumerWidget {
|
||||
)
|
||||
else
|
||||
Text(
|
||||
DateFormat('MMM d, yyyy · HH:mm').format(transaction.date),
|
||||
DateFormat('d MMM yyyy · HH:mm', s.dateLocale).format(transaction.date),
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: Theme.of(
|
||||
context,
|
||||
@@ -94,7 +97,8 @@ class TransactionTile extends ConsumerWidget {
|
||||
}
|
||||
|
||||
class EmptyState extends StatelessWidget {
|
||||
const EmptyState({super.key});
|
||||
final AppStrings strings;
|
||||
const EmptyState({super.key, required this.strings});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@@ -116,7 +120,7 @@ class EmptyState extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
'No transactions found',
|
||||
strings.noTransactions,
|
||||
style: Theme.of(context).textTheme.titleMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
fontWeight: FontWeight.w600,
|
||||
@@ -124,7 +128,7 @@ class EmptyState extends StatelessWidget {
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
Text(
|
||||
'Tap + to add your first transaction',
|
||||
strings.addFirstTx,
|
||||
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
|
||||
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.6),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user