public _BottomNavigationTile(
     BottomNavigationBarType?type,
     BottomNavigationBarItem item,
     Animation <float> animation,
     float?iconSize            = null,
     VoidCallback onTap        = null,
     ColorTween colorTween     = null,
     float?flex                = null,
     bool selected             = false,
     float?selectedFontSize    = null,
     float?unselectedFontSize  = null,
     bool?showSelectedLabels   = null,
     bool?showUnselectedLabels = null,
     string indexLabel         = null
     )
 {
     D.assert(type != null);
     D.assert(item != null);
     D.assert(animation != null);
     D.assert(selectedFontSize != null && selectedFontSize >= 0);
     D.assert(unselectedFontSize != null && unselectedFontSize >= 0);
     this.type                 = type;
     this.item                 = item;
     this.animation            = animation;
     this.iconSize             = iconSize;
     this.onTap                = onTap;
     this.colorTween           = colorTween;
     this.flex                 = flex;
     this.selected             = selected;
     this.selectedFontSize     = selectedFontSize.Value;
     this.unselectedFontSize   = unselectedFontSize.Value;
     this.showSelectedLabels   = showSelectedLabels ?? false;
     this.showUnselectedLabels = showUnselectedLabels ?? false;
     this.indexLabel           = indexLabel;
 }
        static BottomNavigationBarType _type(
            BottomNavigationBarType?type,
            List <BottomNavigationBarItem> items
            )
        {
            if (type != null)
            {
                return(type.Value);
            }

            return(items.Count <= 3 ? BottomNavigationBarType.fix : BottomNavigationBarType.shifting);
        }
示例#3
0
 public BottomNavigationBar(
     Key key = null,
     List <BottomNavigationBarItem> items = null,
     ValueChanged <int> onTap             = null,
     int currentIndex             = 0,
     float elevation              = 8.0f,
     BottomNavigationBarType?type = null,
     Color fixedColor             = null,
     Color backgroundColor        = null,
     float iconSize                    = 24.0f,
     Color selectedItemColor           = null,
     Color unselectedItemColor         = null,
     IconThemeData selectedIconTheme   = null,
     IconThemeData unselectedIconTheme = null,
     float selectedFontSize            = 14.0f,
     float unselectedFontSize          = 12.0f,
     TextStyle selectedLabelStyle      = null,
     TextStyle unselectedLabelStyle    = null,
     bool showSelectedLabels           = true,
     bool?showUnselectedLabels         = null
     ) : base(key: key)
 {
     D.assert(items != null);
     D.assert(items.Count >= 2);
     D.assert(items.All((BottomNavigationBarItem item) => item.title != null) == true,
              () => "Every item must have a non-null title"
              );
     D.assert(0 <= currentIndex && currentIndex < items.Count);
     D.assert(elevation >= 0.0f);
     D.assert(iconSize >= 0.0f);
     D.assert(selectedItemColor == null || fixedColor == null,
              () => "Either selectedItemColor or fixedColor can be specified, but not both!");
     D.assert(selectedFontSize >= 0.0f);
     D.assert(unselectedFontSize >= 0.0f);
     type                      = _type(type, items);
     this.items                = items;
     this.onTap                = onTap;
     this.currentIndex         = currentIndex;
     this.elevation            = elevation;
     this.type                 = type ?? (items.Count <= 3 ? BottomNavigationBarType.fix : BottomNavigationBarType.shifting);
     this.backgroundColor      = backgroundColor;
     this.iconSize             = iconSize;
     this.selectedItemColor    = selectedItemColor ?? fixedColor;
     this.unselectedItemColor  = unselectedItemColor;
     this.selectedIconTheme    = selectedIconTheme;
     this.unselectedIconTheme  = unselectedIconTheme;
     this.selectedFontSize     = selectedFontSize;
     this.unselectedFontSize   = unselectedFontSize;
     this.showSelectedLabels   = showSelectedLabels;
     this.selectedLabelStyle   = selectedLabelStyle;
     this.unselectedLabelStyle = unselectedLabelStyle;
     this.showUnselectedLabels = showUnselectedLabels ?? _defaultShowUnselected(_type(type, items));
 }
示例#4
0
 public _TileIcon(
     Key key = null,
     BottomNavigationBarType?type = null,
     ColorTween colorTween        = null,
     Animation <float> animation  = null,
     float?iconSize = null,
     bool?selected  = null,
     BottomNavigationBarItem item = null
     ) : base(key: key)
 {
     this.type       = type;
     this.colorTween = colorTween;
     this.animation  = animation;
     this.iconSize   = iconSize;
     this.selected   = selected;
     this.item       = item;
 }
示例#5
0
 public _BottomNavigationTile(
     BottomNavigationBarType?type,
     BottomNavigationBarItem item,
     Animation <float> animation,
     float?iconSize        = null,
     VoidCallback onTap    = null,
     ColorTween colorTween = null,
     float?flex            = null,
     bool selected         = false,
     string indexLabel     = null
     )
 {
     this.type       = type;
     this.item       = item;
     this.animation  = animation;
     this.iconSize   = iconSize;
     this.onTap      = onTap;
     this.colorTween = colorTween;
     this.flex       = flex;
     this.selected   = selected;
     this.indexLabel = indexLabel;
 }
示例#6
0
 public BottomNavigationBar(
     Key key = null,
     List <BottomNavigationBarItem> items = null,
     ValueChanged <int> onTap             = null,
     int currentIndex             = 0,
     BottomNavigationBarType?type = null,
     Color fixedColor             = null,
     float iconSize = 24.0f
     ) : base(key: key)
 {
     D.assert(items != null);
     D.assert(items.Count >= 2);
     D.assert(items.All((BottomNavigationBarItem item) => item.title != null) == true,
              "Every item must have a non-null title"
              );
     D.assert(0 <= currentIndex && currentIndex < items.Count);
     this.items        = items;
     this.onTap        = onTap;
     this.currentIndex = currentIndex;
     this.type         = type ?? (items.Count <= 3 ? BottomNavigationBarType.fix : BottomNavigationBarType.shifting);
     this.fixedColor   = fixedColor;
     this.iconSize     = iconSize;
 }