How To Change Flutter Textformfield Text Color

flutter textformfield text color

Flutter textformfield text color customization. In this article, I will be changing the Flutter textformfield text color with the help of an easy Flutter example code so you can have a better idea of how to customize it in your Flutter project. So let’s start customizing Flutter textformfield text color in Flutter textformfield.

What is Flutter Textformfield Text Color?

Flutter textformfield text color is the color of the input that the user provides to the Flutter textformfield. When the user input something in the Flutter textformfield, it is called the input. It can be number, text etc. Let’s see how we can change the color of that Flutter textformfield text.

Default Flutter Textformfield Text Color

To see the default Flutter textformfield text color, we have to define a simple Flutter textformfield. See the below code:

TextFormField()
flutter textformfield default text color
As you can see in the above image, I have given the Flutter textformfield some input to demonstrate and show the default Flutter textformfield text color.

Change Flutter Textformfield Text Color

Now to change the Flutter textformfield text color, we have to use the style constructor of the Flutter textformfield. Then pass it the text style class and by using the color constructor of the text style class, we can change the color of Flutter textformfield text. See the below code:

 style: TextStyle(color: Colors.green)
flutter textformfield custom text color
In the above image, you can see that the color of the text in Flutter textformfield is now changed.
So in this way you can change the Flutter textformfield text color. If you are still facing any issues related to Flutter textformfield text color then do let me know in the comment section. I would love to answer all of your queries.
I also have prepared a beautiful Flutter textformfield design for you in which Flutter textformfield text color is also customized. The complete source code is available in the next section.

Custom Flutter Textformfield Design Source Code

flutter textformfield text color

import 'package:flutter/material.dart';
void main() {
  runApp(const MyApp());
}
class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Homepage(),
    );
  }
}
class Homepage extends StatefulWidget {
  @override
  State<Homepage> createState() => _HomepageState();
}
class _HomepageState extends State<Homepage> {
  @override
  Widget build(BuildContext context) {
    return SafeArea(
        child: Scaffold(
      body: Center(
          child: Padding(
              padding: EdgeInsets.symmetric(horizontal: 40),
              child: TextFormField(
                style: TextStyle(color: Colors.white),
                decoration: InputDecoration(
                  border: InputBorder.none,
                  enabledBorder: OutlineInputBorder(
                      borderRadius: BorderRadius.circular(50)
                          .copyWith(bottomRight: Radius.circular(0)),
                      borderSide: BorderSide(color: Colors.purple)),
                  filled: true,
                  fillColor: Colors.purple.shade200,
                  focusedBorder: OutlineInputBorder(
                      borderRadius: BorderRadius.circular(50)
                          .copyWith(bottomRight: Radius.circular(0)),
                      borderSide: BorderSide(color: Colors.purple)),
                ),
              ))),
    ));
  }
}

Conclusion

In this post, we have discussed how to implement and customize Flutter textformfield text color with proper Flutter example code. I would love to have your feedback and encourage you to take a look at my other articles on Flutter app development, Flutter widgets, amazing Flutter templates, Flutter animations and more. That’s for this post. Thanks for reading.

Leave a Comment

Your email address will not be published. Required fields are marked *