Skip to content

Instantly share code, notes, and snippets.

@Chetan-Goyal
Created August 19, 2022 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chetan-Goyal/6c37cf4a97e37b4e57cff674c324b17f to your computer and use it in GitHub Desktop.
Save Chetan-Goyal/6c37cf4a97e37b4e57cff674c324b17f to your computer and use it in GitHub Desktop.
Test Screen for controller value reset
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