Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How can I add an Icon to to Box Decoration?

I want to add an Icon to Box Decoration like this you are seeing images on left side.

enter image description here

How do I add this with box decoration

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Here is the code:

    Container(
             width: 307,
             decoration: BoxDecoration(
                border: Border.all(color: Colors.blueAccent),
               borderRadius: BorderRadius.circular(10.0),
               shape: BoxShape.rectangle,
             ),
           child: CountryListPick(
            onChanged: (list){
              print(list?.name);
                },
              theme: CountryTheme(
                labelColor: Colors.white,
                isShowFlag:true,
                isShowCode: false,
                isShowTitle:true,
                isDownIcon: true,
                showEnglishName: true,
              ),
            ),
           ),

>Solution :

You can use a row as a children of container

Container(
                  width: 307,
                  decoration: BoxDecoration(
                    border: Border.all(color: Colors.blueAccent),
                    borderRadius: BorderRadius.circular(10.0),
                    shape: BoxShape.rectangle,
                  ),
                  child: Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      Flexible(
                        child: Image.asset(
                          "assets/images/cover_placeholder.png",
                          height: 30,
                          width: 30,
                          fit: BoxFit.contain,
                        ),
                      ),
                      SizedBox(width: 12,),
                      Flexible(
                        child: CountryListPick(
                          onChanged: (list){
                            print(list?.name);
                          },
                          theme: CountryTheme(
                            labelColor: Colors.white,
                            isShowFlag:true,
                            isShowCode: false,
                            isShowTitle:true,
                            isDownIcon: true,
                            showEnglishName: true,
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading