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 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(''),
// } ],
// }, );
// ), }
// ), },
),
),
], ],
), ),
); );
+12
View File
@@ -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,
);
}
} }