minor changes
This commit is contained in:
@@ -6,6 +6,7 @@ class SearchTextField extends StatelessWidget {
|
|||||||
final ValueChanged<String> onChanged;
|
final ValueChanged<String> onChanged;
|
||||||
final String hintText;
|
final String hintText;
|
||||||
final VoidCallback onTap;
|
final VoidCallback onTap;
|
||||||
|
final bool showCloseButton;
|
||||||
|
|
||||||
const SearchTextField({
|
const SearchTextField({
|
||||||
Key key,
|
Key key,
|
||||||
@@ -13,6 +14,7 @@ class SearchTextField extends StatelessWidget {
|
|||||||
this.onChanged,
|
this.onChanged,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
this.hintText = 'Search',
|
this.hintText = 'Search',
|
||||||
|
this.showCloseButton = true,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -55,25 +57,27 @@ class SearchTextField extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// Material(
|
if (showCloseButton)
|
||||||
//
|
Material(
|
||||||
// child: IconButton(
|
color: Colors.transparent,
|
||||||
// icon: StreamSvgIcon.close(
|
child: IconButton(
|
||||||
// color: Colors.grey,
|
padding: const EdgeInsets.all(0),
|
||||||
// ),
|
icon: StreamSvgIcon.close_small(
|
||||||
// splashRadius: 24,
|
color: Colors.grey,
|
||||||
// onPressed: () {
|
),
|
||||||
// if (controller.text.isNotEmpty) {
|
splashRadius: 24,
|
||||||
// Future.microtask(
|
onPressed: () {
|
||||||
// () => [
|
if (controller.text.isNotEmpty) {
|
||||||
// controller.clear(),
|
Future.microtask(
|
||||||
// onChanged(''),
|
() => [
|
||||||
// ],
|
controller.clear(),
|
||||||
// );
|
onChanged(''),
|
||||||
// }
|
],
|
||||||
// },
|
);
|
||||||
// ),
|
}
|
||||||
// ),
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -387,4 +387,16 @@ class StreamSvgIcon extends StatelessWidget {
|
|||||||
height: size,
|
height: size,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
factory StreamSvgIcon.close_small({
|
||||||
|
double size,
|
||||||
|
Color color,
|
||||||
|
}) {
|
||||||
|
return StreamSvgIcon(
|
||||||
|
assetName: 'Icon_close_sml.svg',
|
||||||
|
color: color,
|
||||||
|
width: size,
|
||||||
|
height: size,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user