Esempio n. 1
0
        protected internal override Widget build(BuildContext context)
        {
            ThemeData   themeData   = Theme.of(context);
            TabBarTheme tabBarTheme = TabBarTheme.of(context);

            TextStyle defaultStyle           = this.labelStyle ?? themeData.primaryTextTheme.body2;
            TextStyle defaultUnselectedStyle =
                this.unselectedLabelStyle ?? this.labelStyle ?? themeData.primaryTextTheme.body2;
            Animation <float> animation = (Animation <float>) this.listenable;
            TextStyle         textStyle = this.selected
                ? TextStyle.lerp(defaultStyle, defaultUnselectedStyle, animation.value)
                : TextStyle.lerp(defaultUnselectedStyle, defaultStyle, animation.value);

            Color selectedColor   = this.labelColor ?? tabBarTheme.labelColor ?? themeData.primaryTextTheme.body2.color;
            Color unselectedColor = this.unselectedLabelColor ??
                                    tabBarTheme.unselectedLabelColor ?? selectedColor.withAlpha(0xB2);
            Color color = this.selected
                ? Color.lerp(selectedColor, unselectedColor, animation.value)
                : Color.lerp(unselectedColor, selectedColor, animation.value);

            return(new DefaultTextStyle(
                       style: textStyle.copyWith(color: color),
                       child: IconTheme.merge(
                           data: new IconThemeData(
                               size: 24.0f,
                               color: color),
                           child: this.child
                           )
                       ));
        }
Esempio n. 2
0
 void _initIndicatorPainter()
 {
     this._indicatorPainter = this._controller == null
         ? null
         : new _IndicatorPainter(
         controller: this._controller,
         indicator: this._indicator,
         indicatorSize: this.widget.indicatorSize ?? TabBarTheme.of(this.context).indicatorSize,
         tabKeys: this._tabKeys,
         old: this._indicatorPainter
         );
 }