sooxt98 / google_nav_bar

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

type 'BorderRadius' is not a subtype of type 'bool' #54

Closed geekhenno closed 3 years ago

geekhenno commented 3 years ago

when I try to add borderRadius in Gbutton I got this error: type 'BorderRadius' is not a subtype of type 'bool'

sooxt98 commented 3 years ago

could you please provide minimal reproducible code?

geekhenno commented 3 years ago
Screen Shot 1442-09-03 at 1 18 27 AM
geekhenno commented 3 years ago

Version 4.0.2

sooxt98 commented 3 years ago

@hennonoman hi there can you upgrade it to v5.0.3 , it should fix your issue

geekhenno commented 3 years ago

I can not because the Flutter verison dose not support it

On Thu, 15 Apr 2021 at 1:51 AM sooxt98 @.***> wrote:

@hennonoman https://github.com/hennonoman hi there can you upgrade it to v5.0.3

— 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/54#issuecomment-819899361, or unsubscribe https://github.com/notifications/unsubscribe-auth/AGD75BP7U3WZPBH5ELRBY7DTIYL65ANCNFSM426HHJYA .

-- [image: photo] Almuhannad Ghaleb Flutter Developer at Albaap A Prince Mohammed Bin Salman Street, An Nada, Riyadh 13317, Saudi Arabia Office no 5 P +966 11 455 5524 Ex:1 <+966+11+455+5524+Ex:1> M +966 54 576 4102 <+966+54+576+4102> E @. @.> W www.albaap.com http://www.albaap.com https://twitter.com/albaapsa https://www.instagram.com/albaapsa/ https://www.snapchat.com/add/albaapsa https://www.facebook.com/albaapSA/ https://www.linkedin.com/company/albaapsa?originalSubdomain=gh https://www.youtube.com/channel/UCbcOuptEiezpmI2focEJ2gQ/featured

Create your own email signature https://www.wisestamp.com/create-own-signature/?utm_source=promotion&utm_medium=signature&utm_campaign=create_your_own&srcid=

sooxt98 commented 3 years ago

here's the manual fixed version, you need to manually replace the google_nav_bar.dart with the code below

View Code ``` dart library google_nav_bar; import 'dart:async'; import 'dart:math'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; class GNav extends StatefulWidget { const GNav({ Key key, this.tabs, this.selectedIndex = 0, this.onTabChange, this.gap, this.padding, this.activeColor, this.color, this.rippleColor, this.hoverColor, this.backgroundColor, this.tabBackgroundColor, this.tabBorderRadius, this.iconSize, this.textStyle, this.curve, this.tabMargin, this.debug, this.duration, this.tabBorder, this.tabActiveBorder, this.tabShadow, this.haptic, this.tabBackgroundGradient, this.mainAxisAlignment = MainAxisAlignment.spaceBetween, }) : super(key: key); final List tabs; final int selectedIndex; final Function onTabChange; final double gap; final double tabBorderRadius; final double iconSize; final Color activeColor; final Color backgroundColor; final Color tabBackgroundColor; final Color color; final Color rippleColor; final Color hoverColor; final EdgeInsetsGeometry padding; final EdgeInsetsGeometry tabMargin; final TextStyle textStyle; final Duration duration; final Curve curve; final bool debug; final bool haptic; final Border tabBorder; final Border tabActiveBorder; final List tabShadow; final Gradient tabBackgroundGradient; final MainAxisAlignment mainAxisAlignment; @override _GNavState createState() => _GNavState(); } class _GNavState extends State { int selectedIndex; bool clickable = true; @override void initState() { super.initState(); } @override Widget build(BuildContext context) { selectedIndex = widget.selectedIndex; return Container( color: widget.backgroundColor ?? Colors.transparent, // padding: EdgeInsets.all(12), // alignment: Alignment.center, child: Row( mainAxisAlignment: widget.mainAxisAlignment, children: widget.tabs .map((t) => GButton( key: t.key, border: t.border ?? widget.tabBorder, activeBorder: t.activeBorder ?? widget.tabActiveBorder, shadow: t.shadow ?? widget.tabShadow, borderRadius: t.borderRadius ?? (widget.tabBorderRadius != null ? BorderRadius.all( Radius.circular(widget.tabBorderRadius)) : const BorderRadius.all(Radius.circular(100.0))), debug: widget.debug ?? false, margin: t.margin ?? widget.tabMargin, active: selectedIndex == widget.tabs.indexOf(t), gap: t.gap ?? widget.gap, iconActiveColor: t.iconActiveColor ?? widget.activeColor, iconColor: t.iconColor ?? widget.color, iconSize: t.iconSize ?? widget.iconSize, textColor: t.textColor ?? widget.activeColor, rippleColor: t.rippleColor ?? widget.rippleColor ?? Colors.transparent, hoverColor: t.hoverColor ?? widget.hoverColor ?? Colors.transparent, padding: t.padding ?? widget.padding, textStyle: t.textStyle ?? widget.textStyle, text: t.text, icon: t.icon, haptic: widget.haptic ?? true, leading: t.leading, curve: widget.curve ?? Curves.easeInCubic, backgroundGradient: t.backgroundGradient ?? widget.tabBackgroundGradient, backgroundColor: t.backgroundColor ?? widget.tabBackgroundColor ?? Colors.transparent, duration: widget.duration ?? const Duration(milliseconds: 500), onPressed: () { if (!clickable) return; setState(() { selectedIndex = widget.tabs.indexOf(t); clickable = false; }); widget.onTabChange(selectedIndex); Future.delayed( widget.duration ?? const Duration(milliseconds: 500), () { setState(() { clickable = true; }); }); }, )) .toList())); } } class GButton extends StatefulWidget { final bool active; final bool debug; final bool haptic; final double gap; final Color iconColor; final Color rippleColor; final Color hoverColor; final Color iconActiveColor; final Color textColor; final EdgeInsetsGeometry padding; final EdgeInsetsGeometry margin; final TextStyle textStyle; final double iconSize; final Function onPressed; final String text; final IconData icon; final Color backgroundColor; final Duration duration; final Curve curve; final Gradient backgroundGradient; final Widget leading; final BorderRadius borderRadius; final Border border; final Border activeBorder; final List shadow; final String semanticLabel; const GButton({ Key key, this.active, this.haptic, this.backgroundColor, this.icon, this.iconColor, this.rippleColor, this.hoverColor, this.iconActiveColor, this.text = '', this.textColor, this.padding, this.margin, this.duration, this.debug, this.gap, this.curve, this.textStyle, this.iconSize, this.leading, this.onPressed, this.backgroundGradient, this.borderRadius, this.border, this.activeBorder, this.shadow, this.semanticLabel, }) : super(key: key); @override _GButtonState createState() => _GButtonState(); } class _GButtonState extends State { @override Widget build(BuildContext context) { return Semantics( label: widget.semanticLabel ?? widget.text, child: Button( borderRadius: widget.borderRadius, border: widget.border, activeBorder: widget.activeBorder, shadow: widget.shadow, debug: widget.debug, duration: widget.duration, iconSize: widget.iconSize, active: widget.active, onPressed: () { if (widget.haptic) HapticFeedback.selectionClick(); widget.onPressed(); }, padding: widget.padding, margin: widget.margin, gap: widget.gap, color: widget.backgroundColor, rippleColor: widget.rippleColor, hoverColor: widget.hoverColor, gradient: widget.backgroundGradient, curve: widget.curve, leading: widget.leading, iconActiveColor: widget.iconActiveColor, iconColor: widget.iconColor, icon: widget.icon, text: Text( widget.text, style: widget.textStyle ?? TextStyle(fontWeight: FontWeight.w600, color: widget.textColor), ), ), ); } } class Button extends StatefulWidget { const Button( {Key key, this.icon, this.iconSize, this.leading, this.iconActiveColor, this.iconColor, this.text, this.gap = 0, this.color, this.rippleColor, this.hoverColor, this.onPressed, this.duration, this.curve, this.padding = const EdgeInsets.all(25), this.margin = const EdgeInsets.all(0), this.active = false, this.debug, this.gradient, this.borderRadius = const BorderRadius.all(Radius.circular(100.0)), this.border, this.activeBorder, this.shadow}) : super(key: key); final IconData icon; final double iconSize; final Text text; final Widget leading; final Color iconActiveColor; final Color iconColor; final Color color; final Color rippleColor; final Color hoverColor; final double gap; final bool active; final bool debug; final VoidCallback onPressed; final EdgeInsetsGeometry padding; final EdgeInsetsGeometry margin; final Duration duration; final Curve curve; final Gradient gradient; final BorderRadius borderRadius; final Border border; final Border activeBorder; final List shadow; @override _ButtonState createState() => _ButtonState(); } class _ButtonState extends State
geekhenno commented 3 years ago

Thank you so much I will replace it and check if it is work

On Thu, 15 Apr 2021 at 2:04 AM sooxt98 @.***> wrote:

here's the manual fixed version, you need to manually replace with the code below

library google_nav_bar; import 'dart:async';import 'dart:math';import 'package:flutter/material.dart';import 'package:flutter/services.dart'; class GNav extends StatefulWidget { const GNav({ Key key, this.tabs, this.selectedIndex = 0, this.onTabChange, this.gap, this.padding, this.activeColor, this.color, this.rippleColor, this.hoverColor, this.backgroundColor, this.tabBackgroundColor, this.tabBorderRadius, this.iconSize, this.textStyle, this.curve, this.tabMargin, this.debug, this.duration, this.tabBorder, this.tabActiveBorder, this.tabShadow, this.haptic, this.tabBackgroundGradient, this.mainAxisAlignment = MainAxisAlignment.spaceBetween, }) : super(key: key);

final List tabs; final int selectedIndex; final Function onTabChange; final double gap; final double tabBorderRadius; final double iconSize; final Color activeColor; final Color backgroundColor; final Color tabBackgroundColor; final Color color; final Color rippleColor; final Color hoverColor; final EdgeInsetsGeometry padding; final EdgeInsetsGeometry tabMargin; final TextStyle textStyle; final Duration duration; final Curve curve; final bool debug; final bool haptic; final Border tabBorder; final Border tabActiveBorder; final List tabShadow; final Gradient tabBackgroundGradient; final MainAxisAlignment mainAxisAlignment;

@override _GNavState createState() => _GNavState(); } class _GNavState extends State { int selectedIndex; bool clickable = true;

@override void initState() { super.initState(); }

@override Widget build(BuildContext context) { selectedIndex = widget.selectedIndex;

return Container(
    color: widget.backgroundColor ?? Colors.transparent,
    // padding: EdgeInsets.all(12),
    // alignment: Alignment.center,
    child: Row(
        mainAxisAlignment: widget.mainAxisAlignment,
        children: widget.tabs
            .map((t) => GButton(
                  key: t.key,
                  border: t.border ?? widget.tabBorder,
                  activeBorder: t.activeBorder ?? widget.tabActiveBorder,
                  shadow: t.shadow ?? widget.tabShadow,
                  borderRadius: t.borderRadius ??
                      (widget.tabBorderRadius != null
                          ? BorderRadius.all(
                              Radius.circular(widget.tabBorderRadius))
                          : const BorderRadius.all(Radius.circular(100.0))),
                  debug: widget.debug ?? false,
                  margin: t.margin ?? widget.tabMargin,
                  active: selectedIndex == widget.tabs.indexOf(t),
                  gap: t.gap ?? widget.gap,
                  iconActiveColor: t.iconActiveColor ?? widget.activeColor,
                  iconColor: t.iconColor ?? widget.color,
                  iconSize: t.iconSize ?? widget.iconSize,
                  textColor: t.textColor ?? widget.activeColor,
                  rippleColor: t.rippleColor ??
                      widget.rippleColor ??
                      Colors.transparent,
                  hoverColor: t.hoverColor ??
                      widget.hoverColor ??
                      Colors.transparent,
                  padding: t.padding ?? widget.padding,
                  textStyle: t.textStyle ?? widget.textStyle,
                  text: t.text,
                  icon: t.icon,
                  haptic: widget.haptic ?? true,
                  leading: t.leading,
                  curve: widget.curve ?? Curves.easeInCubic,
                  backgroundGradient:
                      t.backgroundGradient ?? widget.tabBackgroundGradient,
                  backgroundColor: t.backgroundColor ??
                      widget.tabBackgroundColor ??
                      Colors.transparent,
                  duration:
                      widget.duration ?? const Duration(milliseconds: 500),
                  onPressed: () {
                    if (!clickable) return;
                    setState(() {
                      selectedIndex = widget.tabs.indexOf(t);
                      clickable = false;
                    });
                    widget.onTabChange(selectedIndex);

                    Future.delayed(
                        widget.duration ??
                            const Duration(milliseconds: 500), () {
                      setState(() {
                        clickable = true;
                      });
                    });
                  },
                ))
            .toList()));

} } class GButton extends StatefulWidget { final bool active; final bool debug; final bool haptic; final double gap; final Color iconColor; final Color rippleColor; final Color hoverColor; final Color iconActiveColor; final Color textColor; final EdgeInsetsGeometry padding; final EdgeInsetsGeometry margin; final TextStyle textStyle; final double iconSize; final Function onPressed; final String text; final IconData icon; final Color backgroundColor; final Duration duration; final Curve curve; final Gradient backgroundGradient; final Widget leading; final BorderRadius borderRadius; final Border border; final Border activeBorder; final List shadow; final String semanticLabel;

const GButton({ Key key, this.active, this.haptic, this.backgroundColor, this.icon, this.iconColor, this.rippleColor, this.hoverColor, this.iconActiveColor, this.text = '', this.textColor, this.padding, this.margin, this.duration, this.debug, this.gap, this.curve, this.textStyle, this.iconSize, this.leading, this.onPressed, this.backgroundGradient, this.borderRadius, this.border, this.activeBorder, this.shadow, this.semanticLabel, }) : super(key: key);

@override _GButtonState createState() => _GButtonState(); } class _GButtonState extends State { @override Widget build(BuildContext context) { return Semantics( label: widget.semanticLabel ?? widget.text, child: Button( borderRadius: widget.borderRadius, border: widget.border, activeBorder: widget.activeBorder, shadow: widget.shadow, debug: widget.debug, duration: widget.duration, iconSize: widget.iconSize, active: widget.active, onPressed: () { if (widget.haptic) HapticFeedback.selectionClick(); widget.onPressed(); }, padding: widget.padding, margin: widget.margin, gap: widget.gap, color: widget.backgroundColor, rippleColor: widget.rippleColor, hoverColor: widget.hoverColor, gradient: widget.backgroundGradient, curve: widget.curve, leading: widget.leading, iconActiveColor: widget.iconActiveColor, iconColor: widget.iconColor, icon: widget.icon, text: Text( widget.text, style: widget.textStyle ?? TextStyle(fontWeight: FontWeight.w600, color: widget.textColor), ), ), ); } } class Button extends StatefulWidget { const Button( {Key key, this.icon, this.iconSize, this.leading, this.iconActiveColor, this.iconColor, this.text, this.gap = 0, this.color, this.rippleColor, this.hoverColor, this.onPressed, this.duration, this.curve, this.padding = const EdgeInsets.all(25), this.margin = const EdgeInsets.all(0), this.active = false, this.debug, this.gradient, this.borderRadius = const BorderRadius.all(Radius.circular(100.0)), this.border, this.activeBorder, this.shadow}) : super(key: key);

final IconData icon; final double iconSize; final Text text; final Widget leading; final Color iconActiveColor; final Color iconColor; final Color color; final Color rippleColor; final Color hoverColor; final double gap; final bool active; final bool debug; final VoidCallback onPressed; final EdgeInsetsGeometry padding; final EdgeInsetsGeometry margin; final Duration duration; final Curve curve; final Gradient gradient; final BorderRadius borderRadius; final Border border; final Border activeBorder; final List shadow;

@override _ButtonState createState() => _ButtonState(); } class _ButtonState extends State

Create your own email signature https://www.wisestamp.com/create-own-signature/?utm_source=promotion&utm_medium=signature&utm_campaign=create_your_own&srcid=