Created
August 19, 2022 06:27
-
-
Save Chetan-Goyal/6c37cf4a97e37b4e57cff674c324b17f to your computer and use it in GitHub Desktop.
Test Screen for controller value reset
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'; | |
class TestScreen extends StatefulWidget { | |
TestScreen({Key? key}) : super(key: key); | |
final GlobalKey<FormState> _formKey = GlobalKey<FormState>(); | |
final testController = TextEditingController(); | |
@override | |
State<StatefulWidget> createState() => _TestScreenState(); | |
} | |
class _TestScreenState extends State<TestScreen> { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
backgroundColor: Colors.white, | |
appBar: AppBar( | |
backgroundColor: Colors.transparent, | |
elevation: 0.0, | |
iconTheme: const IconThemeData(color: Colors.black, size: 35), | |
title: const Text('Login', style: TextStyle(color: Colors.black)), | |
centerTitle: true, | |
), | |
body: Column( | |
children: [ | |
Form( | |
key: widget._formKey, | |
child: TextFormField( | |
controller: widget.testController, | |
)) | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment