public FadeTransition transition(BottomNavigationBarType type, BuildContext context)
        {
            Color iconColor;

            if (type == BottomNavigationBarType.shifting)
            {
                iconColor = this._color;
            }
            else
            {
                ThemeData themeData = Theme.of(context);
                iconColor = themeData.brightness == Brightness.light
                    ? themeData.primaryColor
                    : themeData.accentColor;
            }

            return(new FadeTransition(
                       opacity: this._animation,
                       child: new SlideTransition(
                           position: this._animation.drive(
                               new OffsetTween(
                                   begin: new Offset(0.0f, 0.02f), // Slightly down.
                                   end: Offset.zero
                                   )
                               ),
                           child: new IconTheme(
                               data: new IconThemeData(
                                   color: iconColor,
                                   size: 120.0f
                                   ),
                               child: this._icon
                               )
                           )
                       ));
        }
Exemplo n.º 2
0
        public override Widget build(BuildContext context)
        {
            BottomNavigationBar botNavBar = new BottomNavigationBar(
                items: this._navigationViews
                .Select <NavigationIconView, BottomNavigationBarItem>((NavigationIconView navigationView) =>
                                                                      navigationView.item)
                .ToList(),
                currentIndex: this._currentIndex,
                type: this._type,
                onTap: (int index) =>
            {
                this.setState(() =>
                {
                    this._navigationViews[this._currentIndex].controller.reverse();
                    this._currentIndex = index;
                    this._navigationViews[this._currentIndex].controller.forward();
                });
            }
                );

            return(new Scaffold(
                       appBar: new AppBar(
                           title: new Text("Bottom navigation"),
                           actions: new List <Widget>
            {
                new MaterialDemoDocumentationButton(BottomNavigationDemo.routeName),
                new PopupMenuButton <BottomNavigationBarType>(
                    onSelected: (BottomNavigationBarType value) =>
                {
                    this.setState(() => { this._type = value; });
                },
                    itemBuilder: (BuildContext subContext) => new List <PopupMenuEntry <BottomNavigationBarType> >
                {
                    new PopupMenuItem <BottomNavigationBarType>(
                        value: BottomNavigationBarType.fix,
                        child: new Text("Fixed")
                        ),
                    new PopupMenuItem <BottomNavigationBarType>(
                        value: BottomNavigationBarType.shifting,
                        child: new Text("Shifting")
                        )
                }
                    )
            }
                           ),
                       body: new Center(
                           child: this._buildTransitionsStack()
                           ),
                       bottomNavigationBar: botNavBar
                       ));
        }
        static bool _defaultShowUnselected(BottomNavigationBarType type)
        {
            switch (type)
            {
            case BottomNavigationBarType.shifting:
                return(false);

            case BottomNavigationBarType.fix:
                return(true);
            }

            D.assert(false);
            return(false);
        }