skip to Main Content

I want to change the font of the labelText with a Google Font. I already imported the package for Google Fonts. Here is the code below:

TextFormField(
                labelText: 'Label Text',
                labelStyle: TextStyle(
                  color: Colors.black,
                  letterSpacing: 1.3,
                  fontFamily: GoogleFonts.openSans().fontFamily,
                ),
              ),
            ),

Is there a way to change the font of the labelText?

2

Answers


  1. Try this way

    TextFormField(
              decoration: InputDecoration(
                labelText: 'Hello',
                labelStyle: GoogleFonts.aboreto(
                  textStyle: TextStyle(
                    fontSize: 16,
                    color: Colors.amber
                  )
                )
              ),
            )
    
    Login or Signup to reply.
  2. TextFormField(
        decoration: InputDecoration(
          labelText: ' text',
          labelStyle: TextStyle( 
            fontStyle: FontStyle.italic,
            fontWeight: FontWeight.bold,
            fontSize: 16.0,
            color: Colors.blue,
          ),
        ),
      ),
    

    you can use like with normal TextStyle

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search