Created
August 30, 2019 17:21
-
-
Save manofi21/9b734ef78f3af1bb83071073f5bb246b to your computer and use it in GitHub Desktop.
how to shoe textfield in flutter
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/material.dart'; | |
void main() => runApp(MyApp()); | |
//textfield sebuah widget yang digunakan user untuk memasukkan kalimat | |
class MyApp extends StatefulWidget { | |
@override | |
_MyAppState createState() => _MyAppState(); | |
} | |
class _MyAppState extends State<MyApp> { | |
TextEditingController controller = TextEditingController(); | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text("text field"), | |
), | |
body: Column( | |
children: <Widget>[ | |
TextField( | |
onChanged: (value) { | |
setState(() {}); | |
}, | |
controller: controller, | |
), | |
Text(controller.text) | |
], | |
), | |
), | |
); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment