Created
September 3, 2019 09:04
-
-
Save timsneath/284c320678435bd29ae6e7f7aa73d1ce to your computer and use it in GitHub Desktop.
This file contains hidden or 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/material.dart'; | |
| void main() => runApp(MyApp()); | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'Text Editing Demo', | |
| home: SafeArea( | |
| child: MyTextControllerDemo(), | |
| )); | |
| } | |
| } | |
| class MyTextControllerDemo extends StatefulWidget { | |
| @override | |
| _MyTextControllerDemoState createState() => _MyTextControllerDemoState(); | |
| } | |
| class _MyTextControllerDemoState extends State<MyTextControllerDemo> { | |
| TextEditingController _textEditingController = TextEditingController(); | |
| @override | |
| Widget build(BuildContext context) { | |
| return Container( | |
| color: Colors.white, | |
| padding: EdgeInsets.all(10.0), | |
| child: Card( | |
| color: Colors.transparent, | |
| elevation: 8, | |
| child: ClipRRect( | |
| borderRadius: BorderRadius.all(Radius.circular(16.0)), | |
| child: Container( | |
| height: 50.0, | |
| padding: EdgeInsets.symmetric(horizontal: 16.0), | |
| color: Theme.of(context).accentColor, | |
| child: TextField( | |
| decoration: InputDecoration( | |
| icon: Icon(Icons.search), | |
| border: InputBorder.none, | |
| hintStyle: TextStyle(fontSize: 18), | |
| hintText: 'hint'), | |
| textInputAction: TextInputAction.search, | |
| cursorColor: Colors.black, | |
| style: TextStyle(fontSize: 18), | |
| controller: _textEditingController, | |
| ), | |
| ))), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment