| // Copyright 2014 The Flutter Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| import 'package:flutter/material.dart'; |
| /// Flutter code sample for [TextField]. |
| void main() => runApp(const TextFieldExampleApp()); |
| class TextFieldExampleApp extends StatelessWidget { |
| const TextFieldExampleApp({super.key}); |
| Widget build(BuildContext context) { |
| return const MaterialApp( |
| home: TextFieldExample(), |
| class TextFieldExample extends StatefulWidget { |
| const TextFieldExample({super.key}); |
| State<TextFieldExample> createState() => _TextFieldExampleState(); |
| class _TextFieldExampleState extends State<TextFieldExample> { |
| late TextEditingController _controller; |
| _controller = TextEditingController(); |
| Widget build(BuildContext context) { |
| onSubmitted: (String value) async { |
| builder: (BuildContext context) { |
| title: const Text('Thanks!'), |
| content: Text('You typed "$value", which has length ${value.characters.length}.'), |