Created
April 20, 2017 23:29
-
-
Save xster/510bcc738b14fc4ae97758abcf361f7d to your computer and use it in GitHub Desktop.
TextField performance
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(new MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( | |
title: 'Input Demo', | |
theme: new ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: new MyHomePage(title: 'Input Demo'), | |
); | |
} | |
} | |
class MyHomePage extends StatefulWidget { | |
MyHomePage({Key key, this.title}) : super(key: key); | |
final String title; | |
@override | |
_MyHomePageState createState() => new _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { | |
TextEditingController _textController = | |
new TextEditingController(text: 'Initial text'); | |
@override | |
Widget build(BuildContext context) { | |
return new Column( | |
children: [ | |
new Text( | |
_textController.text, | |
softWrap: true, | |
), | |
new Material( | |
child: new Container( | |
height: 64.0, | |
color: new Color(0xFFADD8E6), | |
child: new TextField( | |
controller: _textController, | |
maxLines: 5, | |
), | |
), | |
), | |
], | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment