minor changes

This commit is contained in:
xsahil03x
2020-11-25 16:59:54 +05:30
parent 305b920970
commit 806b34f092
2 changed files with 35 additions and 19 deletions
+23 -19
View File
@@ -6,6 +6,7 @@ class SearchTextField extends StatelessWidget {
final ValueChanged<String> onChanged;
final String hintText;
final VoidCallback onTap;
final bool showCloseButton;
const SearchTextField({
Key key,
@@ -13,6 +14,7 @@ class SearchTextField extends StatelessWidget {
this.onChanged,
this.onTap,
this.hintText = 'Search',
this.showCloseButton = true,
}) : super(key: key);
@override
@@ -55,25 +57,27 @@ class SearchTextField extends StatelessWidget {
),
),
),
// Material(
//
// child: IconButton(
// icon: StreamSvgIcon.close(
// color: Colors.grey,
// ),
// splashRadius: 24,
// onPressed: () {
// if (controller.text.isNotEmpty) {
// Future.microtask(
// () => [
// controller.clear(),
// onChanged(''),
// ],
// );
// }
// },
// ),
// ),
if (showCloseButton)
Material(
color: Colors.transparent,
child: IconButton(
padding: const EdgeInsets.all(0),
icon: StreamSvgIcon.close_small(
color: Colors.grey,
),
splashRadius: 24,
onPressed: () {
if (controller.text.isNotEmpty) {
Future.microtask(
() => [
controller.clear(),
onChanged(''),
],
);
}
},
),
),
],
),
);
+12
View File
@@ -387,4 +387,16 @@ class StreamSvgIcon extends StatelessWidget {
height: size,
);
}
factory StreamSvgIcon.close_small({
double size,
Color color,
}) {
return StreamSvgIcon(
assetName: 'Icon_close_sml.svg',
color: color,
width: size,
height: size,
);
}
}