コード例 #1
0
 public RenderAnimatedSize(
     TickerProvider vsync     = null,
     TimeSpan?duration        = null,
     TimeSpan?reverseDuration = null,
     Curve curve = null,
     AlignmentGeometry alignment = null,
     TextDirection?textDirection = null,
     RenderBox child             = null
     ) : base(child: child, alignment: alignment ?? Alignment.center, textDirection: textDirection)
 {
     curve = curve ?? Curves.linear;
     D.assert(vsync != null);
     D.assert(duration != null);
     _vsync      = vsync;
     _controller = new AnimationController(
         vsync: this.vsync,
         duration: duration,
         reverseDuration: reverseDuration);
     _controller.addListener(() => {
         if (_controller.value != _lastValue)
         {
             markNeedsLayout();
         }
     });
     _animation = new CurvedAnimation(
         parent: _controller,
         curve: curve);
 }
コード例 #2
0
 public AnimatedCrossFade(
     Key key                                = null,
     Widget firstChild                      = null,
     Widget secondChild                     = null,
     Curve firstCurve                       = null,
     Curve secondCurve                      = null,
     Curve sizeCurve                        = null,
     AlignmentGeometry alignment            = null,
     CrossFadeState?crossFadeState          = null,
     TimeSpan?duration                      = null,
     TimeSpan?reverseDuration               = null,
     AnimatedCrossFadeBuilder layoutBuilder = null
     ) : base(key: key)
 {
     D.assert(firstChild != null);
     D.assert(secondChild != null);
     D.assert(crossFadeState != null);
     D.assert(duration != null);
     this.firstChild      = firstChild;
     this.secondChild     = secondChild;
     this.firstCurve      = firstCurve ?? Curves.linear;
     this.secondCurve     = secondCurve ?? Curves.linear;
     this.sizeCurve       = sizeCurve ?? Curves.linear;
     this.alignment       = alignment ?? Alignment.topCenter;
     this.crossFadeState  = crossFadeState ?? CrossFadeState.showFirst;
     this.duration        = duration;
     this.reverseDuration = reverseDuration;
     this.layoutBuilder   = layoutBuilder ?? defaultLayoutBuilder;
 }
コード例 #3
0
ファイル: image.cs プロジェクト: MaxAkbar/com.unity.uiwidgets
 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();
 }
コード例 #4
0
 protected RenderAligningShiftedBox(
     AlignmentGeometry alignment = null,
     TextDirection?textDirection = null,
     RenderBox child             = null
     ) : base(child)
 {
     _alignment     = alignment ?? Alignment.center;
     _textDirection = textDirection;
 }
コード例 #5
0
 public RenderSizedOverflowBox(
     RenderBox child             = null,
     Size requestedSize          = null,
     AlignmentGeometry alignment = null,
     TextDirection?textDirection = null
     ) : base(child: child, alignment: alignment ?? Alignment.center, textDirection: textDirection)
 {
     D.assert(requestedSize != null);
     _requestedSize = requestedSize;
 }
コード例 #6
0
 public class RenderUnconstrainedBox : RenderAligningShiftedBox {//, DebugOverflowIndicatorMixin
     public RenderUnconstrainedBox(
         AlignmentGeometry alignment = null,
         TextDirection?textDirection = null,
         Axis?constrainedAxis        = null,
         RenderBox child             = null
         ) : base(alignment, textDirection, child)
     {
         D.assert(alignment != null);
         _constrainedAxis = constrainedAxis;
     }
コード例 #7
0
        public static FadeInImage assetNetwork(
            string placeholder,
            string image,
            ImageErrorWidgetBuilder placeholderErrorBuilder = null,
            ImageErrorWidgetBuilder imageErrorBuilder       = null,
            AssetBundle bundle       = null,
            float?placeholderScale   = null,
            float imageScale         = 1.0f,
            TimeSpan?fadeOutDuration = null,
            Curve fadeOutCurve       = null,
            TimeSpan?fadeInDuration  = null,
            Curve fadeInCurve        = null,
            float?width  = null,
            float?height = null,
            BoxFit?fit   = null,
            AlignmentGeometry alignment = null,
            ImageRepeat repeat          = ImageRepeat.noRepeat,
            bool matchTextDirection     = false,
            Key key = null,
            int?placeholderCacheWidth  = null,
            int?placeholderCacheHeight = null,
            int?imageCacheWidth        = null,
            int?imageCacheHeight       = null
            )
        {
            fadeOutDuration = fadeOutDuration ?? new TimeSpan(0, 0, 0, 0, 300);
            fadeOutCurve    = fadeOutCurve ?? Curves.easeOut;
            fadeInDuration  = fadeInDuration ?? new TimeSpan(0, 0, 0, 0, 700);
            fadeInCurve     = Curves.easeIn;
            alignment       = alignment ?? Alignment.center;
            var holder       = placeholderScale ?? 1.0f;
            var _placeholder = placeholderScale != null
                ? ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight,
                                             new ExactAssetImage(placeholder, bundle : bundle, scale : holder))
                               : ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight,
                                                            new AssetImage(placeholder, bundle : bundle));

            return(new FadeInImage(
                       placeholder: _placeholder,
                       placeholderErrorBuilder: placeholderErrorBuilder,
                       image: ResizeImage.resizeIfNeeded(imageCacheWidth, imageCacheHeight, new NetworkImage(image, scale: imageScale)),
                       imageErrorBuilder: imageErrorBuilder,
                       fadeOutDuration: fadeOutDuration,
                       fadeOutCurve: fadeOutCurve,
                       fadeInDuration: fadeInDuration,
                       fadeInCurve: fadeInCurve,
                       width: width, height: height,
                       fit: fit,
                       alignment: alignment,
                       repeat: repeat,
                       matchTextDirection: matchTextDirection,
                       key: key
                       ));
        }
コード例 #8
0
 public RenderIndexedStack(
     List <RenderBox> children   = null,
     AlignmentGeometry alignment = null,
     TextDirection?textDirection = null,
     int index = 0
     ) :  base(
         children: children,
         alignment: alignment ?? AlignmentDirectional.topStart,
         textDirection: textDirection ?? TextDirection.ltr)
 {
     _index = index;
 }
コード例 #9
0
 public RenderPositionedBox(
     RenderBox child             = null,
     float?widthFactor           = null,
     float?heightFactor          = null,
     AlignmentGeometry alignment = null,
     TextDirection?textDirection = null
     ) : base(child: child, alignment: alignment ?? Alignment.center, textDirection: textDirection)
 {
     D.assert(widthFactor == null || widthFactor >= 0.0);
     D.assert(heightFactor == null || heightFactor >= 0.0);
     _widthFactor  = widthFactor;
     _heightFactor = heightFactor;
 }
コード例 #10
0
 public RenderFractionallySizedOverflowBox(
     RenderBox child             = null,
     float?widthFactor           = null,
     float?heightFactor          = null,
     AlignmentGeometry alignment = null,
     TextDirection?textDirection = null
     ) : base(child: child, alignment: alignment ?? Alignment.center, textDirection: textDirection)
 {
     _widthFactor  = widthFactor;
     _heightFactor = heightFactor;
     D.assert(_widthFactor == null || _widthFactor >= 0.0);
     D.assert(_heightFactor == null || _heightFactor >= 0.0);
 }
コード例 #11
0
 public AnimatedAlign(
     Key key = null,
     AlignmentGeometry alignment = null,
     Widget child       = null,
     Curve curve        = null,
     TimeSpan?duration  = null,
     VoidCallback onEnd = null
     ) : base(key: key, curve: curve ?? Curves.linear, duration: duration, onEnd: onEnd)
 {
     D.assert(alignment != null);
     this.alignment = alignment;
     this.child     = child;
 }
コード例 #12
0
        public static FadeInImage memoryNetwork(
            byte[] placeholder,
            string image,
            Key key = null,
            ImageErrorWidgetBuilder placeholderErrorBuilder = null,
            ImageErrorWidgetBuilder imageErrorBuilder       = null,
            float placeholderScale   = 1.0f,
            float imageScale         = 1.0f,
            TimeSpan?fadeOutDuration = null,
            Curve fadeOutCurve       = null,
            TimeSpan?fadeInDuration  = null,
            Curve fadeInCurve        = null,
            float?width  = null,
            float?height = null,
            BoxFit?fit   = null,
            AlignmentGeometry alignment = null,
            ImageRepeat repeat          = ImageRepeat.noRepeat,
            bool matchTextDirection     = false,
            int?placeholderCacheWidth   = null,
            int?placeholderCacheHeight  = null,
            int?imageCacheWidth         = null,
            int?imageCacheHeight        = null
            )
        {
            alignment       = alignment ?? Alignment.center;
            fadeOutDuration = fadeOutDuration ?? TimeSpan.FromMilliseconds(300);
            fadeOutCurve    = fadeOutCurve ?? Curves.easeOut;
            fadeInDuration  = fadeInDuration ?? TimeSpan.FromMilliseconds(700);
            fadeInCurve     = fadeInCurve ?? Curves.easeIn;
            ImageProvider memoryImage  = new MemoryImage(placeholder, placeholderScale);
            ImageProvider networkImage = new NetworkImage(image, imageScale);

            //placeholder = ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight, memoryImage);
            //image = ResizeImage.resizeIfNeeded(imageCacheWidth, imageCacheHeight, networkImage);
            return(new FadeInImage(
                       placeholder: ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight, memoryImage),
                       placeholderErrorBuilder: placeholderErrorBuilder,
                       image: ResizeImage.resizeIfNeeded(imageCacheWidth, imageCacheHeight, networkImage),
                       imageErrorBuilder: imageErrorBuilder,
                       fadeOutDuration: fadeOutDuration,
                       fadeOutCurve: fadeOutCurve,
                       fadeInDuration: fadeInDuration,
                       fadeInCurve: fadeInCurve,
                       width: width, height: height,
                       fit: fit,
                       alignment: alignment,
                       repeat: repeat,
                       matchTextDirection: matchTextDirection,
                       key: key
                       ));
        }
コード例 #13
0
 public RenderStack(
     List <RenderBox> children   = null,
     AlignmentGeometry alignment = null,
     TextDirection textDirection = TextDirection.ltr,
     StackFit fit      = StackFit.loose,
     Overflow overflow = Overflow.clip
     )
 {
     _textDirection = textDirection;
     _alignment     = alignment ?? AlignmentDirectional.topStart;
     _fit           = fit;
     _overflow      = overflow;
     addAll(children);
 }
コード例 #14
0
 public RenderConstrainedOverflowBox(
     RenderBox child             = null,
     float?minWidth              = null,
     float?maxWidth              = null,
     float?minHeight             = null,
     float?maxHeight             = null,
     AlignmentGeometry alignment = null,
     TextDirection?textDirection = null
     ) : base(child: child, alignment: alignment ?? Alignment.center, textDirection: textDirection)
 {
     _minWidth  = minWidth;
     _maxWidth  = maxWidth;
     _minHeight = minHeight;
     _maxHeight = maxHeight;
 }
コード例 #15
0
 public AnimatedSize(
     Key key      = null,
     Widget child = null,
     AlignmentGeometry alignment = null,
     Curve curve              = null,
     TimeSpan?duration        = null,
     TimeSpan?reverseDuration = null,
     TickerProvider vsync     = null) : base(key: key, child: child)
 {
     D.assert(duration != null);
     D.assert(vsync != null);
     this.alignment       = alignment ?? Alignment.center;
     this.curve           = curve ?? Curves.linear;
     this.duration        = duration;
     this.reverseDuration = reverseDuration;
     this.vsync           = vsync;
 }
コード例 #16
0
        public static Image network(
            string src,
            Key key     = null,
            float scale = 1.0f,
            ImageFrameBuilder frameBuilder       = null,
            ImageLoadingBuilder loadingBuilder   = null,
            ImageErrorWidgetBuilder errorBuilder = null,
            float?width              = null,
            float?height             = null,
            Color color              = null,
            BlendMode colorBlendMode = BlendMode.srcIn,
            BoxFit?fit = null,
            AlignmentGeometry alignment          = null,
            ImageRepeat repeat                   = ImageRepeat.noRepeat,
            Rect centerSlice                     = null,
            bool gaplessPlayback                 = false,
            bool matchTextDirection              = false,
            FilterQuality filterQuality          = FilterQuality.low,
            IDictionary <string, string> headers = null,
            int?cacheWidth  = null,
            int?cacheHeight = null
            )
        {
            var image = ResizeImage.resizeIfNeeded(cacheWidth: cacheWidth, cacheHeight: cacheHeight,
                                                   new NetworkImage(url: src, scale: scale, headers: headers));

            return(new Image(
                       key: key,
                       image: image,
                       frameBuilder: frameBuilder,
                       loadingBuilder: loadingBuilder,
                       errorBuilder: errorBuilder,
                       width: width,
                       height: height,
                       color: color,
                       colorBlendMode: colorBlendMode,
                       fit: fit,
                       alignment: alignment,
                       repeat: repeat,
                       centerSlice: centerSlice,
                       matchTextDirection: matchTextDirection,
                       gaplessPlayback: gaplessPlayback,
                       filterQuality: filterQuality
                       ));
        }
コード例 #17
0
 public IconButton(
     Key key        = null,
     float iconSize = 24.0f,
     VisualDensity visualDensity = null,
     EdgeInsetsGeometry padding  = null,
     AlignmentGeometry alignment = null,
     Widget icon                = null,
     Color color                = null,
     Color focusColor           = null,
     Color hoverColor           = null,
     Color highlightColor       = null,
     Color splashColor          = null,
     Color disabledColor        = null,
     VoidCallback onPressed     = null,
     FocusNode focusNode        = null,
     bool autofocus             = false,
     string tooltip             = null,
     bool?enableFeedback        = true,
     BoxConstraints constraints = null
     ) : base(key: key)
 {
     D.assert(icon != null);
     this.iconSize       = iconSize;
     this.visualDensity  = visualDensity;
     this.padding        = padding ?? EdgeInsets.all(8.0f);
     this.alignment      = alignment ?? Alignment.center;
     this.icon           = icon;
     this.color          = color;
     this.focusColor     = focusColor;
     this.hoverColor     = hoverColor;
     this.highlightColor = highlightColor;
     this.splashColor    = splashColor;
     this.disabledColor  = disabledColor;
     this.onPressed      = onPressed;
     this.focusNode      = focusNode;
     this.autofocus      = autofocus;
     this.tooltip        = tooltip;
     this.enableFeedback = enableFeedback;
     this.constraints    = constraints;
 }
コード例 #18
0
 public AnimatedContainer(
     Key key = null,
     AlignmentGeometry alignment = null,
     EdgeInsetsGeometry padding  = null,
     Color color                     = null,
     Decoration decoration           = null,
     Decoration foregroundDecoration = null,
     float?width                     = null,
     float?height                    = null,
     BoxConstraints constraints      = null,
     EdgeInsetsGeometry margin       = null,
     Matrix4 transform               = null,
     Widget child                    = null,
     Curve curve                     = null,
     TimeSpan?duration               = null,
     VoidCallback onEnd              = null
     ) : base(key: key, curve: curve ?? Curves.linear, duration: duration, onEnd: onEnd)
 {
     D.assert(duration != null);
     D.assert(margin == null || margin.isNonNegative);
     D.assert(padding == null || padding.isNonNegative);
     D.assert(decoration == null || decoration.debugAssertIsValid());
     D.assert(constraints == null || constraints.debugAssertIsValid());
     D.assert(color == null || decoration == null,
              () => "Cannot provide both a color and a decoration\n" +
              "The color argument is just a shorthand for \"decoration: new BoxDecoration(backgroundColor: color)\".");
     this.alignment            = alignment;
     this.padding              = padding;
     this.foregroundDecoration = foregroundDecoration;
     this.margin      = margin;
     this.transform   = transform;
     this.child       = child;
     this.decoration  = decoration ?? (color != null ? new BoxDecoration(color: color) : null);
     this.constraints =
         (width != null || height != null)
             ? constraints?.tighten(width: width, height: height)
         ?? BoxConstraints.tightFor(width: width, height: height)
             : constraints;
 }
コード例 #19
0
 public FadeInImage(
     ImageProvider placeholder,
     ImageErrorWidgetBuilder placeholderErrorBuilder,
     ImageProvider image,
     ImageErrorWidgetBuilder imageErrorBuilder = null,
     TimeSpan?fadeOutDuration = null,
     Curve fadeOutCurve       = null,
     TimeSpan?fadeInDuration  = null,
     Curve fadeInCurve        = null,
     float?width  = null,
     float?height = null,
     BoxFit?fit   = null,
     AlignmentGeometry alignment = null,
     ImageRepeat repeat          = ImageRepeat.noRepeat,
     Key key = null,
     bool matchTextDirection = false
     ) : base(key)
 {
     D.assert(image != null);
     D.assert(fadeOutDuration != null);
     D.assert(fadeOutCurve != null);
     D.assert(fadeInDuration != null);
     D.assert(fadeInCurve != null);
     D.assert(alignment != null);
     this.placeholder             = placeholder;
     this.placeholderErrorBuilder = placeholderErrorBuilder;
     this.image             = image;
     this.imageErrorBuilder = imageErrorBuilder;
     this.width             = width;
     this.height            = height;
     this.fit                = fit;
     this.fadeOutDuration    = fadeOutDuration ?? TimeSpan.FromMilliseconds(300);
     this.fadeOutCurve       = fadeOutCurve ?? Curves.easeOut;
     this.fadeInDuration     = fadeInDuration ?? TimeSpan.FromMilliseconds(700);
     this.fadeInCurve        = fadeInCurve ?? Curves.easeIn;
     this.alignment          = alignment ?? Alignment.center;
     this.repeat             = repeat;
     this.matchTextDirection = matchTextDirection;
 }
コード例 #20
0
        public Container(
            Key key = null,
            AlignmentGeometry alignment = null,
            EdgeInsetsGeometry padding  = null,
            Color color                     = null,
            Decoration decoration           = null,
            Decoration foregroundDecoration = null,
            float?width                     = null,
            float?height                    = null,
            BoxConstraints constraints      = null,
            EdgeInsetsGeometry margin       = null,
            Matrix4 transform               = null,
            Widget child                    = null,
            Clip clipBehavior               = Clip.none
            ) : base(key: key)
        {
            D.assert(margin == null || margin.isNonNegative);
            D.assert(padding == null || padding.isNonNegative);
            D.assert(decoration == null || decoration.debugAssertIsValid());
            D.assert(constraints == null || constraints.debugAssertIsValid());
            D.assert(color == null || decoration == null,
                     () => "Cannot provide both a color and a decoration\n" +
                     "The color argument is just a shorthand for \"decoration: new BoxDecoration(color: color)\"."
                     );
            D.assert(clipBehavior != null);

            this.alignment            = alignment;
            this.padding              = padding;
            this.foregroundDecoration = foregroundDecoration;
            this.color       = color;
            this.decoration  = decoration;// ?? (color != null ? new BoxDecoration(color) : null);
            this.constraints = (width != null || height != null)
                ? (constraints != null ? constraints.tighten(width, height) : BoxConstraints.tightFor(width, height))
                : constraints;
            this.margin       = margin;
            this.transform    = transform;
            this.child        = child;
            this.clipBehavior = clipBehavior;
        }
コード例 #21
0
        public static Ink image(
            Key key = null,
            EdgeInsetsGeometry padding      = null,
            ImageProvider image             = null,
            ImageErrorListener onImageError = null,
            ColorFilter colorFilter         = null,
            BoxFit?fit = null,
            AlignmentGeometry alignment = null,
            Rect centerSlice            = null,
            ImageRepeat repeat          = ImageRepeat.noRepeat,
            float?width  = null,
            float?height = null,
            Widget child = null
            )
        {
            D.assert(padding == null || padding.isNonNegative);
            D.assert(image != null);

            alignment = alignment ?? Alignment.center;
            Decoration decoration = new BoxDecoration(
                image: new DecorationImage(
                    image: image,
                    onError: onImageError,
                    colorFilter: colorFilter,
                    fit: fit,
                    alignment: alignment,
                    centerSlice: centerSlice,
                    repeat: repeat)
                );

            return(new Ink(
                       key: key,
                       padding: padding,
                       decoration: decoration,
                       width: width,
                       height: height,
                       child: child));
        }
コード例 #22
0
 public Image(
     Key key                              = null,
     ImageProvider image                  = null,
     ImageFrameBuilder frameBuilder       = null,
     ImageLoadingBuilder loadingBuilder   = null,
     ImageErrorWidgetBuilder errorBuilder = null,
     float?width                          = null,
     float?height                         = null,
     Color color                          = null,
     BlendMode colorBlendMode             = BlendMode.srcIn,
     BoxFit?fit                           = null,
     AlignmentGeometry alignment          = null,
     ImageRepeat repeat                   = ImageRepeat.noRepeat,
     Rect centerSlice                     = null,
     bool matchTextDirection              = false,
     bool gaplessPlayback                 = false,
     FilterQuality filterQuality          = FilterQuality.low
     ) : base(key: key)
 {
     D.assert(image != null);
     this.image              = image;
     this.frameBuilder       = frameBuilder;
     this.loadingBuilder     = loadingBuilder;
     this.errorBuilder       = errorBuilder;
     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.filterQuality      = filterQuality;
     this.matchTextDirection = matchTextDirection;
 }