Exemple #1
0
 public MaterialApp(
     Key key = null,
     GlobalKey <NavigatorState> navigatorKey = null,
     Widget home = null,
     Dictionary <string, WidgetBuilder> routes = null,
     string initialRoute          = null,
     RouteFactory onGenerateRoute = null,
     InitialRouteListFactory onGenerateInitialRoutes = null,
     RouteFactory onUnknownRoute = null,
     List <NavigatorObserver> navigatorObservers = null,
     TransitionBuilder builder = null,
     string title = "",
     GenerateAppTitle onGenerateTitle = null,
     Color color         = null,
     ThemeData theme     = null,
     ThemeData darkTheme = null,
     ThemeMode themeMode = ThemeMode.system,
     Locale locale       = null,
     List <LocalizationsDelegate> localizationsDelegates       = null,
     LocaleListResolutionCallback localeListResolutionCallback = null,
     LocaleResolutionCallback localeResolutionCallback         = null,
     List <Locale> supportedLocales               = null,
     bool showPerformanceOverlay                  = false,
     bool checkerboardRasterCacheImages           = false,
     bool checkerboardOffscreenLayers             = false,
     bool debugShowCheckedModeBanner              = true,
     Dictionary <LogicalKeySet, Intent> shortcuts = null,
     Dictionary <LocalKey, ActionFactory> actions = null
     ) : base(key: key)
 {
     supportedLocales = supportedLocales ?? new List <Locale> {
         new Locale("en", "US")
     };
     this.navigatorKey                  = navigatorKey;
     this.home                          = home;
     this.routes                        = routes ?? new Dictionary <string, WidgetBuilder>();
     this.onGenerateInitialRoutes       = onGenerateInitialRoutes;
     this.initialRoute                  = initialRoute;
     this.onGenerateRoute               = onGenerateRoute;
     this.onUnknownRoute                = onUnknownRoute;
     this.navigatorObservers            = navigatorObservers ?? new List <NavigatorObserver>();
     this.builder                       = builder;
     this.title                         = title;
     this.onGenerateTitle               = onGenerateTitle;
     this.color                         = color;
     this.theme                         = theme;
     this.darkTheme                     = darkTheme;
     this.themeMode                     = themeMode;
     this.locale                        = locale;
     this.localizationsDelegates        = localizationsDelegates;
     this.localeListResolutionCallback  = localeListResolutionCallback;
     this.localeResolutionCallback      = localeResolutionCallback;
     this.supportedLocales              = supportedLocales;
     this.showPerformanceOverlay        = showPerformanceOverlay;
     this.checkerboardRasterCacheImages = checkerboardRasterCacheImages;
     this.checkerboardOffscreenLayers   = checkerboardOffscreenLayers;
     this.debugShowCheckedModeBanner    = debugShowCheckedModeBanner;
     this.shortcuts                     = shortcuts;
     this.actions                       = actions;
 }
Exemple #2
0
        Color _textColor(ThemeData theme, ListTileTheme tileTheme, Color defaultColor)
        {
            if (!enabled)
            {
                return(theme.disabledColor);
            }

            if (selected && tileTheme?.selectedColor != null)
            {
                return(tileTheme.selectedColor);
            }

            if (!selected && tileTheme?.textColor != null)
            {
                return(tileTheme.textColor);
            }

            if (selected)
            {
                switch (theme.brightness)
                {
                case Brightness.light:
                    return(theme.primaryColor);

                case Brightness.dark:
                    return(theme.accentColor);
                }
            }

            return(defaultColor);
        }
Exemple #3
0
 public static Widget merge(
     Key key             = null,
     bool?dense          = null,
     ListTileStyle?style = null,
     Color selectedColor = null,
     Color iconColor     = null,
     Color textColor     = null,
     EdgeInsetsGeometry contentPadding = null,
     Widget child = null)
 {
     D.assert(child != null);
     return(new Builder(
                builder: (BuildContext context) => {
         ListTileTheme parent = of(context);
         return new ListTileTheme(
             key: key,
             dense: dense ?? parent.dense,
             style: style ?? parent.style,
             selectedColor: selectedColor ?? parent.selectedColor,
             iconColor: iconColor ?? parent.iconColor,
             textColor: textColor ?? parent.textColor,
             contentPadding: contentPadding ?? parent.contentPadding,
             child: child);
     }
                ));
 }
Exemple #4
0
        public static Image network(
            string src,
            Key key                              = null,
            double scale                         = 1.0,
            double?width                         = null,
            double?height                        = null,
            Color color                          = null,
            BlendMode colorBlendMode             = BlendMode.srcIn,
            BoxFit?fit                           = null,
            Alignment alignment                  = null,
            ImageRepeat repeat                   = ImageRepeat.noRepeat,
            Rect centerSlice                     = null,
            bool gaplessPlayback                 = false,
            FilterMode filterMode                = FilterMode.Point,
            IDictionary <string, string> headers = null
            )
        {
            var networkImage = new NetworkImage(src, scale, headers);

            return(new Image(
                       key,
                       networkImage,
                       width,
                       height,
                       color,
                       colorBlendMode,
                       fit,
                       alignment,
                       repeat,
                       centerSlice,
                       gaplessPlayback,
                       filterMode
                       ));
        }
Exemple #5
0
 public RenderImage(
     Image image              = null,
     double?width             = null,
     double?height            = null,
     double scale             = 1.0,
     Color color              = null,
     BlendMode colorBlendMode = BlendMode.srcIn,
     BoxFit?fit            = null,
     Alignment alignment   = null,
     ImageRepeat repeat    = ImageRepeat.noRepeat,
     Rect centerSlice      = null,
     bool invertColors     = false,
     FilterMode filterMode = FilterMode.Point
     )
 {
     this._image          = image;
     this._width          = width;
     this._height         = height;
     this._scale          = scale;
     this._color          = color;
     this._colorBlendMode = colorBlendMode;
     this._fit            = fit;
     this._repeat         = repeat;
     this._centerSlice    = centerSlice;
     this._alignment      = alignment ?? Alignment.center;
     this._invertColors   = invertColors;
     this._filterMode     = filterMode;
 }
        void _pushCircle(int index)
        {
            if (this.widget.items[index].backgroundColor != null)
            {
                _Circle circle = new _Circle(
                    state: this,
                    index: index,
                    color: this.widget.items[index].backgroundColor,
                    vsync: this
                    );
                circle.controller.addStatusListener(
                    (AnimationStatus status) => {
                    switch (status)
                    {
                    case AnimationStatus.completed:
                        this.setState(() => {
                            _Circle cir           = this._circles.Dequeue();
                            this._backgroundColor = cir.color;
                            cir.dispose();
                        });
                        break;

                    case AnimationStatus.dismissed:
                    case AnimationStatus.forward:
                    case AnimationStatus.reverse:
                        break;
                    }
                }
                    );
                this._circles.Enqueue(circle);
            }
        }
Exemple #7
0
        public static Image memory(
            byte[] bytes,
            Key key                  = null,
            double scale             = 1.0,
            double?width             = null,
            double?height            = null,
            Color color              = null,
            BlendMode colorBlendMode = BlendMode.srcIn,
            BoxFit?fit               = null,
            Alignment alignment      = null,
            ImageRepeat repeat       = ImageRepeat.noRepeat,
            Rect centerSlice         = null,
            bool gaplessPlayback     = false,
            FilterMode filterMode    = FilterMode.Point
            )
        {
            var memoryImage = new MemoryImage(bytes, scale);

            return(new Image(
                       key,
                       memoryImage,
                       width,
                       height,
                       color,
                       colorBlendMode,
                       fit,
                       alignment,
                       repeat,
                       centerSlice,
                       gaplessPlayback,
                       filterMode
                       ));
        }
Exemple #8
0
 public _DropdownRoute(
     List <_MenuItem <T> > items = null,
     EdgeInsetsGeometry padding  = null,
     Rect buttonRect             = null,
     int?selectedIndex           = null,
     int elevation       = 8,
     ThemeData theme     = null,
     TextStyle style     = null,
     string barrierLabel = null,
     float?itemHeight    = null,
     Color dropdownColor = null
     )
 {
     D.assert(style != null);
     this.items         = items;
     this.padding       = padding;
     this.buttonRect    = buttonRect;
     this.selectedIndex = selectedIndex;
     this.elevation     = elevation;
     this.theme         = theme;
     this.style         = style;
     this.barrierLabel  = barrierLabel;
     this.itemHeight    = itemHeight;
     this.dropdownColor = dropdownColor;
     itemHeights        = Enumerable.Repeat(itemHeight ?? material_.kMinInteractiveDimension, items.Count).ToList();
 }
Exemple #9
0
 public _DropdownRoutePage(
     Key key = null,
     _DropdownRoute <T> route    = null,
     BoxConstraints constraints  = null,
     List <_MenuItem <T> > items = null,
     EdgeInsetsGeometry padding  = null,
     Rect buttonRect             = null,
     int?selectedIndex           = null,
     int elevation       = 0,
     ThemeData theme     = null,
     TextStyle style     = null,
     Color dropdownColor = null
     ) : base(key: key)
 {
     this.route         = route;
     this.constraints   = constraints;
     this.items         = items;
     this.padding       = padding;
     this.buttonRect    = buttonRect;
     this.selectedIndex = selectedIndex;
     this.elevation     = elevation;
     this.theme         = theme;
     this.style         = style;
     this.dropdownColor = dropdownColor;
 }
Exemple #10
0
 public WaveAnimation(Size size, Color color, int xOffset = 0, int yOffset = 0)
 {
     this.size    = size;
     this.color   = color;
     this.xOffset = xOffset;
     this.yOffset = yOffset;
 }
Exemple #11
0
 public static SliderThemeData lerp(SliderThemeData a, SliderThemeData b, float t)
 {
     D.assert(a != null);
     D.assert(b != null);
     return(new SliderThemeData(
                trackHeight: MathUtils.lerpFloat(a.trackHeight, b.trackHeight, t),
                activeTrackColor: Color.lerp(a.activeTrackColor, b.activeTrackColor, t),
                inactiveTrackColor: Color.lerp(a.inactiveTrackColor, b.inactiveTrackColor, t),
                disabledActiveTrackColor: Color.lerp(a.disabledActiveTrackColor, b.disabledActiveTrackColor, t),
                disabledInactiveTrackColor: Color.lerp(a.disabledInactiveTrackColor, b.disabledInactiveTrackColor, t),
                activeTickMarkColor: Color.lerp(a.activeTickMarkColor, b.activeTickMarkColor, t),
                inactiveTickMarkColor: Color.lerp(a.inactiveTickMarkColor, b.inactiveTickMarkColor, t),
                disabledActiveTickMarkColor: Color.lerp(a.disabledActiveTickMarkColor, b.disabledActiveTickMarkColor,
                                                        t),
                disabledInactiveTickMarkColor: Color.lerp(a.disabledInactiveTickMarkColor,
                                                          b.disabledInactiveTickMarkColor, t),
                thumbColor: Color.lerp(a.thumbColor, b.thumbColor, t),
                disabledThumbColor: Color.lerp(a.disabledThumbColor, b.disabledThumbColor, t),
                overlayColor: Color.lerp(a.overlayColor, b.overlayColor, t),
                valueIndicatorColor: Color.lerp(a.valueIndicatorColor, b.valueIndicatorColor, t),
                trackShape: t < 0.5 ? a.trackShape : b.trackShape,
                tickMarkShape: t < 0.5 ? a.tickMarkShape : b.tickMarkShape,
                thumbShape: t < 0.5 ? a.thumbShape : b.thumbShape,
                overlayShape: t < 0.5 ? a.overlayShape : b.overlayShape,
                valueIndicatorShape: t < 0.5 ? a.valueIndicatorShape : b.valueIndicatorShape,
                showValueIndicator: t < 0.5 ? a.showValueIndicator : b.showValueIndicator,
                valueIndicatorTextStyle: TextStyle.lerp(a.valueIndicatorTextStyle, b.valueIndicatorTextStyle, t)
                ));
 }
Exemple #12
0
 public NotifyContainer(
     Key key                         = null,
     Alignment alignment             = null,
     EdgeInsets padding              = null,
     Color color                     = null,
     Decoration decoration           = null,
     Decoration foregroundDecoration = null,
     float?width                     = null,
     float?height                    = null,
     BoxConstraints constraints      = null,
     EdgeInsets margin               = null,
     Matrix3 transform               = null,
     Widget child                    = null,
     Action <Func <float> > notifyFn = null
     ) : base(key: key)
 {
     _alignment            = alignment;
     _padding              = padding;
     _color                = color;
     _decoration           = decoration;
     _foregroundDecoration = foregroundDecoration;
     _width                = width;
     _height               = height;
     _constraints          = constraints;
     _margin               = margin;
     _transform            = transform;
     _child                = child;
     _notifyFn             = notifyFn;
 }
Exemple #13
0
 public Slider(
     Key key     = null,
     float?value = null,
     ValueChanged <float> onChanged     = null,
     ValueChanged <float> onChangeStart = null,
     ValueChanged <float> onChangeEnd   = null,
     float min           = 0.0f,
     float max           = 1.0f,
     int?divisions       = null,
     string label        = null,
     Color activeColor   = null,
     Color inactiveColor = null
     ) : base(key: key)
 {
     D.assert(value != null);
     D.assert(min <= max);
     D.assert(value >= min && value <= max);
     D.assert(divisions == null || divisions > 0);
     this.value         = value.Value;
     this.onChanged     = onChanged;
     this.onChangeStart = onChangeStart;
     this.onChangeEnd   = onChangeEnd;
     this.min           = min;
     this.max           = max;
     this.divisions     = divisions;
     this.label         = label;
     this.activeColor   = activeColor;
     this.inactiveColor = inactiveColor;
 }
Exemple #14
0
        public static BorderSide lerp(BorderSide a, BorderSide b, float t)
        {
            D.assert(a != null);
            D.assert(b != null);
            if (t == 0.0f)
            {
                return(a);
            }

            if (t == 1.0f)
            {
                return(b);
            }

            float width = MathUtils.lerpNullableFloat(a.width, b.width, t);

            if (width < 0.0)
            {
                return(none);
            }

            if (a.style == b.style)
            {
                return(new BorderSide(
                           color: Color.lerp(a.color, b.color, t),
                           width: width,
                           style: a.style // == b.style
                           ));
            }

            Color colorA = null, colorB = null;

            switch (a.style)
            {
            case BorderStyle.solid:
                colorA = a.color;
                break;

            case BorderStyle.none:
                colorA = a.color.withAlpha(0x00);
                break;
            }

            switch (b.style)
            {
            case BorderStyle.solid:
                colorB = b.color;
                break;

            case BorderStyle.none:
                colorB = b.color.withAlpha(0x00);
                break;
            }

            return(new BorderSide(
                       color: Color.lerp(colorA, colorB, t),
                       width: width,
                       style: BorderStyle.solid
                       ));
        }
Exemple #15
0
        public static ChipThemeData lerp(ChipThemeData a, ChipThemeData b, float t)
        {
            if (a == null && b == null)
            {
                return(null);
            }

            return(new ChipThemeData(
                       backgroundColor: Color.lerp(a?.backgroundColor, b?.backgroundColor, t),
                       deleteIconColor: Color.lerp(a?.deleteIconColor, b?.deleteIconColor, t),
                       disabledColor: Color.lerp(a?.disabledColor, b?.disabledColor, t),
                       selectedColor: Color.lerp(a?.selectedColor, b?.selectedColor, t),
                       secondarySelectedColor: Color.lerp(a?.secondarySelectedColor, b?.secondarySelectedColor, t),
                       shadowColor: Color.lerp(a?.shadowColor, b?.shadowColor, t),
                       selectedShadowColor: Color.lerp(a?.selectedShadowColor, b?.selectedShadowColor, t),
                       checkmarkColor: Color.lerp(a?.checkmarkColor, b?.checkmarkColor, t),
                       labelPadding: EdgeInsetsGeometry.lerp(a?.labelPadding, b?.labelPadding, t),
                       padding: EdgeInsetsGeometry.lerp(a?.padding, b?.padding, t),
                       shape: ShapeBorder.lerp(a?.shape, b?.shape, t),
                       labelStyle: TextStyle.lerp(a?.labelStyle, b?.labelStyle, t),
                       secondaryLabelStyle: TextStyle.lerp(a?.secondaryLabelStyle, b?.secondaryLabelStyle, t),
                       brightness: t < 0.5f ? a?.brightness ?? Brightness.light : b?.brightness ?? Brightness.light,
                       elevation: MathUtils.lerpNullableFloat(a?.elevation, b?.elevation, t),
                       pressElevation: MathUtils.lerpNullableFloat(a?.pressElevation, b?.pressElevation, t)
                       ));
        }
Exemple #16
0
 public RenderImage(
     Image image              = null,
     float?width              = null,
     float?height             = null,
     float scale              = 1.0f,
     Color color              = null,
     BlendMode colorBlendMode = BlendMode.srcIn,
     BoxFit?fit = null,
     AlignmentGeometry alignment = null,
     ImageRepeat repeat          = ImageRepeat.noRepeat,
     Rect centerSlice            = null,
     bool matchTextDirection     = false,
     TextDirection?textDirection = null,
     bool invertColors           = false,
     FilterQuality filterQuality = FilterQuality.low
     )
 {
     D.assert(alignment != null);
     _image              = image;
     _width              = width;
     _height             = height;
     _scale              = scale;
     _color              = color;
     _colorBlendMode     = colorBlendMode;
     _fit                = fit;
     _repeat             = repeat;
     _centerSlice        = centerSlice;
     _alignment          = alignment ?? Alignment.center;
     _invertColors       = invertColors;
     _filterQuality      = filterQuality;
     _textDirection      = textDirection;
     _matchTextDirection = matchTextDirection;
     _updateColorFilter();
 }
Exemple #17
0
 Widget _buildContentList(BuildContext context)
 {
     return(new NotificationListener <ScrollNotification>(
                onNotification: (ScrollNotification notification) => {
         this._onNotification(notification, context);
         return true;
     },
                child: new Flexible(
                    child: new Container(
                        //  color: CLColors.green,
                        child: ListView.builder(
                            itemCount: 20,
                            itemExtent: 100,
                            physics: new AlwaysScrollableScrollPhysics(),
                            itemBuilder: (BuildContext context1, int index) => {
         return new Container(
             color: Color.fromARGB(255, (index * 10) % 256, (index * 20) % 256,
                                   (index * 30) % 256)
             );
     }
                            )
                        )
                    )
                ));
 }
Exemple #18
0
 Widget _buildSearchInput()
 {
     return(new Row(
                children: new List <Widget> {
         new Text("Search:"),
         new Flexible(child:
                      new Container(
                          margin: EdgeInsets.only(left: 8),
                          decoration: new BoxDecoration(border: Border.all(new Color(0xFF000000), 1)),
                          padding: EdgeInsets.only(left: 8, right: 8),
                          child: new EditableText(
                              selectionControls: MaterialUtils.materialTextSelectionControls,
                              backgroundCursorColor: Colors.transparent,
                              controller: this._controller,
                              focusNode: this._focusNode,
                              style: new TextStyle(
                                  fontSize: 18,
                                  height: 1.5f
                                  ),
                              cursorColor: Color.fromARGB(255, 0, 0, 0)
                              )
                          )
                      )
     }
                ));
 }
        public override void didUpdateWidget(StatefulWidget _oldWidget)
        {
            base.didUpdateWidget(_oldWidget);
            BottomNavigationBar oldWidget = _oldWidget as BottomNavigationBar;

            if (this.widget.items.Count != oldWidget.items.Count)
            {
                this._resetState();
                return;
            }

            if (this.widget.currentIndex != oldWidget.currentIndex)
            {
                switch (this.widget.type)
                {
                case BottomNavigationBarType.fix:
                    break;

                case BottomNavigationBarType.shifting:
                    this._pushCircle(this.widget.currentIndex);
                    break;
                }

                this._controllers[oldWidget.currentIndex].reverse();
                this._controllers[this.widget.currentIndex].forward();
            }
            else
            {
                if (this._backgroundColor != this.widget.items[this.widget.currentIndex].backgroundColor)
                {
                    this._backgroundColor = this.widget.items[this.widget.currentIndex].backgroundColor;
                }
            }
        }
        public static void drawShadow(Canvas canvas, Path path, Color color, float elevation, bool transparentOccluder,
                                      float dpr)
        {
            Rect  bounds   = path.getBounds();
            float shadow_x = (bounds.left + bounds.right) / 2f;
            float shadow_y = bounds.top - 600.0f;

            uiColor uicolor = uiColor.fromColor(color);

            uiColor inAmbient    = uicolor.withAlpha((int)(kAmbientAlpha * uicolor.alpha));
            uiColor inSpot       = uicolor.withAlpha((int)(kSpotAlpha * uicolor.alpha));
            uiColor?ambientColor = null;
            uiColor?spotColor    = null;

            ShadowUtils.computeTonalColors(inAmbient, inSpot, ref ambientColor, ref spotColor);
            ShadowUtils.drawShadow(
                canvas,
                path,
                new Vector3(0, 0, dpr * elevation),
                new Vector3(shadow_x, shadow_y, dpr * kLightHeight),
                dpr * kLightRadius,
                ambientColor.Value,
                spotColor.Value,
                0
                );
        }
Exemple #21
0
 public Image(
     Key key                  = null,
     ImageProvider image      = null,
     double?width             = null,
     double?height            = null,
     Color color              = null,
     BlendMode colorBlendMode = BlendMode.srcIn,
     BoxFit?fit               = null,
     Alignment alignment      = null,
     ImageRepeat repeat       = ImageRepeat.noRepeat,
     Rect centerSlice         = null,
     bool gaplessPlayback     = false,
     FilterMode filterMode    = FilterMode.Point
     ) : base(key)
 {
     D.assert(image != null);
     this.image           = image;
     this.width           = width;
     this.height          = height;
     this.color           = color;
     this.colorBlendMode  = colorBlendMode;
     this.fit             = fit;
     this.alignment       = alignment ?? Alignment.center;
     this.repeat          = repeat;
     this.centerSlice     = centerSlice;
     this.gaplessPlayback = gaplessPlayback;
     this.filterMode      = filterMode;
 }
        void _updateBubblesPaints()
        {
            float progress1 = LikeButtonUtil.clamp(this.m_CurrentProgress, 0.6f, 1);
            int   alpha     =
                (int)LikeButtonUtil.mapValueFromRangeToRange(progress1, 0.6f, 1, 255, 0);

            if (this.m_CurrentProgress < 0.5)
            {
                float progress2 =
                    LikeButtonUtil.mapValueFromRangeToRange(this.m_CurrentProgress, 0, 0.5f, 0, 1);
                this.m_CirclePaints[0].color = Color.lerp(this.m_Color1, this.m_Color2, progress2).withAlpha(alpha);
                this.m_CirclePaints[1].color = Color.lerp(this.m_Color2, this.m_Color3, progress2).withAlpha(alpha);
                this.m_CirclePaints[2].color = Color.lerp(this.m_Color3, this.m_Color4, progress2).withAlpha(alpha);
                this.m_CirclePaints[3].color = Color.lerp(this.m_Color4, this.m_Color1, progress2).withAlpha(alpha);
            }
            else
            {
                float progress3 =
                    LikeButtonUtil.mapValueFromRangeToRange(this.m_CurrentProgress, 0.5f, 1, 0, 1);
                this.m_CirclePaints[0].color = Color.lerp(this.m_Color2, this.m_Color3, progress3).withAlpha(alpha);
                this.m_CirclePaints[1].color = Color.lerp(this.m_Color3, this.m_Color4, progress3).withAlpha(alpha);
                this.m_CirclePaints[2].color = Color.lerp(this.m_Color4, this.m_Color1, progress3).withAlpha(alpha);
                this.m_CirclePaints[3].color = Color.lerp(this.m_Color1, this.m_Color2, progress3).withAlpha(alpha);
            }
        }
Exemple #23
0
 public _Editable(TextSpan textSpan                  = null, TextEditingValue value          = null,
                  Color cursorColor                  = null, ValueNotifier <bool> showCursor = null, bool hasFocus = false,
                  int?maxLines                       = null, Color selectionColor   = null, float textScaleFactor  = 1.0f,
                  TextDirection?textDirection        = null, bool obscureText       = false, TextAlign textAlign   = TextAlign.left,
                  bool autocorrect                   = false, ViewportOffset offset = null, SelectionChangedHandler onSelectionChanged = null,
                  CaretChangedHandler onCaretChanged = null, bool rendererIgnoresPointer = false,
                  Key key = null) : base(key)
 {
     this.textSpan               = textSpan;
     this.value                  = value;
     this.cursorColor            = cursorColor;
     this.showCursor             = showCursor;
     this.hasFocus               = hasFocus;
     this.maxLines               = maxLines;
     this.selectionColor         = selectionColor;
     this.textScaleFactor        = textScaleFactor;
     this.textAlign              = textAlign;
     this.textDirection          = textDirection;
     this.obscureText            = obscureText;
     this.autocorrect            = autocorrect;
     this.offset                 = offset;
     this.onSelectionChanged     = onSelectionChanged;
     this.onCaretChanged         = onCaretChanged;
     this.rendererIgnoresPointer = rendererIgnoresPointer;
 }
        public BubblesPainter(
            float currentProgress,
            int bubblesCount = 7,
            Color color1     = null,
            Color color2     = null,
            Color color3     = null,
            Color color4     = null
            )
        {
            this.m_OuterBubblesPositionAngle =
                bubblesCount > 0 ? 360f / bubblesCount : this.m_OuterBubblesPositionAngle;
            for (int i = 0; i < paintsNumber; i++)
            {
                this.m_CirclePaints.Add(new Paint {
                    style = PaintingStyle.fill
                });
            }

            this.m_CurrentProgress = currentProgress;
            this.m_BubblesCount    = bubblesCount;
            this.m_Color1          = color1 ?? new Color(0xFFFFC107);
            this.m_Color2          = color2 ?? new Color(0xFFFF9800);
            this.m_Color3          = color3 ?? new Color(0xFFFF5722);
            this.m_Color4          = color4 ?? new Color(0xFFF44336);
        }
Exemple #25
0
 public override InteractiveInkFeature create(
     MaterialInkController controller = null,
     RenderBox referenceBox           = null,
     Offset position             = null,
     Color color                 = null,
     TextDirection?textDirection = null,
     bool containedInkWell       = false,
     RectCallback rectCallback   = null,
     BorderRadius borderRadius   = null,
     ShapeBorder customBorder    = null,
     float?radius                = null,
     VoidCallback onRemoved      = null
     )
 {
     D.assert(controller != null);
     D.assert(referenceBox != null);
     D.assert(position != null);
     D.assert(color != null);
     D.assert(textDirection != null);
     return(new InkRipple(
                controller: controller,
                referenceBox: referenceBox,
                position: position,
                color: color,
                containedInkWell: containedInkWell,
                rectCallback: rectCallback,
                borderRadius: borderRadius,
                customBorder: customBorder,
                radius: radius,
                onRemoved: onRemoved,
                textDiretion: textDirection
                ));
 }
Exemple #26
0
 public RangeSlider(
     Key key            = null,
     RangeValues values = null,
     ValueChanged <RangeValues> onChanged     = null,
     ValueChanged <RangeValues> onChangeStart = null,
     ValueChanged <RangeValues> onChangeEnd   = null,
     float min           = 0.0f,
     float max           = 1.0f,
     int?divisions       = null,
     RangeLabels labels  = null,
     Color activeColor   = null,
     Color inactiveColor = null
     ) : base(key: key)
 {
     D.assert(values != null);
     D.assert(min <= max);
     D.assert(values.start <= values.end);
     D.assert(values.start >= min && values.start <= max);
     D.assert(values.end >= min && values.end <= max);
     D.assert(divisions == null || divisions > 0);
     this.values        = values;
     this.onChanged     = onChanged;
     this.onChangeStart = onChangeStart;
     this.onChangeEnd   = onChangeEnd;
     this.min           = min;
     this.max           = max;
     this.divisions     = divisions;
     this.labels        = labels;
     this.activeColor   = activeColor;
     this.inactiveColor = inactiveColor;
 }
Exemple #27
0
        TextStyle _titleTextStyle(ThemeData theme, ListTileTheme tileTheme)
        {
            TextStyle style = null;

            if (tileTheme != null)
            {
                switch (tileTheme.style)
                {
                case ListTileStyle.drawer:
                    style = theme.textTheme.bodyText1;
                    break;

                case ListTileStyle.list:
                    style = theme.textTheme.subtitle1;
                    break;
                }
            }
            else
            {
                style = theme.textTheme.subtitle1;
            }

            Color color = _textColor(theme, tileTheme, style.color);

            return(_isDenseLayout(tileTheme)
                ? style.copyWith(fontSize: 13.0f, color: color)
                : style.copyWith(color: color));
        }
Exemple #28
0
        public IconButton(
            Key key                = null,
            float iconSize         = 24.0f,
            EdgeInsets padding     = null,
            Alignment alignment    = null,
            Widget icon            = null,
            Color color            = null,
            Color highlightColor   = null,
            Color splashColor      = null,
            Color disableColor     = null,
            VoidCallback onPressed = null,
            string tooltip         = null) : base(key: key)
        {
            D.assert(icon != null);

            this.iconSize       = iconSize;
            this.padding        = padding ?? EdgeInsets.all(8.0f);
            this.alignment      = alignment ?? Alignment.center;
            this.icon           = icon;
            this.color          = color;
            this.highlightColor = highlightColor;
            this.splashColor    = splashColor;
            this.disabledColor  = disableColor;
            this.onPressed      = onPressed;
            this.tooltip        = tooltip;
        }
Exemple #29
0
        public static IEnumerable <Widget> divideTiles(BuildContext context = null, IEnumerable <Widget> tiles = null,
                                                       Color color          = null)
        {
            D.assert(tiles != null);
            D.assert(color != null || context != null);

            IEnumerator <Widget> enumerator = tiles.GetEnumerator();
            List <Widget>        result     = new List <Widget> {
            };

            Decoration decoration = new BoxDecoration(
                border: new Border(
                    bottom: Divider.createBorderSide(context, color: color)
                    )
                );

            Widget tile = enumerator.Current;

            while (enumerator.MoveNext())
            {
                result.Add(new DecoratedBox(
                               position: DecorationPosition.foreground,
                               decoration: decoration,
                               child: tile
                               ));
                tile = enumerator.Current;
            }

            return(result);
        }
Exemple #30
0
 public override Widget build(BuildContext context)
 {
     return(new Container(
                decoration: new BoxDecoration(
                    shape: BoxShape.circle,
                    gradient: new LinearGradient(
                        begin: FractionalOffset.topCenter,
                        end: FractionalOffset.bottomCenter,
                        colors: new List <Color> {
         color,
         Color.fromARGB(
             color.alpha,
             (color.red - 60).clamp(0, 255),
             (color.green - 60).clamp(0, 255),
             (color.blue - 60).clamp(0, 255)
             )
     }
                        )
                    ),
                margin: EdgeInsets.only(left: 8.0f, bottom: 8.0f),
                padding: EdgeInsets.all(12.0f),
                child: new Text(
                    text,
                    style: new TextStyle(
                        color: CupertinoColors.white,
                        fontSize: 13.0f,
                        fontWeight: FontWeight.w500
                        )
                    )
                ));
 }