Skip to content

Instantly share code, notes, and snippets.

@manofi21
Created August 30, 2019 17:21
Show Gist options
  • Save manofi21/9b734ef78f3af1bb83071073f5bb246b to your computer and use it in GitHub Desktop.
Save manofi21/9b734ef78f3af1bb83071073f5bb246b to your computer and use it in GitHub Desktop.
how to shoe textfield in flutter
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