This commit is contained in:
2026-03-20 17:20:29 +03:00
parent 08d5077132
commit a6d393332a
+10 -15
View File
@@ -48,11 +48,6 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_searchFocusNode.addListener(() {
if (_searchFocusNode.hasFocus) {
_scrollToSearch();
}
});
} }
@override @override
@@ -66,9 +61,9 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
void _scrollToSearch() { void _scrollToSearch() {
if (!_scrollController.hasClients) return; if (!_scrollController.hasClients) return;
_scrollController.animateTo( _scrollController.animateTo(
320.0, 400.0,
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 500),
curve: Curves.easeOut, curve: Curves.fastOutSlowIn,
); );
} }
@@ -139,14 +134,11 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
_BudgetProgress(spent: monthExpense, budget: budget, currencyInfo: currencyInfo), _BudgetProgress(spent: monthExpense, budget: budget, currencyInfo: currencyInfo),
], ],
const SizedBox(height: 24), const SizedBox(height: 24),
GestureDetector( _SearchBar(
controller: _searchController,
focusNode: _searchFocusNode,
onTap: _scrollToSearch, onTap: _scrollToSearch,
behavior: HitTestBehavior.translucent, ref: ref,
child: _SearchBar(
controller: _searchController,
focusNode: _searchFocusNode,
ref: ref,
),
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
_FilterChips(selected: filter, ref: ref), _FilterChips(selected: filter, ref: ref),
@@ -192,10 +184,12 @@ class _DashboardScreenState extends ConsumerState<DashboardScreen> {
class _SearchBar extends StatelessWidget { class _SearchBar extends StatelessWidget {
final TextEditingController controller; final TextEditingController controller;
final FocusNode focusNode; final FocusNode focusNode;
final VoidCallback onTap;
final WidgetRef ref; final WidgetRef ref;
const _SearchBar({ const _SearchBar({
required this.controller, required this.controller,
required this.focusNode, required this.focusNode,
required this.onTap,
required this.ref, required this.ref,
}); });
@@ -204,6 +198,7 @@ class _SearchBar extends StatelessWidget {
return TextField( return TextField(
controller: controller, controller: controller,
focusNode: focusNode, focusNode: focusNode,
onTap: onTap,
decoration: InputDecoration( decoration: InputDecoration(
hintText: 'Search transactions...', hintText: 'Search transactions...',
prefixIcon: Icon(Icons.search_rounded, color: Theme.of(context).colorScheme.onSurface.withOpacity(0.6)), prefixIcon: Icon(Icons.search_rounded, color: Theme.of(context).colorScheme.onSurface.withOpacity(0.6)),