This commit is contained in:
2026-03-27 14:49:30 +03:00
parent ce324a0a5e
commit 2fc1d3e200
4 changed files with 252 additions and 255 deletions
+4 -22
View File
@@ -432,35 +432,18 @@ class _AddTransactionScreenState extends ConsumerState<AddTransactionScreen>
children: [
ListView(
padding: const EdgeInsets.all(20),
children: [
Stack(
children: [
IgnorePointer(
ignoring: isEditing,
child: TypeToggle(
selected: state.type,
onChanged: (type) => ref
.read(
addTransactionProvider(widget.initial).notifier,
)
.read(addTransactionProvider(widget.initial).notifier)
.setType(type),
isDark: isDark,
isEditing: isEditing,
),
),
if (isEditing)
Positioned(
top: 8,
right: 8,
child: Icon(
Icons.lock_outline,
size: 16,
color: Theme.of(
context,
).colorScheme.onSurface.withOpacity(0.4),
),
),
],
),
const SizedBox(height: 16),
if (isTransfer)
@@ -796,7 +779,6 @@ class _ToAccountDropdownOverlay extends ConsumerWidget {
// Calculate position from trigger key
double top = 340;
double left = 20;
double? width;
if (triggerKey?.currentContext != null) {
final renderBox =
@@ -805,13 +787,12 @@ class _ToAccountDropdownOverlay extends ConsumerWidget {
final size = renderBox.size;
top = offset.dy + size.height + 4;
left = offset.dx;
width = size.width;
}
return Positioned(
top: top,
left: left,
width: width,
child: IntrinsicWidth(
child: Material(
elevation: 8,
borderRadius: BorderRadius.circular(12),
@@ -900,6 +881,7 @@ class _ToAccountDropdownOverlay extends ConsumerWidget {
),
),
),
),
);
}
}
@@ -418,13 +418,6 @@ class _AccountHalf extends StatelessWidget {
),
),
),
if (error != null) ...[
const SizedBox(height: 4),
Text(
error!,
style: const TextStyle(fontSize: 11, color: Color(0xFFE05C6B)),
),
],
],
);
}
@@ -136,7 +136,6 @@ class AccountDropdownOverlay extends ConsumerWidget {
// Calculate position from trigger key
double top = 76;
double left = 20;
double? width;
if (triggerKey?.currentContext != null) {
final renderBox =
@@ -145,13 +144,12 @@ class AccountDropdownOverlay extends ConsumerWidget {
final size = renderBox.size;
top = offset.dy + size.height + 4;
left = offset.dx;
width = size.width;
}
return Positioned(
top: top,
left: left,
width: width,
child: IntrinsicWidth(
child: Material(
elevation: 8,
borderRadius: BorderRadius.circular(12),
@@ -257,6 +255,7 @@ class AccountDropdownOverlay extends ConsumerWidget {
),
),
),
),
);
}
}
@@ -8,12 +8,14 @@ class TypeToggle extends ConsumerWidget {
final TransactionType selected;
final ValueChanged<TransactionType> onChanged;
final bool isDark;
final bool isEditing;
const TypeToggle({
super.key,
required this.selected,
required this.onChanged,
required this.isDark,
this.isEditing = false,
});
@override
@@ -41,6 +43,7 @@ class TypeToggle extends ConsumerWidget {
isSelected: selected == TransactionType.income,
onTap: () => onChanged(TransactionType.income),
isDark: isDark,
showLock: isEditing && selected == TransactionType.income,
),
),
Expanded(
@@ -51,6 +54,7 @@ class TypeToggle extends ConsumerWidget {
isSelected: selected == TransactionType.expense,
onTap: () => onChanged(TransactionType.expense),
isDark: isDark,
showLock: isEditing && selected == TransactionType.expense,
),
),
Expanded(
@@ -64,6 +68,7 @@ class TypeToggle extends ConsumerWidget {
: () => onChanged(TransactionType.transfer),
isDark: isDark,
disabled: transferDisabled,
showLock: isEditing && selected == TransactionType.transfer,
),
),
],
@@ -80,6 +85,7 @@ class _TypeOption extends StatelessWidget {
final VoidCallback? onTap;
final bool isDark;
final bool disabled;
final bool showLock;
const _TypeOption({
required this.icon,
@@ -89,6 +95,7 @@ class _TypeOption extends StatelessWidget {
required this.onTap,
required this.isDark,
this.disabled = false,
this.showLock = false,
});
@override
@@ -99,7 +106,9 @@ class _TypeOption extends StatelessWidget {
return GestureDetector(
onTap: disabled ? null : onTap,
child: AnimatedContainer(
child: Stack(
children: [
AnimatedContainer(
duration: const Duration(milliseconds: 200),
decoration: BoxDecoration(
color: isSelected && !disabled
@@ -118,9 +127,9 @@ class _TypeOption extends StatelessWidget {
icon,
color: isSelected && !disabled
? effectiveColor
: Theme.of(
context,
).colorScheme.onSurface.withOpacity(disabled ? 0.2 : 0.4),
: Theme.of(context).colorScheme.onSurface.withOpacity(
disabled ? 0.2 : 0.4,
),
size: 20,
),
const SizedBox(height: 4),
@@ -128,7 +137,9 @@ class _TypeOption extends StatelessWidget {
label,
style: TextStyle(
fontSize: 11,
fontWeight: isSelected ? FontWeight.w600 : FontWeight.w400,
fontWeight: isSelected
? FontWeight.w600
: FontWeight.w400,
color: isSelected && !disabled
? effectiveColor
: Theme.of(context).colorScheme.onSurface.withOpacity(
@@ -140,6 +151,18 @@ class _TypeOption extends StatelessWidget {
),
),
),
if (showLock)
Positioned(
top: 4,
right: 4,
child: Icon(
Icons.lock_outline,
size: 10,
color: Theme.of(context).colorScheme.onSurface.withOpacity(0.5),
),
),
],
),
);
}
}