search back button
This commit is contained in:
parent
db4b1f8e00
commit
8291857dac
|
|
@ -95,11 +95,18 @@ class LogoAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||
const SizedBox(height: 16),
|
||||
Consumer<HomeState>(
|
||||
builder: (context, state, child) => SearchField(
|
||||
key: ValueKey(state.search),
|
||||
title: state.currentPageIndex == 3 ? 'رصدهای من' : 'دیدوان',
|
||||
onChanged: (value) => _onChanged(value, context),
|
||||
focusNode: FocusNode(),
|
||||
onFilterButtonPressed: () => _showFilterBottomSheet(context),
|
||||
isFiltered: state.filtering && state.search == '',
|
||||
onGoBack: state.filtering
|
||||
? () {
|
||||
state.resetFilters(false);
|
||||
FocusScope.of(context).unfocus();
|
||||
}
|
||||
: null,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ class SearchField extends StatefulWidget {
|
|||
final bool? isFiltered;
|
||||
final void Function(String value) onChanged;
|
||||
final VoidCallback? onFilterButtonPressed;
|
||||
final VoidCallback? onGoBack;
|
||||
|
||||
const SearchField({
|
||||
Key? key,
|
||||
|
|
@ -17,6 +18,7 @@ class SearchField extends StatefulWidget {
|
|||
required this.focusNode,
|
||||
this.onFilterButtonPressed,
|
||||
this.isFiltered,
|
||||
this.onGoBack,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
|
|
@ -107,10 +109,20 @@ class _SearchFieldState extends State<SearchField> {
|
|||
color: Theme.of(context).colorScheme.primary,
|
||||
),
|
||||
),
|
||||
prefixIcon: Icon(
|
||||
prefix: widget.onGoBack != null
|
||||
? DidvanIconButton(
|
||||
gestureSize: 32,
|
||||
icon: DidvanIcons.back_light,
|
||||
color: Theme.of(context).colorScheme.text,
|
||||
onPressed: widget.onGoBack!,
|
||||
)
|
||||
: null,
|
||||
prefixIcon: widget.onGoBack == null
|
||||
? Icon(
|
||||
DidvanIcons.search_regular,
|
||||
color: Theme.of(context).colorScheme.text,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
prefixIconColor: Theme.of(context).colorScheme.inputText,
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: const BorderRadius.all(
|
||||
|
|
|
|||
Loading…
Reference in New Issue