Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding a trailing icon to a TextButton?

Tags:

flutter

dart

Is there a way to add a trailing icon to a TextButton?

Here's my code:

TextButton(
       child: Center(
         child: Text ('Dummy', style: GoogleFonts.openSans (
             color: Colors.white, fontWeight: FontWeight.w400,
             fontSize: 28),),
       ),
       onPressed: () {
         Navigator.push(
           context,
           MaterialPageRoute(builder: (context) => FourteenthRoute(),),);
       }
   ),
like image 299
Leena Marie Avatar asked Jul 13 '26 22:07

Leena Marie


1 Answers

You can simply child widget of the TextButton with Row widget.

          TextButton(
            onPressed: () => {
              Navigator.push(
                context,
                MaterialPageRoute(
                  builder: (context) => FourteenthRoute(),
                ),
              )
            },
            child: Row(
              mainAxisSize: MainAxisSize.min,
              children: [
                Text(
                  "Dummy",
                  style: GoogleFonts.openSans(
                      color: Colors.white,
                      fontWeight: FontWeight.w400,
                      fontSize: 28),
                ),
                Icon(Icons.menu)
              ],
            ),
          ),

like image 113
Sparsh Jain Avatar answered Jul 19 '26 08:07

Sparsh Jain



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!