sooxt98 / google_nav_bar

A modern google style nav bar for flutter.
MIT License
726 stars 112 forks source link

Custom Icon support #58

Closed Amr1440 closed 2 years ago

Amr1440 commented 3 years ago

Is it possible to use custom icons from assets ?

sooxt98 commented 3 years ago

just use the leading param in GButton, check out the example https://github.com/sooxt98/google_nav_bar/blob/30e04f0e22be305bf11fc8dbb9805e4842508854/example/lib/main_advance.dart#L100

golnarSheikhBahaie commented 3 years ago

thnx a lot ;)

Amr1440 commented 3 years ago

Sorry i didnt understand what do you mean ? what i want do is like this : Image.asset('assets/images/profile.png'), @sooxt98

Amr1440 commented 3 years ago

@golnarSheikhBahaie Can you please explain @sooxt98 answer to me ?

sooxt98 commented 3 years ago

@Amr1440 Just do this, you're good to go.

GButton(
  // icon: LineIcons.home,
  leading: Image.asset('assets/images/profile.png'),
  text: 'Home',
),

Besides, you could always check back to the example provided https://github.com/sooxt98/google_nav_bar/blob/30e04f0e22be305bf11fc8dbb9805e4842508854/example/lib/main_advance.dart#L139

ghost commented 2 years ago

Icon is required even when you use leading image.

ghost commented 2 years ago

Icon is required even when you use leading image.

Please remove required at least so we can use custom images as Icon or support for Icons natively would be great so we can use assetIcons. Great package but can't seem to go around it.

sooxt98 commented 2 years ago

It’s by design, firstly icon can’t be null it’s required to make all the tabbar leading size stays consistent.

Leading accepts any widget, you just have to pass in dummy icon data as a default size placeholder.

On Tue, 24 Aug 2021 at 2:50 AM, RazaShabbir-vrc @.***> wrote:

Icon is required even when you use leading image.

Please remove required at least so we can use custom images as Icon or support for Icons natively would be great so we can use assetIcons. Great package but can't seem to go around it.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/sooxt98/google_nav_bar/issues/58#issuecomment-904023355, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGCEC4DCONUN66VZZJC3KLT6KJ6BANCNFSM44ESXJTQ .

ghost commented 2 years ago

It’s by design, firstly icon can’t be null it’s required to make all the tabbar leading size stays consistent. Leading accepts any widget, you just have to pass in dummy icon data as a default size placeholder. On Tue, 24 Aug 2021 at 2:50 AM, RazaShabbir-vrc @.***> wrote: Icon is required even when you use leading image. Please remove required at least so we can use custom images as Icon or support for Icons natively would be great so we can use assetIcons. Great package but can't seem to go around it. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#58 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGCEC4DCONUN66VZZJC3KLT6KJ6BANCNFSM44ESXJTQ .

Got it, I think this resolves it. Thanks for the awesome package!