Ad

Text Button In Flutter

- 1 answer

I'm new to flutter want to create below send again text as a button. How can I do that? appreciate your help on this.

Align(
   alignment: Alignment.bottomLeft,
      child: Text(
          'send again  ',
          style: TextStyle(
            height: 1.2,
            fontFamily: 'Dubai',
            fontSize: 13,
            color: Colors.blue,
            fontWeight: FontWeight.w500,
          )
      )
)
Ad

Answer

You can use the TextButton widget for this

TextButton(
    style: TextButton.styleFrom(
              TextStyle(
                height: 1.2,
                fontFamily: 'Dubai',
                fontSize: 13,
                color: Colors.blue,
                fontWeight: FontWeight.w500,
              ),
           ),
    onPressed: () {},
    child: const Text('Send again'),

or you can just wrap your Text widget with gestureDetector

 Align(
   alignment: Alignment.bottomLeft,
              child: GestureDetector(
                  onTap: () {}
                  Text(
                   'send again  ',
                   style: TextStyle(
                    height: 1.2,
                    fontFamily: 'Dubai',
                    fontSize: 13,
                    color: Colors.blue,
                    fontWeight: FontWeight.w500,
                  )
              ))
          )
Ad
source: stackoverflow.com
Ad