sooxt98 / google_nav_bar

A modern google style nav bar for flutter.
MIT License
741 stars 114 forks source link

How to assign SvgPicture to 'int' type parameter? #67 #68

Closed sanjhi closed 3 years ago

sanjhi commented 3 years ago

I am trying to add SVG image as an icon in GButton, but it is not working. Please see the screenshot of error and guide how to resolve it? error screenshot

sooxt98 commented 3 years ago

Use leading param

Gbutton(leading: SvgPicture.asset())

https://github.com/sooxt98/google_nav_bar/issues/38

alpondith commented 5 months ago

Use leading param

Gbutton(leading: SvgPicture.asset())

38

This tells me : The named parameter icon is required.

I think icon should be nullable.

OR,

This icon parameter type is 'IconData'. You can make the type as 'Icon'.

sooxt98 commented 5 months ago

The icon is for fallback purpose, simply place put one icon to it

On Sun, 19 May 2024, 7:53 pm AL-IMRAN, @.***> wrote:

Use leading param

Gbutton(leading: SvgPicture.asset())

38 https://github.com/sooxt98/google_nav_bar/issues/38

This tells me : The named parameter icon is required.

I think icon should be nullable.

— Reply to this email directly, view it on GitHub https://github.com/sooxt98/google_nav_bar/issues/68#issuecomment-2119208604, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGCECZAJC7ECXGN6BM3IU3ZDCHEPAVCNFSM5FZTFVQ2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMJRHEZDAOBWGA2A . You are receiving this because you modified the open/close state.Message ID: @.***>

alpondith commented 5 months ago
GButton(
  leading: SvgPicture.asset(
    "path",
    height: 24,
    width: 24,
  ),
  icon: Icons.home,
  text: 'Home',
),

I was getting run time error. Finally i found the reason. While using SvgPicture the height and width must be given. Sharing the code if it helps somebody like me.