filter badge added
This commit is contained in:
parent
59b3ddc957
commit
530965bff1
|
|
@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class SearchField extends StatefulWidget {
|
class SearchField extends StatefulWidget {
|
||||||
final String title;
|
final String title;
|
||||||
|
final bool? isFiltered;
|
||||||
final void Function(String value) onChanged;
|
final void Function(String value) onChanged;
|
||||||
final VoidCallback? onFilterButtonPressed;
|
final VoidCallback? onFilterButtonPressed;
|
||||||
|
|
||||||
|
|
@ -13,6 +14,7 @@ class SearchField extends StatefulWidget {
|
||||||
required this.title,
|
required this.title,
|
||||||
required this.onChanged,
|
required this.onChanged,
|
||||||
this.onFilterButtonPressed,
|
this.onFilterButtonPressed,
|
||||||
|
this.isFiltered,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
@ -78,19 +80,37 @@ class _SearchFieldState extends State<SearchField> {
|
||||||
border: InputBorder.none,
|
border: InputBorder.none,
|
||||||
hintText: 'جستجو مطلب در ${widget.title}',
|
hintText: 'جستجو مطلب در ${widget.title}',
|
||||||
hintStyle: TextStyle(
|
hintStyle: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.disabledText),
|
color: Theme.of(context).colorScheme.disabledText,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (widget.onFilterButtonPressed != null) const SizedBox(width: 8),
|
if (widget.onFilterButtonPressed != null) const SizedBox(width: 8),
|
||||||
if (widget.onFilterButtonPressed != null)
|
if (widget.onFilterButtonPressed != null)
|
||||||
|
Stack(
|
||||||
|
children: [
|
||||||
DidvanIconButton(
|
DidvanIconButton(
|
||||||
onPressed: widget.onFilterButtonPressed!,
|
onPressed: widget.onFilterButtonPressed!,
|
||||||
icon: DidvanIcons.filter_regular,
|
icon: widget.isFiltered!
|
||||||
|
? DidvanIcons.filter_solid
|
||||||
|
: DidvanIcons.filter_regular,
|
||||||
size: 32,
|
size: 32,
|
||||||
gestureSize: 32,
|
gestureSize: 32,
|
||||||
),
|
),
|
||||||
|
if (widget.isFiltered!)
|
||||||
|
Positioned(
|
||||||
|
child: Container(
|
||||||
|
width: 10,
|
||||||
|
height: 10,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
color: Theme.of(context).colorScheme.secondary,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue