Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to add icon at right side of RaisedButton?

Tags:

flutter

How to add icon to RaisedButton at the right side

Padding(
       padding: const EdgeInsets.only(top: 15.0),
          child: new SizedBox(
             width: double.infinity,
             child: new RaisedButton(
             textColor: Colors.white,
             color: coloraccent,
             onPressed: () {},
             child: const Text('UPADATE'),
        )),
       ),
like image 281
swathy c s Avatar asked Apr 26 '19 11:04

swathy c s


People also ask

How do I add an icon to an image Flutter?

You can use Icon() widget to add icons to your Flutter App. You have to pass the icon data as an icon to this widget. You can use default available Material icons with Icons class.

How do I make the icon on my right side Flutter?

Displaying Icon on the Right SideStep 1: Add the Row widget inside the ElevatedButton. Step 2: Add the Text('Download') width inside the Row. Step 3: Then add the SizedBox(width: 5,) followed by the actual icon widget i.e. Icon(Icons. download,size: 24.0,).

How do I add an icon to my Highkey?

You can simply add ElevatedButton. icon() widget, you will get the icon property where you can pass Icon data to add Icon on Elevated Button.


2 Answers

You can just wrap your RaisedButton.icon to the Directionality widget:

                    Directionality(
                      textDirection: TextDirection.rtl,
                      child: RaisedButton.icon(
                        onPressed: () {},
                        color: Colors.deepPurple,
                        icon: Icon(
                          Icons.arrow_drop_down,
                          color: Colors.white,
                        ),
                        label: Text(
                          "Category",
                          style: TextStyle(color: Colors.white),
                        ),
                      ),
                    )
like image 133
Abbas Jafari Avatar answered Oct 18 '22 21:10

Abbas Jafari


You can try this out, it works fine for me.

  child: RaisedButton(
                    onPressed: () => navigateToLogin(context),
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.center,
                      children: <Widget>[
                        Text("Continue",style: TextStyle(fontSize: 20)),
                        Icon(Icons.navigate_next)                          
                      ],
                    ),
like image 30
Arun- Avatar answered Oct 18 '22 20:10

Arun-