mirror of
https://github.com/koloideal/Casha.git
synced 2026-06-10 10:25:28 +03:00
update
This commit is contained in:
@@ -487,45 +487,47 @@ class _AddTransactionScreenState extends ConsumerState<AddTransactionScreen>
|
|||||||
|
|
||||||
SectionLabel(s.amount),
|
SectionLabel(s.amount),
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Row(
|
IntrinsicHeight(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Row(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
Expanded(
|
children: [
|
||||||
child: AmountInput(
|
Expanded(
|
||||||
controller: _amountController,
|
child: AmountInput(
|
||||||
currencySymbol: overrideCurrency,
|
controller: _amountController,
|
||||||
currencyCode: state.overrideCurrencyCode,
|
currencySymbol: overrideCurrency,
|
||||||
showError: _showError,
|
currencyCode: state.overrideCurrencyCode,
|
||||||
borderColorAnimation: _borderColorAnimation,
|
showError: _showError,
|
||||||
isDark: isDark,
|
borderColorAnimation: _borderColorAnimation,
|
||||||
onChanged: (v) {
|
isDark: isDark,
|
||||||
final parsed = double.tryParse(v);
|
onChanged: (v) {
|
||||||
ref
|
final parsed = double.tryParse(v);
|
||||||
.read(
|
ref
|
||||||
addTransactionProvider(
|
.read(
|
||||||
widget.initial,
|
addTransactionProvider(
|
||||||
).notifier,
|
widget.initial,
|
||||||
)
|
).notifier,
|
||||||
.setAmount(parsed);
|
)
|
||||||
},
|
.setAmount(parsed);
|
||||||
),
|
},
|
||||||
),
|
),
|
||||||
if (!isTransfer) ...[
|
|
||||||
const SizedBox(width: 12),
|
|
||||||
_InlineAccountSelector(
|
|
||||||
initial: widget.initial,
|
|
||||||
showDropdown: _showFromAccountDropdown,
|
|
||||||
onToggleDropdown: () => setState(() {
|
|
||||||
_showFromAccountDropdown =
|
|
||||||
!_showFromAccountDropdown;
|
|
||||||
_fromAccountError = null;
|
|
||||||
}),
|
|
||||||
indicatorKey: _fromAccountIndicatorKey,
|
|
||||||
isDark: isDark,
|
|
||||||
isLocked: isAccountLocked,
|
|
||||||
),
|
),
|
||||||
|
if (!isTransfer) ...[
|
||||||
|
const SizedBox(width: 12),
|
||||||
|
_InlineAccountSelector(
|
||||||
|
initial: widget.initial,
|
||||||
|
showDropdown: _showFromAccountDropdown,
|
||||||
|
onToggleDropdown: () => setState(() {
|
||||||
|
_showFromAccountDropdown =
|
||||||
|
!_showFromAccountDropdown;
|
||||||
|
_fromAccountError = null;
|
||||||
|
}),
|
||||||
|
indicatorKey: _fromAccountIndicatorKey,
|
||||||
|
isDark: isDark,
|
||||||
|
isLocked: isAccountLocked,
|
||||||
|
),
|
||||||
|
],
|
||||||
],
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 20),
|
const SizedBox(height: 20),
|
||||||
|
|
||||||
@@ -621,6 +623,7 @@ class _AddTransactionScreenState extends ConsumerState<AddTransactionScreen>
|
|||||||
initial: widget.initial,
|
initial: widget.initial,
|
||||||
onClose: () =>
|
onClose: () =>
|
||||||
setState(() => _showFromAccountDropdown = false),
|
setState(() => _showFromAccountDropdown = false),
|
||||||
|
triggerKey: _fromAccountIndicatorKey,
|
||||||
),
|
),
|
||||||
if (_showToAccountDropdown)
|
if (_showToAccountDropdown)
|
||||||
Positioned.fill(
|
Positioned.fill(
|
||||||
@@ -634,6 +637,7 @@ class _AddTransactionScreenState extends ConsumerState<AddTransactionScreen>
|
|||||||
_ToAccountDropdownOverlay(
|
_ToAccountDropdownOverlay(
|
||||||
initial: widget.initial,
|
initial: widget.initial,
|
||||||
onClose: () => setState(() => _showToAccountDropdown = false),
|
onClose: () => setState(() => _showToAccountDropdown = false),
|
||||||
|
triggerKey: _toAccountIndicatorKey,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -698,8 +702,10 @@ class _InlineAccountSelector extends ConsumerWidget {
|
|||||||
onTap: onToggleDropdown,
|
onTap: onToggleDropdown,
|
||||||
child: Container(
|
child: Container(
|
||||||
key: indicatorKey,
|
key: indicatorKey,
|
||||||
height: 56,
|
padding: const EdgeInsets.symmetric(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 14),
|
horizontal: 14,
|
||||||
|
vertical: 16,
|
||||||
|
),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).colorScheme.surface,
|
color: Theme.of(context).colorScheme.surface,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
@@ -771,10 +777,12 @@ class _InlineAccountSelector extends ConsumerWidget {
|
|||||||
class _ToAccountDropdownOverlay extends ConsumerWidget {
|
class _ToAccountDropdownOverlay extends ConsumerWidget {
|
||||||
final Transaction? initial;
|
final Transaction? initial;
|
||||||
final VoidCallback onClose;
|
final VoidCallback onClose;
|
||||||
|
final GlobalKey? triggerKey;
|
||||||
|
|
||||||
const _ToAccountDropdownOverlay({
|
const _ToAccountDropdownOverlay({
|
||||||
required this.initial,
|
required this.initial,
|
||||||
required this.onClose,
|
required this.onClose,
|
||||||
|
this.triggerKey,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -785,10 +793,25 @@ class _ToAccountDropdownOverlay extends ConsumerWidget {
|
|||||||
.selectedAccountId;
|
.selectedAccountId;
|
||||||
final toAccountId = ref.read(addTransactionProvider(initial)).toAccountId;
|
final toAccountId = ref.read(addTransactionProvider(initial)).toAccountId;
|
||||||
|
|
||||||
|
// Calculate position from trigger key
|
||||||
|
double top = 340;
|
||||||
|
double left = 20;
|
||||||
|
double? width;
|
||||||
|
|
||||||
|
if (triggerKey?.currentContext != null) {
|
||||||
|
final renderBox =
|
||||||
|
triggerKey!.currentContext!.findRenderObject() as RenderBox;
|
||||||
|
final offset = renderBox.localToGlobal(Offset.zero);
|
||||||
|
final size = renderBox.size;
|
||||||
|
top = offset.dy + size.height + 4;
|
||||||
|
left = offset.dx;
|
||||||
|
width = size.width;
|
||||||
|
}
|
||||||
|
|
||||||
return Positioned(
|
return Positioned(
|
||||||
top: 340,
|
top: top,
|
||||||
left: 20,
|
left: left,
|
||||||
right: 20,
|
width: width,
|
||||||
child: Material(
|
child: Material(
|
||||||
elevation: 8,
|
elevation: 8,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
|||||||
@@ -119,11 +119,13 @@ class AccountSelector extends ConsumerWidget {
|
|||||||
class AccountDropdownOverlay extends ConsumerWidget {
|
class AccountDropdownOverlay extends ConsumerWidget {
|
||||||
final Transaction? initial;
|
final Transaction? initial;
|
||||||
final VoidCallback onClose;
|
final VoidCallback onClose;
|
||||||
|
final GlobalKey? triggerKey;
|
||||||
|
|
||||||
const AccountDropdownOverlay({
|
const AccountDropdownOverlay({
|
||||||
super.key,
|
super.key,
|
||||||
required this.initial,
|
required this.initial,
|
||||||
required this.onClose,
|
required this.onClose,
|
||||||
|
this.triggerKey,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -131,10 +133,25 @@ class AccountDropdownOverlay extends ConsumerWidget {
|
|||||||
final activeAccount = ref.watch(activeAccountProvider);
|
final activeAccount = ref.watch(activeAccountProvider);
|
||||||
final accountsAsync = ref.watch(accountsProvider);
|
final accountsAsync = ref.watch(accountsProvider);
|
||||||
|
|
||||||
|
// Calculate position from trigger key
|
||||||
|
double top = 76;
|
||||||
|
double left = 20;
|
||||||
|
double? width;
|
||||||
|
|
||||||
|
if (triggerKey?.currentContext != null) {
|
||||||
|
final renderBox =
|
||||||
|
triggerKey!.currentContext!.findRenderObject() as RenderBox;
|
||||||
|
final offset = renderBox.localToGlobal(Offset.zero);
|
||||||
|
final size = renderBox.size;
|
||||||
|
top = offset.dy + size.height + 4;
|
||||||
|
left = offset.dx;
|
||||||
|
width = size.width;
|
||||||
|
}
|
||||||
|
|
||||||
return Positioned(
|
return Positioned(
|
||||||
top: 76,
|
top: top,
|
||||||
left: 20,
|
left: left,
|
||||||
right: MediaQuery.of(context).size.width / 2 + 6,
|
width: width,
|
||||||
child: Material(
|
child: Material(
|
||||||
elevation: 8,
|
elevation: 8,
|
||||||
borderRadius: BorderRadius.circular(12),
|
borderRadius: BorderRadius.circular(12),
|
||||||
|
|||||||
Reference in New Issue
Block a user