Created
August 11, 2022 20:44
-
-
Save iapicca/605dba907bf9b3cf67709bd4232620a2 to your computer and use it in GitHub Desktop.
useTextEditingController example
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'; | |
| import 'package:flutter_hooks/flutter_hooks.dart'; | |
| void main() => runApp(const Application()); | |
| class Application extends StatelessWidget { | |
| const Application({super.key}); | |
| @override | |
| Widget build(context) => const MaterialApp(home: HomePage()); | |
| } | |
| class HomePage extends HookWidget { | |
| const HomePage({super.key}); | |
| @override | |
| Widget build(context) { | |
| final controller = useTextEditingController(); | |
| return Scaffold( | |
| body: Center( | |
| child: TextField( | |
| controller: controller, | |
| ), | |
| ), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment