// 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. // Flutter code sample for [TextFormField]. import 'package:flutter/material.dart'; void main() => runApp(const MyApp()); class MyApp extends StatelessWidget { const MyApp({super.key}); static const String _title = 'Flutter Code Sample'; @override Widget build(BuildContext context) { final theme = ThemeData.light(useMaterial3: true); return MaterialApp( theme: theme.copyWith( textTheme: theme.textTheme, ), // Interestingly, we can override the input value via subtitle1's color. // .copyWith(subtitle1: const TextStyle(color: Colors.purple))), title: _title, home: MyWidget(), ); } } class MyWidget extends StatelessWidget { @override Widget build(BuildContext context) { return Material( child: Center( child: TextField( controller: TextEditingController(text: 'this text should be in disabled style'), decoration: const InputDecoration( enabled: false, icon: Icon(Icons.person), ), ), ), ); } }