Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion android/build/reports/problems/problems-report.html

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions lib/presentation/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,14 @@ class _HomeScreenState extends State<HomeScreen> {
}

final String? transactionGroupId = transaction.group?.clientId;
final bool isTransfer = transaction.transaction.transferId != null ||
(transaction.transaction.transferClientId?.isNotEmpty ?? false);

// Transfers without an explicit group are global (visible everywhere).
// If a transfer has a group assigned, it follows normal filtering.
if (isTransfer && transactionGroupId == null) {
return true;
}

// Include transaction if:
final bool groupMatches = transactionGroupId == selectedGroupId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import 'package:trakli/presentation/transactions/transaction_extras_section.dart
import 'package:trakli/presentation/transactions/transaction_intent_selector.dart';
import 'package:trakli/presentation/utils/app_navigator.dart';
import 'package:trakli/presentation/utils/custom_auto_complete_search.dart';
import 'package:trakli/presentation/utils/design_tokens.dart';
import 'package:trakli/presentation/utils/enums.dart';
import 'package:trakli/presentation/utils/helpers.dart';
import 'package:trakli/presentation/wallets/add_wallet_screen.dart';
Expand Down Expand Up @@ -204,6 +205,7 @@ class _AddTransactionFormCompactLayoutState
@override
Widget build(BuildContext context) {
super.build(context);
final tones = context.tones;
return SingleChildScrollView(
padding: EdgeInsets.symmetric(
horizontal: 16.w,
Expand All @@ -226,8 +228,9 @@ class _AddTransactionFormCompactLayoutState
decoration: InputDecoration(
hintText: LocaleKeys.exampleAmount.tr(),
labelText: LocaleKeys.transactionAmount.tr(),
fillColor: tones.bgSurface,
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderRadius: BorderRadius.circular(AppRadii.md.r),
borderSide: BorderSide(
color: widget.accentColor,
),
Expand All @@ -254,12 +257,15 @@ class _AddTransactionFormCompactLayoutState
context: context,
theme: CurrencyPickerThemeData(
bottomSheetHeight: 0.7.sh,
backgroundColor:
Theme.of(context).scaffoldBackgroundColor,
backgroundColor: tones.bgSurface,
flagSize: 24.sp,
titleTextStyle: TextStyle(
color: tones.textPrimary,
fontSize: 16.sp,
),
subtitleTextStyle: TextStyle(
fontSize: 12.sp,
color: Theme.of(context).primaryColor,
color: tones.textSecondary,
),
),
onSelect: (Currency currencyValue) {
Expand All @@ -274,7 +280,7 @@ class _AddTransactionFormCompactLayoutState
),
decoration: BoxDecoration(
color: widget.accentColor.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(8.r),
borderRadius: BorderRadius.circular(AppRadii.md.r),
border: Border.all(
color: widget.accentColor.withValues(alpha: 0.35),
width: 1,
Expand Down Expand Up @@ -378,14 +384,19 @@ class _AddTransactionFormCompactLayoutState
controller: dateController,
decoration: InputDecoration(
labelText: LocaleKeys.date.tr(),
fillColor: tones.bgSurface,
suffixIcon: Padding(
padding: const EdgeInsets.all(12),
child: SvgPicture.asset(
Assets.images.calendar,
colorFilter: ColorFilter.mode(
tones.textMuted,
BlendMode.srcIn,
),
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderRadius: BorderRadius.circular(AppRadii.md.r),
borderSide: BorderSide(
color: widget.accentColor,
),
Expand Down Expand Up @@ -416,14 +427,19 @@ class _AddTransactionFormCompactLayoutState
controller: timeController,
decoration: InputDecoration(
labelText: LocaleKeys.time.tr(),
fillColor: tones.bgSurface,
suffixIcon: Padding(
padding: const EdgeInsets.all(12),
child: SvgPicture.asset(
Assets.images.clock,
colorFilter: ColorFilter.mode(
tones.textMuted,
BlendMode.srcIn,
),
),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderRadius: BorderRadius.circular(AppRadii.md.r),
borderSide: BorderSide(
color: widget.accentColor,
),
Expand Down Expand Up @@ -556,8 +572,9 @@ class _AddTransactionFormCompactLayoutState
decoration: InputDecoration(
labelText: LocaleKeys.transactionDescription.tr(),
hintText: LocaleKeys.transactionTypeHere.tr(),
fillColor: tones.bgSurface,
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8),
borderRadius: BorderRadius.circular(AppRadii.md.r),
borderSide: BorderSide(
color: widget.accentColor,
),
Expand Down
71 changes: 46 additions & 25 deletions lib/presentation/transactions/transaction_extras_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,10 @@ class _TransactionExtrasSectionState extends State<TransactionExtrasSection> {
super.initState();
// Edit mode: resolve the linked original expense for display.
if (c.wasRefund && c.refundOfServerId != null && c.refundOfLabel == null) {
final original = context
.read<TransactionCubit>()
.state
.transactions
.firstWhereOrNull(
(t) => t.transaction.id == c.refundOfServerId,
);
final original =
context.read<TransactionCubit>().state.transactions.firstWhereOrNull(
(t) => t.transaction.id == c.refundOfServerId,
);
if (original != null) {
c.refundOfClientId = original.transaction.clientId;
c.syncedRefundOfClientId = original.transaction.clientId;
Expand Down Expand Up @@ -134,9 +131,10 @@ class _TransactionExtrasSectionState extends State<TransactionExtrasSection> {
required ValueChanged<bool> onChanged,
String? helpText,
}) {
final tones = context.tones;
return InkWell(
onTap: () => onChanged(!value),
borderRadius: BorderRadius.circular(4.r),
borderRadius: BorderRadius.circular(AppRadii.xs.r),
child: Row(
children: [
SizedBox(
Expand All @@ -145,6 +143,7 @@ class _TransactionExtrasSectionState extends State<TransactionExtrasSection> {
child: Checkbox(
value: value,
activeColor: widget.accentColor,
side: BorderSide(color: tones.borderMedium, width: 2),
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
onChanged: (v) => onChanged(v ?? false),
),
Expand All @@ -153,10 +152,10 @@ class _TransactionExtrasSectionState extends State<TransactionExtrasSection> {
Flexible(
child: Text(
label,
style: Theme.of(context)
.textTheme
.bodyMedium
?.copyWith(fontWeight: FontWeight.w500),
style: Theme.of(context).textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w500,
color: tones.textPrimary,
),
),
),
if (helpText != null) ...[
Expand All @@ -168,7 +167,7 @@ class _TransactionExtrasSectionState extends State<TransactionExtrasSection> {
child: Icon(
Icons.help_outline,
size: 16.sp,
color: Theme.of(context).hintColor,
color: tones.textMuted,
),
),
],
Expand All @@ -178,14 +177,15 @@ class _TransactionExtrasSectionState extends State<TransactionExtrasSection> {
}

Widget _grayCard(BuildContext context, {required Widget child}) {
final tones = context.tones;
return Container(
width: double.infinity,
padding: EdgeInsets.all(12.r),
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surfaceContainerHighest,
borderRadius: BorderRadius.circular(8.r),
color: tones.bgCard,
borderRadius: BorderRadius.circular(AppRadii.md.r),
border: Border.all(
color: Theme.of(context).dividerColor.withValues(alpha: 0.2),
color: tones.borderLight,
),
),
child: child,
Expand Down Expand Up @@ -219,6 +219,7 @@ class _TransactionExtrasSectionState extends State<TransactionExtrasSection> {
}

Widget _refundSection(BuildContext context) {
final tones = context.tones;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand All @@ -241,10 +242,13 @@ class _TransactionExtrasSectionState extends State<TransactionExtrasSection> {
child: InputDecorator(
decoration: InputDecoration(
labelText: LocaleKeys.refundOf.tr(),
fillColor: tones.bgSurface,
suffixIcon: c.refundOfLabel == null
? const Icon(Icons.keyboard_arrow_down)
? Icon(Icons.keyboard_arrow_down,
color: tones.textMuted)
: IconButton(
icon: Icon(Icons.clear, size: 20.sp),
icon: Icon(Icons.clear,
size: 20.sp, color: tones.textMuted),
onPressed: () => setState(() {
c.refundOfClientId = null;
c.refundOfLabel = null;
Expand All @@ -255,17 +259,20 @@ class _TransactionExtrasSectionState extends State<TransactionExtrasSection> {
c.refundOfLabel ?? LocaleKeys.searchExpenses.tr(),
style: TextStyle(
color: c.refundOfLabel != null
? null
: context.tones.textMuted,
? tones.textPrimary
: tones.textMuted,
fontWeight: FontWeight.w400,
fontSize: 14.sp,
),
),
),
),
SizedBox(height: 4.h),
Text(
LocaleKeys.refundOfHint.tr(),
style: Theme.of(context).textTheme.bodySmall,
style: Theme.of(context).textTheme.bodySmall?.copyWith(
color: tones.textSecondary,
),
),
],
),
Expand All @@ -277,6 +284,7 @@ class _TransactionExtrasSectionState extends State<TransactionExtrasSection> {
}

Widget _recurrenceSection(BuildContext context) {
final tones = context.tones;
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expand All @@ -295,13 +303,19 @@ class _TransactionExtrasSectionState extends State<TransactionExtrasSection> {
children: [
DropdownButtonFormField<String>(
initialValue: c.recurrencePeriod,
dropdownColor: tones.bgSurface,
style: TextStyle(color: tones.textPrimary, fontSize: 14.sp),
decoration: InputDecoration(
labelText: LocaleKeys.recurrencePeriod.tr(),
fillColor: tones.bgSurface,
),
items: const ['daily', 'weekly', 'monthly', 'yearly']
.map((p) => DropdownMenuItem(
value: p,
child: Text(_periodLabel(p)),
child: Text(
_periodLabel(p),
style: TextStyle(color: tones.textPrimary),
),
))
.toList(),
onChanged: (v) =>
Expand All @@ -311,8 +325,10 @@ class _TransactionExtrasSectionState extends State<TransactionExtrasSection> {
TextFormField(
controller: c.recurrenceIntervalController,
keyboardType: TextInputType.number,
style: TextStyle(color: tones.textPrimary),
decoration: InputDecoration(
labelText: LocaleKeys.repeatEvery.tr(),
fillColor: tones.bgSurface,
),
validator: (v) {
if (!c.isRecurring) return null;
Expand All @@ -326,23 +342,28 @@ class _TransactionExtrasSectionState extends State<TransactionExtrasSection> {
SizedBox(height: 12.h),
ListTile(
contentPadding: EdgeInsets.zero,
title: Text(LocaleKeys.recurrenceEndDate.tr()),
title: Text(
LocaleKeys.recurrenceEndDate.tr(),
style: TextStyle(color: tones.textPrimary, fontSize: 14.sp),
),
subtitle: Text(
c.recurrenceEndsAt != null
? _dateFormat.format(c.recurrenceEndsAt!)
: LocaleKeys.noEndDate.tr(),
style: TextStyle(color: tones.textSecondary),
),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (c.recurrenceEndsAt != null)
IconButton(
icon: const Icon(Icons.clear),
icon: Icon(Icons.clear, color: tones.textMuted),
onPressed: () =>
setState(() => c.recurrenceEndsAt = null),
),
IconButton(
icon: const Icon(Icons.calendar_today),
icon:
Icon(Icons.calendar_today, color: tones.textMuted),
onPressed: () async {
final now = DateTime.now();
final picked = await showDatePicker(
Expand Down
Loading
Loading