Esempio n. 1
0
 public override Widget build(BuildContext context)
 {
     return(new Container(
                width: 140,
                height: 140,
                decoration: new BoxDecoration(
                    color: Color.fromRGBO(220, 220, 220, 220),
                    borderRadius: BorderRadius.circular(100f),
                    boxShadow: new List <BoxShadow>()
     {
         new BoxShadow(
             color: Color.fromRGBO(220, 220, 220, 220),
             blurRadius: 0f
             )
     }
                    ),
                child: new Center(
                    child: new Text(
                        data: widget.Text.ToUpper(),
                        textAlign: TextAlign.center,
                        style: new TextStyle(
                            color: Colors.black,
                            fontSize: 24
                            )
                        )
                    )
                ));
 }
Esempio n. 2
0
 private Widget _middle()
 {
     return(new Container(
                margin: EdgeInsets.only(top: 10),
                padding: EdgeInsets.only(top: 6, bottom: 6),
                decoration: new BoxDecoration(
                    color: CColors.White,
                    border: Border.all(color: CColors.Black, width: 1),
                    borderRadius: BorderRadius.all(5)
                    ),
                child: new Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: new List <Widget>
     {
         new Icon(icon: MyIcons.camera_alt, color: CColors.Black),
         new Padding(padding: EdgeInsets.only(left: 10)),
         new Text(
             data: "留些足迹",
             style: new TextStyle(
                 color: CColors.Black,
                 fontSize: 20,
                 fontFamily: "Roboto-Bold",
                 fontWeight: FontWeight.w300,
                 decoration: TextDecoration.none
                 )
             ),
     })));
 }
Esempio n. 3
0
        /// <summary>
        /// Starts the new radius rule.
        /// </summary>
        /// <param name="borderRadius">Border radius to be applied.</param>
        /// <returns>Next rule reference.</returns>
        public IFluentBorderWithAll WithRadius(BorderRadius borderRadius)
        {
            this.borderRadius = borderRadius;
            Dirty();

            return(this);
        }
Esempio n. 4
0
 public HsvColorPicker(
     HSVColor pickerColor,
     TextStyle labelTextStyle,
     PaletteType paletteType                = PaletteType.hsv,
     bool enableAlpha                       = true,
     bool showLabel                         = true,
     bool displayThumbColor                 = false,
     float colorPickerWidth                 = 300f,
     float pickerAreaHeightPercent          = 1f,
     BorderRadius pickerAreaBorderRadius    = null,
     ValueChanged <HSVColor> onColorChanged = null
     )
 {
     this.pickerColor             = pickerColor;
     this.labelTextStyle          = labelTextStyle;
     this.paletteType             = paletteType;
     this.enableAlpha             = enableAlpha;
     this.showLabel               = showLabel;
     this.displayThumbColor       = displayThumbColor;
     this.colorPickerWidth        = colorPickerWidth;
     this.pickerAreaHeightPercent = pickerAreaHeightPercent;
     if (pickerAreaBorderRadius != null)
     {
         this.pickerAreaBorderRadius = pickerAreaBorderRadius;
     }
     else
     {
         this.pickerAreaBorderRadius = BorderRadius.all(Radius.zero);
     }
     this.onColorChanged = onColorChanged;
 }
Esempio n. 5
0
 static Widget _buildContent()
 {
     return(new Container(
                margin: EdgeInsets.only(top: 80),
                child: new Column(
                    children: new List <Widget> {
         new Container(
             margin: EdgeInsets.only(bottom: 16),
             alignment: Alignment.center,
             width: 120,
             height: 120,
             decoration: new BoxDecoration(
                 borderRadius: BorderRadius.all(14),
                 border: Border.all(CColors.Separator)
                 ),
             child: new Icon(
                 Icons.UnityLogo,
                 size: 80
                 )
             ),
         new Text(
             "Unity Connect",
             style: CTextStyle.H4
             ),
         new Container(height: 20),
         new Text(
             $"版本号:{Config.versionNumber}",
             style: CTextStyle.PLargeBody4
             )
     }
                    )
                ));
 }
Esempio n. 6
0
        Widget container()
        {
            var image = Image.network(
                "https://tse3.mm.bing.net/th?id=OIP.XOAIpvR1kh-CzISe_Nj9GgHaHs&pid=Api",
                width: 100,
                height: 100,
                repeat: ImageRepeat.repeatX
                );
            var container = new Container(
                width: 200,
                height: 200,
                margin: EdgeInsets.all(30.0f),
                padding: EdgeInsets.all(15.0f),
                child: image,
                decoration: new BoxDecoration(
                    color: CLColors.white,
                    borderRadius: BorderRadius.all(30),
                    gradient: new LinearGradient(colors: new List <Color> {
                CLColors.blue, CLColors.red, CLColors.green
            })
                    )
                );

            return(container);
        }
 Widget _buildSearchBar()
 {
     return(new Container(
                color: CColors.White,
                padding: EdgeInsets.only(16, 16, 16, 12),
                child: new InputField(
                    decoration: new BoxDecoration(
                        color: CColors.Separator2,
                        borderRadius: BorderRadius.all(8)
                        ),
                    height: 36,
                    controller: this._editingController,
                    style: CTextStyle.PLargeBody2,
                    prefix: new Container(
                        padding: EdgeInsets.only(8, right: 4),
                        child: new Icon(
                            icon: Icons.search,
                            size: 24,
                            color: CColors.BrownGrey
                            )
                        ),
                    hintText: "搜索",
                    hintStyle: CTextStyle.PLargeBody4.merge(new TextStyle(height: 1)),
                    cursorColor: CColors.PrimaryBlue,
                    textInputAction: TextInputAction.search,
                    clearButtonMode: InputFieldClearButtonMode.whileEditing,
                    onChanged: this._onSearch,
                    onSubmitted: this._onSearch
                    )
                ));
 }
Esempio n. 8
0
        public InkHighlight(
            MaterialInkController controller = null,
            RenderBox referenceBox           = null,
            Color color               = null,
            BoxShape shape            = BoxShape.rectangle,
            BorderRadius borderRadius = null,
            ShapeBorder customBorder  = null,
            RectCallback rectCallback = null,
            VoidCallback onRemoved    = null) : base(
                controller: controller,
                referenceBox: referenceBox,
                color: color,
                onRemoved: onRemoved)
        {
            D.assert(color != null);
            D.assert(controller != null);
            D.assert(referenceBox != null);
            this._shape        = shape;
            this._borderRadius = borderRadius ?? BorderRadius.zero;
            this._customBorder = customBorder;
            this._rectCallback = rectCallback;

            this._alphaController = new AnimationController(
                duration: InkHighlightUtils._kHighlightFadeDuration,
                vsync: controller.vsync);
            this._alphaController.addListener(controller.markNeedsPaint);
            this._alphaController.addStatusListener(this._handleAlphaStatusChanged);
            this._alphaController.forward();

            this._alpha = this._alphaController.drive(new IntTween(
                                                          begin: 0, end: color.alpha));

            this.controller.addInkFeature(this);
        }
Esempio n. 9
0
 Widget _buildPopupLikeButton(
     string content,
     bool selected,
     bool leftMost,
     bool rightMost,
     GestureTapCallback onTap)
 {
     return(new GestureDetector(
                onTap: onTap,
                child: new Container(
                    padding: EdgeInsets.only(left: leftMost ? 0 : 2, right: rightMost ? 0 : 2),
                    child: new Container(
                        width: 44,
                        height: 44,
                        decoration: new BoxDecoration(
                            borderRadius: BorderRadius.all(12),
                            color: selected ? CColors.Separator2 : CColors.Transparent),
                        child: new Center(
                            child: Image.asset(
                                content,
                                width: this._buttonSizeValue,
                                height: this._buttonSizeValue)
                            )
                        )
                    )
                ));
 }
Esempio n. 10
0
        public Material(
            Key key                    = null,
            MaterialType type          = MaterialType.canvas,
            double elevation           = 0.0,
            Color color                = null,
            Color shadowColor          = null,
            TextStyle textStyle        = null,
            BorderRadius borderRadius  = null,
            ShapeBorder shape          = null,
            Clip clipBehavior          = Clip.none,
            TimeSpan?animationDuration = null,
            Widget child               = null
            ) : base(key: key)
        {
            D.assert(!(shape != null && borderRadius != null));
            D.assert(!(type == MaterialType.circle && (borderRadius != null || shape != null)));

            this.type              = type;
            this.elevation         = elevation;
            this.color             = color;
            this.shadowColor       = shadowColor ?? new Color(0xFF000000);
            this.textStyle         = textStyle;
            this.borderRadius      = borderRadius;
            this.shape             = shape;
            this.clipBehavior      = clipBehavior;
            this.animationDuration = animationDuration ?? Constants.kThemeChangeDuration;
            this.child             = child;
        }
        /// <summary>Gets the array that defines the borders.</summary>
        /// <param name="styles">the styles mapping</param>
        /// <param name="em">the em value</param>
        /// <param name="rem">the root em value</param>
        /// <returns>the borders array</returns>
        public static BorderRadius[] GetBorderRadiiArray(IDictionary <String, String> styles, float em, float rem)
        {
            BorderRadius[] borderRadii    = new BorderRadius[4];
            BorderRadius   borderRadius   = null;
            UnitValue      borderRadiusUV = CssUtils.ParseLengthValueToPt(styles.Get(CssConstants.BORDER_RADIUS), em, rem);

            if (null != borderRadiusUV)
            {
                borderRadius = new BorderRadius(borderRadiusUV);
            }
            UnitValue[] borderTopLeftRadiusUV = CssUtils.ParseSpecificCornerBorderRadius(styles.Get(CssConstants.BORDER_TOP_LEFT_RADIUS
                                                                                                    ), em, rem);
            borderRadii[0] = null == borderTopLeftRadiusUV ? borderRadius : new BorderRadius(borderTopLeftRadiusUV[0],
                                                                                             borderTopLeftRadiusUV[1]);
            UnitValue[] borderTopRightRadiusUV = CssUtils.ParseSpecificCornerBorderRadius(styles.Get(CssConstants.BORDER_TOP_RIGHT_RADIUS
                                                                                                     ), em, rem);
            borderRadii[1] = null == borderTopRightRadiusUV ? borderRadius : new BorderRadius(borderTopRightRadiusUV[0
                                                                                              ], borderTopRightRadiusUV[1]);
            UnitValue[] borderBottomRightRadiusUV = CssUtils.ParseSpecificCornerBorderRadius(styles.Get(CssConstants.BORDER_BOTTOM_RIGHT_RADIUS
                                                                                                        ), em, rem);
            borderRadii[2] = null == borderBottomRightRadiusUV ? borderRadius : new BorderRadius(borderBottomRightRadiusUV
                                                                                                 [0], borderBottomRightRadiusUV[1]);
            UnitValue[] borderBottomLeftRadiusUV = CssUtils.ParseSpecificCornerBorderRadius(styles.Get(CssConstants.BORDER_BOTTOM_LEFT_RADIUS
                                                                                                       ), em, rem);
            borderRadii[3] = null == borderBottomLeftRadiusUV ? borderRadius : new BorderRadius(borderBottomLeftRadiusUV
                                                                                                [0], borderBottomLeftRadiusUV[1]);
            return(borderRadii);
        }
Esempio n. 12
0
 public InkResponse(
     Key key                                    = null,
     Widget child                               = null,
     GestureTapCallback onTap                   = null,
     GestureTapDownCallback onTapDown           = null,
     GestureTapCallback onTapCancel             = null,
     GestureTapCallback onDoubleTap             = null,
     GestureLongPressCallback onLongPress       = null,
     ValueChanged <bool> onHighlightChanged     = null,
     bool containedInkWell                      = false,
     BoxShape highlightShape                    = BoxShape.circle,
     double?radius                              = null,
     BorderRadius borderRadius                  = null,
     ShapeBorder customBorder                   = null,
     Color highlightColor                       = null,
     Color splashColor                          = null,
     InteractiveInkFeatureFactory splashFactory = null) : base(key: key)
 {
     this.child              = child;
     this.onTap              = onTap;
     this.onTapDown          = onTapDown;
     this.onTapCancel        = onTapCancel;
     this.onDoubleTap        = onDoubleTap;
     this.onLongPress        = onLongPress;
     this.onHighlightChanged = onHighlightChanged;
     this.containedInkWell   = containedInkWell;
     this.highlightShape     = highlightShape;
     this.radius             = radius;
     this.borderRadius       = borderRadius;
     this.customBorder       = customBorder;
     this.highlightColor     = highlightColor;
     this.splashColor        = splashColor;
     this.splashFactory      = splashFactory;
 }
Esempio n. 13
0
 public override Widget build(BuildContext context)
 {
     return(new Stack(
                children: new List <Widget>
     {
         new Image(
             image: widget.image,
             fit: widget.fit
             ),
         new ClipRRect(
             borderRadius: BorderRadius.all(2),
             child: new Container(
                 color: new Color(0xb2000000),
                 alignment: Alignment.center,
                 child: new Container(
                     height: 8,
                     margin: EdgeInsets.symmetric(horizontal: 32),
                     decoration: new BoxDecoration(
                         color: new Color(0xb2000000)
                         ),
                     alignment: Alignment.centerLeft,
                     child: new Container(
                         width: 218 * widget.progress(),
                         color: new Color(0xff00cccc)
                         )
                     )
                 )
             ),
     }
                ));
 }
Esempio n. 14
0
        List <Widget> _buildPopularSearchItem(List <PopularSearch> popularSearch)
        {
            List <Widget> widgets = new List <Widget>();

            popularSearch.ForEach(item => {
                Widget widget = new GestureDetector(
                    onTap: () => this._searchArticle(item.keyword),
                    child: new Container(
                        decoration: new BoxDecoration(
                            CColors.Separator2,
                            borderRadius: BorderRadius.circular(16)
                            ),
                        height: 32,
                        padding: EdgeInsets.only(16, 7, 16),
                        child: new Text(
                            item.keyword,
                            maxLines: 1,
                            style: new TextStyle(
                                fontSize: 16,
                                fontFamily: "Roboto-Regular",
                                color: CColors.TextBody
                                ),
                            overflow: TextOverflow.ellipsis
                            )
                        )
                    );
                widgets.Add(widget);
            });
            return(widgets);
        }
Esempio n. 15
0
        Widget _buildCoverButtonItem(int index, float buttonSize)
        {
            var imageName  = CImageUtils.FavoriteCoverImages[index : index];
            var isSelected = this._favoriteImageName == imageName;

            return(new CustomButton(
                       width: buttonSize,
                       height: buttonSize,
                       decoration: new BoxDecoration(
                           color: CColors.BlackHaze,
                           borderRadius: BorderRadius.circular(4),
                           border: Border.all(
                               isSelected ? CColors.TextBody : CColors.BlackHaze,
                               1.5f
                               )
                           ),
                       child: Image.asset(
                           $"{CImageUtils.FavoriteCoverImagePath}/{imageName}"
                           ),
                       onPressed: () => {
                this.PackUpKeyboard();
                this._setEnableSubmit();
                if (this._favoriteImageName != imageName)
                {
                    this.setState(() => this._favoriteImageName = imageName);
                }
            }
                       ));
        }
Esempio n. 16
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
                ));
 }
Esempio n. 17
0
 public override Widget build(BuildContext context)
 {
     return(new Container(
                child: new Column(
                    children: new List <Widget>
     {
         new Container(
             width: 100,
             height: 100,
             decoration: new BoxDecoration(
                 borderRadius: BorderRadius.all(Radius.circular(8))
                 ),
             child: Image.file(imagePath[imageId])
             ),
         new Text(imagePath[imageId]),
         new GestureDetector(
             onTap: () => { setState(() => { imageId = (imageId + 1) % imagePath.Count; }); },
             child: new Container(
                 color: Color.black,
                 padding: EdgeInsets.symmetric(20, 20),
                 child: new Text("Next"
                                 )
                 ))
     }
                    )));
 }
Esempio n. 18
0
 public override Widget build(BuildContext context)
 {
     return(new Container(
                child: new Column(
                    children: new List <Widget>
     {
         new Lottie("wine.json", size: new Size(100, 100)),
         new Container(
             width: 100,
             height: 100,
             decoration: new BoxDecoration(
                 borderRadius: BorderRadius.all(Radius.circular(8))
                 ),
             child: Image.file("test.gif", gaplessPlayback: true)
             ),
         new Container(
             width: 200,
             height: 100,
             decoration: new BoxDecoration(
                 borderRadius: BorderRadius.all(Radius.circular(8))
                 ),
             child: Image.network(
                 "https://unity-cn-cms-prd-1254078910.cos.ap-shanghai.myqcloud.com/assetstore-cms-media/img-7dfe215f-0075-4f9c-9b5a-be5ee88b866b",
                 gaplessPlayback: true)
             )
     }
                    )
                ));
 }
Esempio n. 19
0
 RenderBox decoratedBox()
 {
     return(new RenderConstrainedOverflowBox(
                minWidth: 100,
                maxWidth: 100,
                minHeight: 100,
                maxHeight: 100,
                child: new RenderDecoratedBox(
                    decoration: new BoxDecoration(
                        color: new Color(0xFFFF00FF),
                        borderRadius: BorderRadius.all(15),
                        boxShadow: new List <BoxShadow> {
         new BoxShadow(
             color: new Color(0xFFFF00FF),
             offset: new Offset(0, 0),
             blurRadius: 3.0f,
             spreadRadius: 10
             )
     },
                        image: new DecorationImage(
                            image: new NetworkImage(
                                url:
                                "https://sg.fiverrcdn.com/photos/4665137/original/39322-140411095619534.jpg?1424268945"
                                ),
                            fit: BoxFit.cover)
                        )
                    )
                ));
 }
Esempio n. 20
0
        public static CupertinoButton filled(
            Key key      = null,
            Widget child = null,
            EdgeInsetsGeometry padding = null,
            Color disabledColor        = null,
            float?minSize             = 44.0f,
            float pressedOpacity      = 0.4f,
            BorderRadius borderRadius = null,
            VoidCallback onPressed    = null
            )
        {
            disabledColor = disabledColor ?? CupertinoColors.quaternarySystemFill;
            D.assert(pressedOpacity >= 0.0 && pressedOpacity <= 1.0);
            var btn = new CupertinoButton(
                key: key,
                color: null,
                child: child,
                padding: padding,
                disabledColor: disabledColor,
                minSize: minSize,
                pressedOpacity: pressedOpacity,
                borderRadius: borderRadius,
                onPressed: onPressed
                );

            btn._filled = true;
            return(btn);
        }
 public AnimatedPhysicalModel(
     Key key                   = null,
     Widget child              = null,
     BoxShape?shape            = null,
     Clip clipBehavior         = Clip.none,
     BorderRadius borderRadius = null,
     float?elevation           = null,
     Color color               = null,
     bool animateColor         = true,
     Color shadowColor         = null,
     bool animateShadowColor   = true,
     Curve curve               = null,
     TimeSpan?duration         = null
     ) : base(key: key, curve: curve ?? Curves.linear, duration: duration)
 {
     D.assert(child != null);
     D.assert(shape != null);
     D.assert(elevation != null);
     D.assert(color != null);
     D.assert(shadowColor != null);
     D.assert(duration != null);
     this.child              = child;
     this.shape              = shape ?? BoxShape.circle;
     this.clipBehavior       = clipBehavior;
     this.borderRadius       = borderRadius ?? BorderRadius.zero;
     this.elevation          = elevation ?? 0.0f;
     this.color              = color;
     this.animateColor       = animateColor;
     this.shadowColor        = shadowColor;
     this.animateShadowColor = animateShadowColor;
 }
Esempio n. 22
0
        Widget _buildCart(BuildContext context, Widget child)
        {
            AppStateModel model = ScopedModel <AppStateModel> .of(context);

            int   numProducts       = model.productsInCart.Keys.Count;
            int   totalCartQuantity = model.totalCartQuantity;
            Size  screenSize        = MediaQuery.of(context).size;
            float screenWidth       = screenSize.width;
            float screenHeight      = screenSize.height;

            _width                     = _widthFor(numProducts);
            _widthAnimation            = _getWidthAnimation(screenWidth);
            _heightAnimation           = _getHeightAnimation(screenHeight);
            _shapeAnimation            = _getShapeAnimation();
            _thumbnailOpacityAnimation = _getThumbnailOpacityAnimation();
            _cartOpacityAnimation      = _getCartOpacityAnimation();

            return(new Container(
                       width: _widthAnimation.value,
                       height: _heightAnimation.value,
                       child: new Material(
                           animationDuration: TimeSpan.FromMilliseconds(0),
                           shape: new BeveledRectangleBorder(
                               borderRadius: BorderRadius.only(
                                   topLeft: Radius.circular(_shapeAnimation.value)
                                   )
                               ),
                           elevation: 4.0f,
                           color: shrineColorsUtils.kShrinePink50,
                           child: _cartIsVisible
            ? _buildShoppingCartPage()
            : _buildThumbnails(numProducts)
                           )
                       ));
        }
Esempio n. 23
0
 Widget createWidget()
 {
     return(new Container(
                height: 200.0f,
                padding: EdgeInsets.all(10),
                decoration: new BoxDecoration(
                    color: new Color(0xFF7F7F7F),
                    border: Border.all(color: Color.fromARGB(255, 255, 0, 0), width: 5),
                    borderRadius: BorderRadius.all(2)),
                child: new Column(
                    children: new List <Widget>()
     {
         new StoreConnector <CouterState, string>(
             converter: (state, dispatch) => $"Count:{state.count}",
             builder: (context, countText) => new Text(countText, style: new TextStyle(
                                                           fontSize: 20, fontWeight: FontWeight.w700
                                                           ))
             ),
         new StoreConnector <CouterState, Action>(
             converter: (state, dispatch) => () => { dispatch(new CounterIncAction()
             {
                 amount = 1
             }); },
             builder: (context, onPress) => new CustomButton(
                 backgroundColor: Color.fromARGB(255, 0, 204, 204),
                 padding: EdgeInsets.all(10),
                 child: new Text("Add", style: new TextStyle(
                                     fontSize: 16, color: Color.fromARGB(255, 255, 255, 255)
                                     )), onPressed: () => { onPress(); })
             ),
     }
                    )
                ));
 }
        private Decoration getIndicator()
        {
            if (!_customIndicator)
            {
                return(new UnderlineTabIndicator());
            }

            switch (_demoStyle)
            {
            case TabsDemoStyle.iconsAndText:
                return(new ShapeDecoration(
                           shape: new RoundedRectangleBorder(
                               borderRadius: BorderRadius.all(Radius.circular(4.0f)),
                               side: new BorderSide(
                                   color: Colors.white24,
                                   width: 2.0f
                                   )
                               ) + new RoundedRectangleBorder(
                               borderRadius: BorderRadius.all(Radius.circular(4.0f)),
                               side: new BorderSide(
                                   color: Colors.transparent,
                                   width: 4.0f
                                   )
                               )
                           ));

            case TabsDemoStyle.iconsOnly:
                return(new ShapeDecoration(
                           shape: new CircleBorder(
                               side: new BorderSide(
                                   color: Colors.white24,
                                   width: 4.0f
                                   )
                               ) + new CircleBorder(
                               side: new BorderSide(
                                   color: Colors.transparent,
                                   width: 4.0f
                                   )
                               )
                           ));

            case TabsDemoStyle.textOnly:
                return(new ShapeDecoration(
                           shape: new StadiumBorder(
                               side: new BorderSide(
                                   color: Colors.white24,
                                   width: 2.0f
                                   )
                               ) + new StadiumBorder(
                               side: new BorderSide(
                                   color: Colors.transparent,
                                   width: 4.0f
                                   )
                               )
                           ));
            }

            return(null);
        }
        Widget _buildArticleCard(BuildContext context, int index)
        {
            var article = this.viewModel.articleHistory[index : index];
            var linkUrl = CStringUtils.JointProjectShareLink(projectId: article.id);

            return(CustomDismissible.builder(
                       Key.key(value: article.id),
                       new ArticleCard(
                           article: article,
                           () => this.actionModel.pushToArticleDetail(obj: article.id),
                           () => ShareManager.showArticleShareView(
                               true,
                               isLoggedIn: this.viewModel.isLoggedIn,
                               () => {
                Clipboard.setData(new ClipboardData(text: linkUrl));
                CustomDialogUtils.showToast("复制链接成功", Icons.check_circle_outline);
            },
                               () => this.actionModel.pushToLogin(),
                               () => this.actionModel.pushToBlock(article.id),
                               () => this.actionModel.pushToReport(article.id, ReportType.article),
                               type => {
                CustomDialogUtils.showCustomDialog(
                    child: new CustomLoadingDialog()
                    );
                string imageUrl = CImageUtils.SizeTo200ImageUrl(article.thumbnail.url);
                this.actionModel.shareToWechat(arg1: type, arg2: article.title,
                                               arg3: article.subTitle, arg4: linkUrl, arg5: imageUrl)
                .Then(onResolved: CustomDialogUtils.hiddenCustomDialog)
                .Catch(_ => CustomDialogUtils.hiddenCustomDialog());
            }
                               ),
                           fullName: article.fullName,
                           index == 0,
                           new ObjectKey(value: article.id)
                           ),
                       new CustomDismissibleDrawerDelegate(),
                       secondaryActions: new List <Widget> {
                new GestureDetector(
                    onTap: () => this.actionModel.deleteArticleHistory(obj: article.id),
                    child: new Container(
                        color: CColors.Separator2,
                        width: 80,
                        alignment: Alignment.center,
                        child: new Container(
                            width: 44,
                            height: 44,
                            alignment: Alignment.center,
                            decoration: new BoxDecoration(
                                CColors.White,
                                borderRadius: BorderRadius.circular(22)
                                ),
                            child: new Icon(Icons.delete_outline, size: 28, color: CColors.Error)
                            )
                        )
                    )
            },
                       controller: this._controller
                       ));
        }
Esempio n. 26
0
 public override Widget build(BuildContext context)
 {
     return(new Container(
                height: 200,
                padding: EdgeInsets.all(10),
                decoration: new BoxDecoration(
                    color: new Color(0xFFEF1F7F),
                    border: Border.all(color: Color.fromARGB(255, 0xDF, 0x10, 0x70), width: 5),
                    borderRadius: BorderRadius.all(20)
                    ),
                child: new Center(
                    child: new Column(
                        children: new List <Widget>()
     {
         new Text(this.title),
         new Divider(),
         new Text(this.subtitle),
         new Divider(),
         new Container(
             width: 500,
             decoration: new BoxDecoration(border: Border.all(new Color(0xFF00FF00), 1)),
             child: new EditableText(
                 controller: this.controller,
                 focusNode: new FocusNode(),
                 style: new TextStyle(
                     fontSize: 18,
                     height: 1.5f,
                     color: new Color(0xFFFF89FD)),
                 cursorColor: Color.fromARGB(255, 0, 0, 0)
                 )
             ),
         new Divider(),
         new ButtonBar(
             children: new List <Widget> {
             new FlatButton(
                 onPressed: () => {
                 this.setState(() => { this.title = this.controller.text; });
             },
                 padding: EdgeInsets.all(5.0f),
                 child: new Center(
                     child: new Text("Set Title")
                     )
                 ),
             new RaisedButton(
                 onPressed: () => {
                 this.setState(() => { this.subtitle = this.controller.text; });
             },
                 padding: EdgeInsets.all(5.0f),
                 child: new Center(
                     child: new Text("Set Subtitle")
                     )
                 )
         }
             )
     }
                        )
                    )
                ));
 }
Esempio n. 27
0
        Widget _buildAvatar(User user)
        {
            var httpsUrl = user.avatar;

            // fix Android 9 http request error
            if (httpsUrl.Contains("http://"))
            {
                httpsUrl = httpsUrl.Replace("http://", "https://");
            }

            var image = this._pickedImage.isEmpty()
                ? Image.network(src: httpsUrl)
                : Image.memory(Convert.FromBase64String(s: this._pickedImage));
            var child = user.avatar.isEmpty() && this._pickedImage.isEmpty()
                ? new Container(
                child: new _Placeholder(
                    user.id ?? "",
                    user.fullName ?? "",
                    120
                    )
                )
                : new Container(
                width: 120,
                height: 120,
                color: CColors.AvatarLoading,
                child: image
                );

            return(new Container(
                       width: 120,
                       height: 120,
                       decoration: new BoxDecoration(
                           borderRadius: BorderRadius.circular(60),
                           border: Border.all(
                               color: CColors.White,
                               2
                               )
                           ),
                       child: new ClipRRect(
                           borderRadius: BorderRadius.circular(60),
                           child: new Stack(
                               children: new List <Widget> {
                child,
                new Positioned(
                    bottom: 0,
                    left: 0,
                    right: 0,
                    child: new Container(
                        height: 32,
                        color: Color.fromRGBO(0, 0, 0, 0.3f),
                        child: new Container(
                            color: CColors.Transparent,
                            child: new Icon(icon: Icons.camera_alt, size: 20, color: CColors.White))
                        )
                    )
            })
                           )
                       ));
        }
Esempio n. 28
0
 public override Widget build(BuildContext context)
 {
     return(new Container(
                color: CColors.White,
                child: new Unity.UIWidgets.widgets.Stack(
                    children: new List <Widget>
     {
         new Align(
             alignment: Alignment.topLeft,
             child: new IconButton(
                 onPressed: () =>
         {
             Navigator.pop(Prefabs.instance.homeContext);
         },
                 icon: new Icon(
                     size: 60,
                     icon: MyIcons.tab_home_fill
                     )
                 )
             ),
         new Align(
             alignment: Alignment.bottomCenter,
             child: new Column(
                 verticalDirection: VerticalDirection.up,
                 children: new List <Widget>
         {
             new GestureDetector(
                 onTapDown: detail =>
             {
                 setState(() => { preview = true; });
             },
                 onTapCancel: () =>
             {
                 setState(() => { preview = false; });
             },
                 onTapUp: detail =>
             {
                 setState(() => { preview = false; });
             },
                 child: new Container(
                     decoration: new BoxDecoration(
                         color: CColors.Red,
                         borderRadius: BorderRadius.all(90)
                         ),
                     child: new Icon(
                         icon: MyIcons.eye,
                         size: 90
                         )
                     )
                 ),
             imagePreview(),
         }
                 )
             )
     }
                    )
                ));
 }
Esempio n. 29
0
        Widget _buildSubmitButton()
        {
            Widget right = new Container();

            if (this.widget.viewModel.loading)
            {
                right = new CustomActivityIndicator(
                    loadingColor: LoadingColor.white,
                    size: LoadingSize.small
                    );
            }

            return(new Container(
                       padding: EdgeInsets.symmetric(horizontal: 16),
                       margin: EdgeInsets.only(top: 32),
                       child: new CustomButton(
                           onPressed: () => {
                if (this.widget.viewModel.loading || !this._isCompleted)
                {
                    return;
                }

                this.widget.actionModel.startFeedback();
                this.widget.actionModel.sendFeedbak(this._contentController.text, this._nameController.text,
                                                    this._contactController.text
                                                    );
            },
                           padding: EdgeInsets.zero,
                           child: new Container(
                               height: 40,
                               decoration: new BoxDecoration(
                                   this._isCompleted
                                ? this.widget.viewModel.loading
                                    ? CColors.ButtonActive
                                    : CColors.PrimaryBlue
                                : CColors.Disable,
                                   borderRadius: BorderRadius.all(4)
                                   ),
                               child: new Stack(
                                   children: new List <Widget> {
                new Align(
                    alignment: Alignment.center,
                    child: new Text(
                        "提交",
                        style: CTextStyle.PLargeMediumWhite
                        )
                    ),
                new Positioned(
                    right: 24,
                    height: 40,
                    child: right
                    )
            }
                                   )
                               )
                           )
                       ));
        }
Esempio n. 30
0
        public override Widget build(BuildContext context)
        {
            List <Widget> children = new List <Widget> {
                new Flexible(child: new ClipRRect(
                                 borderRadius: BorderRadius.circular(12.0f),
                                 child: new BackdropFilter(
                                     filter: ImageFilter.blur(
                                         sigmaX: CupertinoActionSheetUtils._kBlurAmount,
                                         sigmaY: CupertinoActionSheetUtils._kBlurAmount),
                                     child: new _CupertinoAlertRenderWidget(
                                         contentSection: new Builder(builder: _buildContent),
                                         actionsSection: _buildActions()
                                         )
                                     )
                                 )
                             ),
            };

            if (cancelButton != null)
            {
                children.Add(_buildCancelButton()
                             );
            }

            Orientation?orientation = MediaQuery.of(context).orientation;

            float actionSheetWidth;

            if (orientation == Orientation.portrait)
            {
                actionSheetWidth = MediaQuery.of(context).size.width -
                                   (CupertinoActionSheetUtils._kEdgeHorizontalPadding * 2);
            }
            else
            {
                actionSheetWidth = MediaQuery.of(context).size.height -
                                   (CupertinoActionSheetUtils._kEdgeHorizontalPadding * 2);
            }

            return(new SafeArea(
                       child:  new CupertinoUserInterfaceLevel(
                           data: CupertinoUserInterfaceLevelData.elevatedlayer,
                           child: new Container(
                               width: actionSheetWidth,
                               margin: EdgeInsets.symmetric(
                                   horizontal: CupertinoActionSheetUtils._kEdgeHorizontalPadding,
                                   vertical: CupertinoActionSheetUtils._kEdgeVerticalPadding
                                   ),
                               child: new Column(
                                   children: children,
                                   mainAxisSize: MainAxisSize.min,
                                   crossAxisAlignment: CrossAxisAlignment.stretch
                                   ))
                           )

                       ));
        }