Home > Blockchain >  How Do I change the Color of the Register/Login TextButton in FlutterFireUI Screen?
How Do I change the Color of the Register/Login TextButton in FlutterFireUI Screen?

Time:11-19

I'm trying to change the color of the Register button in the "don't have an account? Register" widget in the FlutterFireUI loginScreen page

the button I want to change

I thought it was a TextButton at first like the forget password button so I added the following code inside the ThemeData widget for the MaterialApp

textButtonTheme: TextButtonThemeData(
     style: TextButton.styleFrom(
     foregroundColor:  Color(0xFF6F73D2),// Text Color
    ),
 ),

but it turned out to be a RichText widget instead

I looked online for hours but I can't find how to change its color

CodePudding user response:

Try this code

RichText(
      text: const TextSpan(
        children: <TextSpan>[
          TextSpan(text: "Don't have an account? ", style: TextStyle(color: Colors.black)),
          TextSpan(
              text: ' Register',
              style: TextStyle(fontWeight: FontWeight.bold, color: Colors.blue)),
        ],
      ),
    ),

CodePudding user response:

RichText(
          text: TextSpan(
            text: "Don't have an account? ",
            style: TextStyle(color: Colors.black),
            children: [
              TextSpan(
                text: ' Register',
                style: TextStyle(
                  fontWeight: FontWeight.bold,
                  color: Color(0xFF6F73D2),
                ),
                recognizer: TapGestureRecognizer()
                  ..onTap = () {
                    //BUTTON ACTION
                  },
              ),
            ],
          ),
        ),
  • Related