コード例 #1
0
ファイル: ShareWidget.cs プロジェクト: krojac01/Karts
        private Widget renderSuccessWidget()
        {
            var list = new List <Widget>
            {
                renderUploadingHead(),
                new Container(
                    color: new Color(0xFFF6F6F6),
                    padding: EdgeInsets.only(left: 40, right: 40, bottom: 70),
                    child: new Column(
                        children: new List <Widget> {
                    renderIcon(Icons.cloud_done),
                    renderHighlightedLabel("Upload completed:"),
                    renderProjectUrl()
                }
                        ),
                    constraints: BoxConstraints.expand().widthConstraints(),
                    alignment: Alignment.center
                    )
            };

            return(new Container(
                       color: new Color(0xFFF6F6F6),
                       padding: EdgeInsets.only(top: 10),
                       child: new Column(children: list, mainAxisAlignment: MainAxisAlignment.spaceBetween)
                       ));
        }
コード例 #2
0
ファイル: ShareWidget.cs プロジェクト: krojac01/Karts
        private Widget renderErrorWidget()
        {
            var list = new List <Widget>
            {
                renderUploadingHead(),
                new Container(
                    color: new Color(0xFFF6F6F6),
                    padding: EdgeInsets.all(40),
                    child: new Column(
                        children: new List <Widget> {
                    renderIcon(Icons.error),
                    renderHighlightedLabel("Something went wrong"),
                    renderNormalLabel(widget.shareState.errorMsg),
                    renderGoBack()
                },
                        mainAxisAlignment: MainAxisAlignment.center
                        ),
                    constraints: BoxConstraints.expand().widthConstraints()
                    )
            };

            return(new Container(
                       color: new Color(0xFFF6F6F6),
                       padding: EdgeInsets.only(top: 10),
                       child: new Column(children: list, mainAxisAlignment: MainAxisAlignment.spaceBetween)
                       ));
        }
コード例 #3
0
        Widget _buildMagnifierScreen()
        {
            Color foreground = this.widget.backgroundColor?.withAlpha(
                (int)(this.widget.backgroundColor.alpha * CupertinoPickerUtils._kForegroundScreenOpacityFraction)
                );

            return(new IgnorePointer(
                       child: new Column(
                           children: new List <Widget> {
                new Expanded(
                    child: new Container(
                        color: foreground
                        )
                    ),
                new Container(
                    decoration: new BoxDecoration(
                        border: new Border(
                            top: new BorderSide(width: 0.0f, color: CupertinoPickerUtils._kHighlighterBorder),
                            bottom: new BorderSide(width: 0.0f, color: CupertinoPickerUtils._kHighlighterBorder)
                            )
                        ),
                    constraints: BoxConstraints.expand(
                        height: this.widget.itemExtent * this.widget.magnification
                        )
                    ),
                new Expanded(
                    child: new Container(
                        color: foreground
                        )
                    ),
            }
                           )
                       ));
        }
コード例 #4
0
ファイル: container.cs プロジェクト: wxFancer/UIWidgets
        public override Widget build(BuildContext context)
        {
            Widget current = this.child;

            if (this.child == null && (this.constraints == null || !this.constraints.isTight))
            {
                current = new LimitedBox(
                    maxWidth: 0.0,
                    maxHeight: 0.0,
                    child: new ConstrainedBox(constraints: BoxConstraints.expand())
                    );
            }

            if (this.alignment != null)
            {
                current = new Align(alignment: this.alignment, child: current);
            }

            EdgeInsets effetivePadding = this._paddingIncludingDecoration;

            if (effetivePadding != null)
            {
                current = new Padding(padding: effetivePadding, child: current);
            }

            if (this.decoration != null)
            {
                current = new DecoratedBox(decoration: this.decoration, child: current);
            }

            if (this.foregroundDecoration != null)
            {
                current = new DecoratedBox(
                    decoration: this.foregroundDecoration,
                    position: DecorationPosition.foreground,
                    child: current
                    );
            }

            if (this.constraints != null)
            {
                current = new ConstrainedBox(constraints: this.constraints, child: current);
            }

            if (this.margin != null)
            {
                current = new Padding(padding: this.margin, child: current);
            }

            if (this.transform != null)
            {
                current = new Transform(transform: new Matrix3(this.transform), child: current);
            }

            return(current);
        }
コード例 #5
0
ファイル: drawer.cs プロジェクト: wxFancer/UIWidgets
 public override Widget build(BuildContext context)
 {
     return(new ConstrainedBox(
                constraints: BoxConstraints.expand(width: DrawerUtils._kWidth),
                child: new Material(
                    elevation: this.elevation,
                    child: this.child
                    )
                ));
 }
コード例 #6
0
        private Widget renderUpload()
        {
            var    thumbnailPath = widget.shareState.thumbnailDir;
            Widget image         = new Icon(Icons.add_photo_alternate, color: new Color(0xFFCECECE), size: 72f);

            if (!string.IsNullOrEmpty(thumbnailPath))
            {
                image = Image.file(thumbnailPath, fit: BoxFit.cover, width: 72, height: 72);
            }

            var imgSelectButton = new FlatButton(
                child: new Text("Select image file...", style: new TextStyle(fontSize: 15f, color: new Color(0xFF2196F3), fontWeight: FontWeight.w700)),
                onPressed: () =>
            {
                string path = EditorUtility.OpenFilePanel("Select thumbnail", "", "jpg,jpeg,png");
                if (path.Length != 0)
                {
                    var fileInfo = new System.IO.FileInfo(path);

                    if (fileInfo.Length > ThumbnailLimitBytes)
                    {
                        widget.onErrorAction($"Max. file size {Utils.FormatBytes(ThumbnailLimitBytes)}");
                    }
                    else
                    {
                        widget.onThumbnailSelect(path);
                    }
                }
            }
                );

            var label = new Text(
                data: $"Max. file size {Utils.FormatBytes(ThumbnailLimitBytes)} (PNG or JPG)",
                style: new TextStyle(fontSize: 13f, color: new Color(0xFF888888))
                );

            return(new Container(
                       color: new Color(0xFFF6F6F6),
                       padding: EdgeInsets.only(top: 10, bottom: 10),
                       child:
                       new Column(
                           children: new List <Widget>()
            {
                image,
                imgSelectButton,
                label
            }
                           ),
                       constraints: BoxConstraints.expand().widthConstraints()
                       ));
        }
コード例 #7
0
ファイル: modal_barrier.cs プロジェクト: JC-ut0/CubeGame
 public override Widget build(BuildContext context)
 {
     return(new GestureDetector(
                onTapDown: details => {
         if (this.dismissible)
         {
             Navigator.maybePop(context);
         }
     },
                behavior: HitTestBehavior.opaque,
                child: new ConstrainedBox(
                    constraints: BoxConstraints.expand(),
                    child: this.color == null ? null : new DecoratedBox(decoration: new BoxDecoration(this.color))
                    )
                ));
 }
コード例 #8
0
        public override Widget build(BuildContext context)
        {
            Widget current = child;

            if (child == null)
            {
                current = new LimitedBox(
                    maxWidth: 0.0f,
                    maxHeight: 0.0f,
                    child: new ConstrainedBox(constraints: BoxConstraints.expand())
                    );
            }

            current = new RaycastableBox(child: current);

            return(current);
        }
コード例 #9
0
        Widget _buildUnderMagnifierScreen()
        {
            Color foreground = this.widget.backgroundColor?.withAlpha(
                (int)(this.widget.backgroundColor.alpha * CupertinoPickerUtils._kForegroundScreenOpacityFraction)
                );

            return(new Column(
                       children: new List <Widget> {
                new Expanded(child: new Container()),
                new Container(
                    color: foreground,
                    constraints: BoxConstraints.expand(
                        height: this.widget.itemExtent * this.widget.magnification
                        )
                    ),
                new Expanded(child: new Container())
            }
                       ));
        }
コード例 #10
0
        Widget _buildMagnifierScreen()
        {
            Color resolvedBorderColor = CupertinoDynamicColor.resolve(CupertinoPickerUtils._kHighlighterBorder, context);

            return(new IgnorePointer(
                       child: new Center(
                           child: new Container(
                               decoration: new BoxDecoration(
                                   border: new Border(
                                       top: new BorderSide(width: 0.0f, color: resolvedBorderColor),
                                       bottom: new BorderSide(width: 0.0f, color: resolvedBorderColor)
                                       )
                                   ),
                               constraints: BoxConstraints.expand(
                                   height: widget.itemExtent * widget.magnification
                                   )
                               )
                           )
                       ));
        }
コード例 #11
0
 public override Widget build(BuildContext context)
 {
     return(new _ModalBarrierGestureDetector(
                onDismiss: () => {
         if (dismissible)
         {
             Navigator.maybePop <object>(context);
         }
     },
                child: new MouseRegion(
                    opaque: true,
                    child: new ConstrainedBox(
                        constraints: BoxConstraints.expand(),
                        child: color == null ? null : new DecoratedBox(
                            decoration: new BoxDecoration(
                                color: color
                                )
                            )
                        )
                    )
                ));
 }
コード例 #12
0
        private Widget renderSuccessWidget()
        {
            var list = new List <Widget>
            {
                renderUploadingHead(),
                new Container(
                    color: new Color(0xFFF6F6F6),
                    padding: EdgeInsets.only(left: 40, right: 40, bottom: 70),
                    child: new Column(
                        children: new List <Widget> {
                    renderIcon(Icons.cloud_done),
                    renderHighlightedLabel("Upload completed:"),
                    renderProjectUrl(),
                    renderNormalLabel("You can play your game in a web browser and share it with your friends!")
                }
                        ),
                    constraints: BoxConstraints.expand().widthConstraints(),
                    alignment: Alignment.center
                    )
            };

            // Open the shared game automatically in the web browser.
            if (UnityConnectSession.loggedIn)
            {
                UnityConnectSession.OpenAuthorizedURLInWebBrowser(widget.shareState.url);
            }
            else
            {
                Application.OpenURL(widget.shareState.url);
            }

            return(new Container(
                       color: new Color(0xFFF6F6F6),
                       padding: EdgeInsets.only(top: 10),
                       child: new Column(children: list, mainAxisAlignment: MainAxisAlignment.spaceBetween)
                       ));
        }
コード例 #13
0
        public override Widget Build(BuildContext context = null)
        {
            var dataset = _collection.DataSet;

            return(new Scaffold(
                       appBar: new AppBar(
                           // leading : new IconButton(icon : new Icon(Icons.menu)),
                           title: new Text(Configuration.Instance.AppName),
                           actions: new List <Widget> {
                new IconButton(
                    icon: new Icon(Icons.add),
                    onPressed: () => Navigator
                    .of(context)
                    .push(
                        new MaterialPageRoute(
                            c => {
                    _addMemorial.Data = null;
                    return _addMemorial.Build(c);
                }

                            )
                        )

                    )
            }
                           ),
                       body: new Container(
                           child: new CustomScrollView(
                               slivers: new List <Widget> {
                new SliverAppBar(
                    floating: true,
                    snap: true,
                    title: new Text(
                        "Album",
                        style: Theme
                        .of(context)
                        .primaryTextTheme
                        .headline
                        ),
                    backgroundColor: Theme
                    .of(context)
                    .secondaryHeaderColor
                    ),
                new SliverGrid(
                    gridDelegate: new SliverGridDelegateWithFixedCrossAxisCount(
                        crossAxisCount: 3
                        ),
                    layoutDelegate: new SliverChildBuilderDelegate(
                        (cont, id) => new Card(
                            child: new Container(
                                child: new ConstrainedBox(
                                    constraints: BoxConstraints.expand(),
                                    child: new FlatButton(
                                        onPressed: () => Navigator
                                        .of(context)
                                        .push(
                                            new  MaterialPageRoute(
                                                c => {
                    _editMemorial.Data = dataset[id];
                    return _editMemorial.Build(c);
                }
                                                )),
                                        padding: EdgeInsets.all(0f),
                                        child: string.IsNullOrEmpty(dataset[id].Sample) ?
                                        null :
                                        dataset[id].DataType == DataType.Asset ?
                                        Image.asset(dataset[id].Sample) :
                                        Image.file(dataset[id].Sample),
                                        splashColor: Theme.of(cont).splashColor
                                        )
                                    )
                                )
                            ),
                        childCount: dataset.Count
                        )
                    )
            }
                               )
                           )
                       ));
        }
コード例 #14
0
        public override Widget build(BuildContext context)
        {
            Widget current = child;

            if (child == null && (constraints == null || !constraints.isTight))
            {
                current = new LimitedBox(
                    maxWidth: 0.0f,
                    maxHeight: 0.0f,
                    child: new ConstrainedBox(constraints: BoxConstraints.expand())
                    );
            }

            if (alignment != null)
            {
                current = new Align(alignment: alignment, child: current);
            }

            EdgeInsetsGeometry effetivePadding = _paddingIncludingDecoration;

            if (effetivePadding != null)
            {
                current = new Padding(padding: effetivePadding, child: current);
            }

            if (color != null)
            {
                current = new ColoredBox(color: color, child: current);
            }

            if (decoration != null)
            {
                current = new DecoratedBox(decoration: decoration, child: current);
            }

            if (foregroundDecoration != null)
            {
                current = new DecoratedBox(
                    decoration: foregroundDecoration,
                    position: DecorationPosition.foreground,
                    child: current
                    );
            }

            if (constraints != null)
            {
                current = new ConstrainedBox(constraints: constraints, child: current);
            }

            if (margin != null)
            {
                current = new Padding(padding: margin, child: current);
            }

            if (transform != null)
            {
                current = new Transform(transform: new Matrix4(transform), child: current);
            }

            if (clipBehavior != Clip.none)
            {
                current = new ClipPath(
                    clipper: new _DecorationClipper(
                        textDirection: Directionality.of(context),
                        decoration: decoration
                        ),
                    clipBehavior: clipBehavior,
                    child: current
                    );
            }

            return(current);
        }
コード例 #15
0
        public ImageFileFormSetField(
            string title = null,
            string lead  = "",
            FormFieldSetter <List <string> > onSaved = null,
            List <string> initialValue = null,
            bool autovalidate          = false,
            bool enabled = true
            ) : base(
                onSaved: onSaved,
                initialValue: initialValue,
                autovalidate: autovalidate,
                enabled: enabled,
                builder: state =>
        {
            var list = new List <Widget> {
                new Card(
                    child: new Container(
                        width: 64f,
                        height: 64f,
                        child: new ConstrainedBox(
                            constraints: BoxConstraints.expand(),
                            child: new FlatButton(
                                onPressed: () => {
                    var ret = DataUploader.OpenFile(
                        lead,
                        "",
                        "png, jpg"
                        );

                    if (state.value == null)
                    {
                        state.didChange(new List <string> { ret });
                    }
                    else
                    {
                        state.value.Add(ret);
                        state.didChange(state.value);
                    }
                },
                                padding: EdgeInsets.all(0f),
                                child: new Icon(Icons.add)
                                )
                            )
                        )
                    )
            };
            if (state.value != null)
            {
                list.AddRange(
                    state
                    .value
                    .Select((path, i) => new Card(
                                child: new Container(
                                    width: 64f,
                                    height: 64f,
                                    child: new ConstrainedBox(
                                        constraints: BoxConstraints.expand(),
                                        child: new FlatButton(
                                            onPressed: () => {
                    var ret = DataUploader.OpenFile(
                        lead,
                        "",
                        "png, jpg"
                        );
                    state.value[i] = ret;
                    state.didChange(state.value);
                },
                                            padding: EdgeInsets.all(0f),
                                            child: Image.file(path)
                                            )
                                        )
                                    )
                                )
                            )
                    );
            }

            return(new Column(
                       crossAxisAlignment: CrossAxisAlignment.start,
                       mainAxisSize: MainAxisSize.max,
                       children: new List <Widget> {
                new Container(
                    margin: EdgeInsets.only(top: 8f),
                    height: string.IsNullOrEmpty(title) ? new float?(0f) : null,
                    width: float.MaxValue,
                    child: string.IsNullOrEmpty(title) ? null : new Text(title)
                    ),
                new Container(
                    height: 72f,
                    child: new ListView(
                        scrollDirection: Axis.horizontal,
                        children: list
                        )
                    )
            }
                       ));
        },
                validator: value => {
            return(null);
        }
                ) {}
コード例 #16
0
 public ImageFileFormField(
     string title = null,
     string lead  = "",
     FormFieldSetter <string> onSaved = null,
     string initialValue = "",
     bool autovalidate   = false,
     bool enabled        = true
     ) : base(
         onSaved: onSaved,
         initialValue: initialValue,
         autovalidate: autovalidate,
         enabled: enabled,
         builder: state => new Column(
             crossAxisAlignment: CrossAxisAlignment.start,
             mainAxisSize: MainAxisSize.max,
             children: new List <Widget> {
     new Container(
         margin: EdgeInsets.only(top: 8f),
         height: string.IsNullOrEmpty(title) ? new float?(0f) : null,
         child: string.IsNullOrEmpty(title) ? null : new Text(title)
         ),
     new Card(
         child: new Container(
             width: 128,
             height: 128,
             child: new ConstrainedBox(
                 constraints: BoxConstraints.expand(),
                 child: new FlatButton(
                     onPressed: () => {
         var ret = DataUploader.OpenFile(
             lead,
             "",
             "png, jpg"
             );
         state.didChange(ret);
     },
                     padding: EdgeInsets.all(0f),
                     child: string.IsNullOrEmpty(state.value) ?
                     (Widget)(new Icon(Icons.add)) :
                     (Widget)Image.file(state.value)
                     )
                 )
             )
         ),
     new Container(
         height: string.IsNullOrEmpty(state.errorText) ? new float?(0f) : null,
         padding: EdgeInsets.only(top: 4f),
         child: new Text(
             state.errorText ?? "",
             style: new TextStyle(
                 color: Theme.of(state.context).errorColor
                 )
             )
         )
 }
             ),
         validator: value => {
     if (string.IsNullOrEmpty(value))
     {
         return("Please select an image.");
     }
     return(null);
 }
         ) {}