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 {
|
||||
final String title;
|
||||
final bool? isFiltered;
|
||||
final void Function(String value) onChanged;
|
||||
final VoidCallback? onFilterButtonPressed;
|
||||
|
||||
|
|
@ -13,6 +14,7 @@ class SearchField extends StatefulWidget {
|
|||
required this.title,
|
||||
required this.onChanged,
|
||||
this.onFilterButtonPressed,
|
||||
this.isFiltered,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
|
|
@ -78,18 +80,36 @@ class _SearchFieldState extends State<SearchField> {
|
|||
border: InputBorder.none,
|
||||
hintText: 'جستجو مطلب در ${widget.title}',
|
||||
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)
|
||||
DidvanIconButton(
|
||||
onPressed: widget.onFilterButtonPressed!,
|
||||
icon: DidvanIcons.filter_regular,
|
||||
size: 32,
|
||||
gestureSize: 32,
|
||||
Stack(
|
||||
children: [
|
||||
DidvanIconButton(
|
||||
onPressed: widget.onFilterButtonPressed!,
|
||||
icon: widget.isFiltered!
|
||||
? DidvanIcons.filter_solid
|
||||
: DidvanIcons.filter_regular,
|
||||
size: 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