Created
July 18, 2019 06:42
-
-
Save ShivamGoyal1899/e6071bfd261c143ff6297a9a5a0187f7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/cupertino.dart'; | |
import 'package:flutter/widgets.dart'; | |
import 'styles.dart'; | |
class SearchBar extends StatelessWidget { | |
const SearchBar({ | |
@required this.controller, | |
@required this.focusNode, | |
}); | |
final TextEditingController controller; | |
final FocusNode focusNode; | |
@override | |
Widget build(BuildContext context) { | |
return DecoratedBox( | |
decoration: BoxDecoration( | |
color: Styles.searchBackground, | |
borderRadius: BorderRadius.circular(10), | |
), | |
child: Padding( | |
padding: const EdgeInsets.symmetric( | |
horizontal: 4, | |
vertical: 8, | |
), | |
child: Row( | |
children: [ | |
const Icon( | |
CupertinoIcons.search, | |
color: Styles.searchIconColor, | |
), | |
Expanded( | |
child: CupertinoTextField( | |
controller: controller, | |
focusNode: focusNode, | |
style: Styles.searchText, | |
cursorColor: Styles.searchCursorColor, | |
), | |
), | |
GestureDetector( | |
onTap: controller.clear, | |
child: const Icon( | |
CupertinoIcons.clear_thick_circled, | |
color: Styles.searchIconColor, | |
), | |
), | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment