Widget _buildLoginInNavigationBar()
        {
            var    user = this.widget.viewModel.userDict[key : this.widget.viewModel.user.userId];
            Widget titleWidget;

            if (user.title != null && user.title.isNotEmpty())
            {
                titleWidget = new Container(
                    padding: EdgeInsets.only(top: 4),
                    child: new Text(
                        data: user.title,
                        style: new TextStyle(
                            fontSize: 14,
                            fontFamily: "Roboto-Regular",
                            color: CColors.Grey80
                            ),
                        maxLines: 1,
                        overflow: TextOverflow.ellipsis
                        )
                    );
            }
            else
            {
                titleWidget = new Container();
            }

            return(new Stack(
                       children: new List <Widget> {
                new Container(
                    color: CColors.BgGrey,
                    padding: EdgeInsets.only(bottom: 56),
                    child: new GestureDetector(
                        onTap: () => this.widget.actionModel.pushToUserDetail(obj: user.id),
                        child: new Container(
                            padding: EdgeInsets.only(
                                top: CCommonUtils.getSafeAreaTopPadding(context: this.context)),
                            decoration: new BoxDecoration(
                                color: CColors.Black,
                                new DecorationImage(
                                    new AssetImage("image/default-background-cover"),
                                    fit: BoxFit.cover
                                    )
                                ),
                            child: new Column(
                                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                children: new List <Widget> {
                    this._buildQrScanWidget(true),
                    new Container(
                        padding: EdgeInsets.only(16, 16, 16, 64),
                        child: new Row(
                            children: new List <Widget> {
                        new Container(
                            margin: EdgeInsets.only(right: 12),
                            child: Avatar.User(
                                user: user,
                                64,
                                true
                                )
                            ),
                        new Expanded(
                            child: new Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: new List <Widget> {
                            new Row(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: new List <Widget> {
                                new Flexible(
                                    child: new Text(
                                        user.fullName ?? user.name,
                                        style: CTextStyle.H4White
                                        .defaultHeight(),
                                        maxLines: 1,
                                        overflow: TextOverflow.ellipsis
                                        )
                                    ),
                                CImageUtils.GenBadgeImage(
                                    badges: user.badges,
                                    CCommonUtils.GetUserLicense(
                                        userId: user.id,
                                        userLicenseMap: this.widget.viewModel
                                        .userLicenseDict
                                        ),
                                    EdgeInsets.only(4, 6)
                                    )
                            }
                                ),
                            titleWidget
                        }
                                )
                            ),
                        new Padding(
                            padding: EdgeInsets.symmetric(horizontal: 4),
                            child: new Text(
                                "个人主页",
                                style: new TextStyle(
                                    fontSize: 14,
                                    fontFamily: "Roboto-Regular",
                                    color: CColors.Grey80
                                    )
                                )
                            ),
                        new Icon(
                            icon: Icons.baseline_forward_arrow,
                            size: 16,
                            color: CColors.LightBlueGrey
                            )
                    }
                            )
                        )
                }
                                )
                            )
                        )
                    ),
                new Align(
                    alignment: Alignment.bottomCenter,
                    child: new Container(
                        margin: EdgeInsets.only(16, 0, 16, 16),
                        height: 80,
                        decoration: new BoxDecoration(
                            color: CColors.White,
                            borderRadius: BorderRadius.all(8),
                            boxShadow: new List <BoxShadow> {
                    new BoxShadow(
                        CColors.Black.withOpacity(0.2f),
                        blurRadius: 8
                        )
                }
                            ),
                        child: new Row(
                            children: new List <Widget> {
                    new Expanded(
                        child: new CustomButton(
                            onPressed: () => {
                        if (this.widget.viewModel.isLoggedIn && user.id.isNotEmpty())
                        {
                            this.widget.actionModel.pushToUserFollowing(arg1: user.id, 0);
                        }
                    },
                            child: new Column(
                                mainAxisAlignment: MainAxisAlignment.center,
                                children: new List <Widget> {
                        new Text(
                            CStringUtils.CountToString((user.followingUsersCount ?? 0) + (user.followingTeamsCount ?? 0), "0"),
                            style: CTextStyle.Bold20
                            ),
                        new Container(height: 4),
                        new Text(
                            "关注",
                            style: CTextStyle.PSmallBody3.defaultHeight()
                            )
                    }
                                )
                            )
                        ),
                    new Container(height: 32, width: 1, color: CColors.Separator.withOpacity(0.5f)),
                    new Expanded(
                        child: new CustomButton(
                            onPressed: () => {
                        if (this.widget.viewModel.isLoggedIn && user.id.isNotEmpty())
                        {
                            this.widget.actionModel.pushToUserFollower(obj: user.id);
                        }
                    },
                            child: new Column(
                                mainAxisAlignment: MainAxisAlignment.center,
                                children: new List <Widget> {
                        new Text(
                            CStringUtils.CountToString(user.followCount ?? 0, "0"),
                            style: CTextStyle.Bold20
                            ),
                        new Container(height: 4),
                        new Text(
                            "粉丝",
                            style: CTextStyle.PSmallBody3.defaultHeight()
                            )
                    }
                                )
                            )
                        ),
                    new Container(height: 32, width: 1, color: CColors.Separator.withOpacity(0.5f)),
                    new Expanded(
                        child: new CustomButton(
                            onPressed: () => {
                        // if (this.widget.viewModel.isLoggedIn && user.id.isNotEmpty()) {
                        //     this.widget.actionModel.pushToUserLike(obj: user.id);
                        // }
                    },
                            child: new Column(
                                mainAxisAlignment: MainAxisAlignment.center,
                                children: new List <Widget> {
                        new Text(
                            CStringUtils.CountToString(user.appArticleLikedCount ?? 0, "0"),
                            style: CTextStyle.Bold20
                            ),
                        new Container(height: 4),
                        new Text(
                            "赞",
                            style: CTextStyle.PSmallBody3.defaultHeight()
                            )
                    }
                                )
                            )
                        )
                }
                            )
                        )
                    )
            }
                       ));
        }
Example #2
0
 Widget _buildHeader(BuildContext context)
 {
     return(new Container(
                padding: EdgeInsets.only(left: 16.0, right: 8.0),
                height: headerHeight,
                color: CLColors.header,
                child: new Row(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: new List <Widget> {
         new Container(
             child: new Text(
                 "All Assets",
                 style: new TextStyle(
                     fontSize: 16,
                     color: Color.fromARGB(100, 255, 255, 0)
                     )
                 )
             ),
         new CustomButton(
             padding: EdgeInsets.only(0.0, 0.0, 16.0, 0.0),
             child: new Icon(
                 Icons.keyboard_arrow_down,
                 size: 18.0,
                 color: CLColors.icon2
                 )
             ),
         new Container(
             decoration: new BoxDecoration(
                 color: CLColors.white,
                 borderRadius: BorderRadius.all(3)
                 ),
             width: 320,
             height: 36,
             padding: EdgeInsets.all(10.0),
             margin: EdgeInsets.only(right: 4),
             child: new EditableText(
                 maxLines: 1,
                 selectionControls: MaterialUtils.materialTextSelectionControls,
                 controller: new TextEditingController("Type here to search assets"),
                 focusNode: new FocusNode(),
                 style: new TextStyle(
                     fontSize: 16
                     ),
                 selectionColor: Color.fromARGB(255, 255, 0, 0),
                 cursorColor: Color.fromARGB(255, 0, 0, 0)
                 )
             ),
         new Container(
             decoration: new BoxDecoration(
                 color: CLColors.background4,
                 borderRadius: BorderRadius.all(2)
                 ),
             width: 36,
             height: 36,
             child: new Row(
                 mainAxisAlignment: MainAxisAlignment.center,
                 crossAxisAlignment: CrossAxisAlignment.center,
                 children: new List <Widget> {
             new CustomButton(
                 padding: EdgeInsets.only(8.0, 0.0, 8.0, 0.0),
                 child: new Icon(
                     Icons.search,
                     size: 18.0,
                     color: CLColors.white
                     )
                 )
         }
                 )
             ),
         new Container(
             margin: EdgeInsets.only(left: 16, right: 16),
             child: new Text(
                 "Learn Game Development",
                 style: new TextStyle(
                     fontSize: 12,
                     color: CLColors.white
                     )
                 )
             ),
         new Container(
             decoration: new BoxDecoration(
                 border: Border.all(
                     color: CLColors.white
                     )
                 ),
             margin: EdgeInsets.only(right: 16),
             padding: EdgeInsets.all(4),
             child: new Row(
                 mainAxisAlignment: MainAxisAlignment.center,
                 crossAxisAlignment: CrossAxisAlignment.center,
                 children: new List <Widget> {
             new Text(
                 "Plus/Pro",
                 style: new TextStyle(
                     fontSize: 11,
                     color: CLColors.white
                     )
                 )
         }
                 )
             ),
         new Container(
             margin: EdgeInsets.only(right: 16),
             child: new Text(
                 "Impressive New Assets",
                 style: new TextStyle(
                     fontSize: 12,
                     color: CLColors.white
                     )
                 )
             ),
         new Container(
             child: new Text(
                 "Shop On Old Store",
                 style: new TextStyle(
                     fontSize: 12,
                     color: CLColors.white
                     )
                 )
             ),
     }
                    )
                ));
 }
Example #3
0
        Widget _buildNavigationBar(bool isShowRightWidget = true)
        {
            Widget titleWidget = new Container();

            if (this._isHaveTitle)
            {
                titleWidget = new Text(
                    this._article.title,
                    style: CTextStyle.PXLargeMedium,
                    maxLines: 1,
                    overflow: TextOverflow.ellipsis,
                    textAlign: TextAlign.center
                    );
            }

            Widget rightWidget = new Container();

            if (isShowRightWidget)
            {
                string rightWidgetTitle = this._article.commentCount > 0
                    ? $"{this._article.commentCount} 评论"
                    : "抢个沙发";
                rightWidget = new Container(
                    margin: EdgeInsets.only(8, right: 16),
                    child: new CustomButton(
                        padding: EdgeInsets.zero,
                        onPressed: () => {
                    //do not jump if we are already at the exact comment position
                    if (this._refreshController.scrollController.position.pixels ==
                        this._cachedCommentPosition)
                    {
                        return;
                    }

                    //first frame: create a new scroll view in which the center of the viewport is the comment widget
                    this.setState(
                        () => { this._jumpState = _ArticleJumpToCommentState.active; });

                    SchedulerBinding.instance.addPostFrameCallback((TimeSpan value2) => {
                        //calculate the comment position = curPixel(0) - minScrollExtent
                        var commentPosition = -this._refreshController.scrollController.position
                                              .minScrollExtent;

                        //cache the current comment position
                        this._cachedCommentPosition = commentPosition;

                        //second frame: rebuild a smartRefresher with the cached _cacheCommmentPosition
                        this.setState(() => { this._needRebuildWithCachedCommentPosition = true; });
                    });
                },
                        child: new Container(
                            height: 28,
                            padding: EdgeInsets.symmetric(horizontal: 16),
                            alignment: Alignment.center,
                            decoration: new BoxDecoration(
                                color: CColors.PrimaryBlue,
                                borderRadius: BorderRadius.all(14)
                                ),
                            child: new Text(
                                data: rightWidgetTitle,
                                style: new TextStyle(
                                    fontSize: 14,
                                    fontFamily: "Roboto-Medium",
                                    color: CColors.White
                                    )
                                )
                            )
                        )
                    );
            }

            return(new CustomAppBar(
                       () => this.widget.actionModel.mainRouterPop(),
                       new Expanded(
                           child: new Stack(
                               fit: StackFit.expand,
                               children: new List <Widget> {
                new PositionedTransition(
                    rect: this._animation,
                    child: titleWidget
                    )
            }
                               )
                           ),
                       rightWidget: rightWidget,
                       this._isHaveTitle ? CColors.Separator2 : CColors.Transparent
                       ));
        }
Example #4
0
        static Widget _Atomic(BuildContext context, string type, string contentType, string title,
                              _OriginalImage originalImage,
                              string url, string downloadUrl, Action <string> openUrl, Action <string> playVideo,
                              Action browserImage = null)
        {
            if (type == "ATTACHMENT" && contentType != "video/mp4")
            {
                return(new Container());
            }

            var playButton = Positioned.fill(
                new Container()
                );

            if (type == "VIDEO" || type == "ATTACHMENT")
            {
                playButton = Positioned.fill(
                    new Center(
                        child: new CustomButton(
                            onPressed: () => {
                    if (type == "ATTACHMENT")
                    {
                        playVideo($"{downloadUrl}?noLoginRequired=true");
                    }
                    else
                    {
                        if (url == null || url.Length <= 0)
                        {
                            return;
                        }

                        openUrl(url);
                    }
                },
                            child: new Container(
                                width: 60,
                                height: 60,
                                decoration: new BoxDecoration(
                                    CColors.H5White,
                                    borderRadius: BorderRadius.all(30)
                                    ),
                                child: new Icon(
                                    Icons.play_arrow,
                                    size: 45,
                                    color: CColors.Icon
                                    )
                                )
                            )
                        )
                    );
            }

            var attachWidth  = MediaQuery.of(context).size.width - 32;
            var attachHeight = attachWidth * 9 / 16;

            if (type == "ATTACHMENT")
            {
                return(new Container(
                           color: CColors.White,
                           padding: EdgeInsets.only(bottom: 32),
                           alignment: Alignment.center,
                           child: new Container(
                               padding: EdgeInsets.only(16, right: 16),
                               child: new Column(
                                   children: new List <Widget> {
                    new Stack(
                        children: new List <Widget> {
                        new Container(
                            width: attachWidth,
                            height: attachHeight,
                            color: CColors.Black
                            ),
                        playButton
                    }
                        )
                }
                                   )
                               )
                           ));
            }

            var width = originalImage.width < MediaQuery.of(context).size.width - 32
                ? originalImage.width
                : MediaQuery.of(context).size.width - 32;
            var height   = width * originalImage.height / originalImage.width;
            var imageUrl = originalImage.url;

            if (imageUrl.isNotEmpty())
            {
                imageUrl = imageUrl.EndsWith(".gif") || imageUrl.EndsWith(".png")
                    ? imageUrl
                    : CImageUtils.SuitableSizeImageUrl(MediaQuery.of(context).size.width, imageUrl);
            }

            var nodes = new List <Widget> {
                new Stack(
                    children: new List <Widget> {
                    new GestureDetector(
                        child: new PlaceholderImage(
                            imageUrl,
                            width,
                            height,
                            fit: BoxFit.cover
                            ), onTap: () => {
                        if (browserImage != null)
                        {
                            browserImage();
                        }
                    }),

                    playButton
                }
                    )
            };

            if (title != null)
            {
                var imageTitle = new Container(
                    decoration: new BoxDecoration(
                        border: new Border(
                            bottom: new BorderSide(
                                CColors.Separator,
                                2
                                )
                            )
                        ),
                    child: new Container(
                        margin: EdgeInsets.only(4, 8, 4, 4),
                        child: new Text(
                            title,
                            style: CTextStyle.PRegularBody4
                            )
                        )
                    );
                nodes.Add(imageTitle);
            }

            return(new Container(
                       color: CColors.White,
                       padding: EdgeInsets.only(bottom: 32),
                       alignment: Alignment.center,
                       child: new Container(
                           padding: EdgeInsets.only(16, right: 16),
                           child: new Column(
                               children: nodes
                               )
                           )
                       ));
        }
        Widget _buildEventBottom(IEvent eventObj, EventType eventType, EventStatus eventStatus,
                                 bool isLoggedIn)
        {
            if (eventStatus != EventStatus.future && eventType == EventType.online && isLoggedIn)
            {
                return(new Container());
            }

            var onlineCount      = eventObj.onlineMemberCount;
            var recordWatchCount = eventObj.recordWatchCount;
            var userIsCheckedIn  = eventObj.userIsCheckedIn;
            var title            = "";
            var subTitle         = "";

            if (eventStatus == EventStatus.live)
            {
                title    = "正在直播";
                subTitle = $"{onlineCount}人正在观看";
            }

            if (eventStatus == EventStatus.past)
            {
                title    = "回放";
                subTitle = $"{recordWatchCount}次观看";
            }

            if (eventStatus == EventStatus.future || eventStatus == EventStatus.countDown)
            {
                var begin     = eventObj.begin != null ? eventObj.begin : new TimeMap();
                var startTime = begin.startTime;
                if (startTime.isNotEmpty())
                {
                    subTitle = DateConvert.GetFutureTimeFromNow(startTime);
                }

                title = "距离开始还有";
            }

            var backgroundColor = CColors.PrimaryBlue;
            var joinInText      = "立即加入";
            var textStyle       = CTextStyle.PLargeMediumWhite;

            if (userIsCheckedIn && isLoggedIn)
            {
                backgroundColor = CColors.Disable;
                joinInText      = "已加入";
                textStyle       = CTextStyle.PLargeMediumWhite;
            }

            Widget child = new Text(
                joinInText,
                style: textStyle
                );

            if (this.widget.viewModel.joinEventLoading)
            {
                child = new CustomActivityIndicator(
                    loadingColor: LoadingColor.white
                    );
            }

            return(new Container(
                       height: 64,
                       padding: EdgeInsets.symmetric(horizontal: 16),
                       decoration: new BoxDecoration(
                           CColors.White,
                           border: new Border(new BorderSide(CColors.Separator))
                           ),
                       child: new Row(
                           mainAxisAlignment: MainAxisAlignment.spaceBetween,
                           children: new List <Widget> {
                new Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: new List <Widget> {
                    new Text(
                        title,
                        style: CTextStyle.PSmallBody4
                        ),
                    new Container(height: 2),
                    new Text(
                        subTitle,
                        style: CTextStyle.H5Body
                        )
                }
                    ),
                new CustomButton(
                    onPressed: () => {
                    if (this.widget.viewModel.joinEventLoading)
                    {
                        return;
                    }

                    if (!this.widget.viewModel.isLoggedIn)
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                    else
                    {
                        if (!userIsCheckedIn)
                        {
                            this.widget.actionModel.startJoinEvent();
                            this.widget.actionModel.joinEvent(this.widget.viewModel.eventId);
                        }
                    }
                },
                    child: new Container(
                        width: 96,
                        height: 40,
                        decoration: new BoxDecoration(
                            backgroundColor,
                            borderRadius: BorderRadius.all(4)
                            ),
                        alignment: Alignment.center,
                        child: new Row(
                            mainAxisAlignment: MainAxisAlignment.center,
                            children: new List <Widget> {
                    child
                }
                            )
                        )
                    )
            }
                           )
                       ));
        }
Example #6
0
        Widget _buildEventBottom(IEvent eventObj, EventType eventType, EventStatus eventStatus,
                                 bool isLoggedIn)
        {
            if (!WechatPlugin.instance().isInstalled() || eventType == EventType.offline)
            {
                return(new Container());
            }

            return(new Container(
                       height: 56 + this._bottomPadding,
                       padding: EdgeInsets.only(16, 8, 16, 8 + this._bottomPadding),
                       decoration: new BoxDecoration(
                           color: CColors.White,
                           border: new Border(new BorderSide(color: CColors.Separator))
                           ),
                       child: new CustomButton(
                           onPressed: () => {
                CustomDialogUtils.showCustomDialog(
                    barrierColor: Color.fromRGBO(0, 0, 0, 0.5f),
                    child: new CustomAlertDialog(
                        "即将前往微信小程序\n开始观看",
                        null,
                        new List <Widget> {
                    new CustomButton(
                        child: new Text(
                            "稍后再说",
                            style: new TextStyle(
                                height: 1.33f,
                                fontSize: 16,
                                fontFamily: "Roboto-Regular",
                                color: new Color(0xFF959595)
                                ),
                            textAlign: TextAlign.center
                            ),
                        onPressed: CustomDialogUtils.hiddenCustomDialog
                        ),
                    new CustomButton(
                        child: new Text(
                            "立即前往",
                            style: CTextStyle.PLargeBlue,
                            textAlign: TextAlign.center
                            ),
                        onPressed: () => {
                        CustomDialogUtils.hiddenCustomDialog();
                        WechatPlugin.instance().context = this.context;
                        WechatPlugin.instance().currentEventId = eventObj.id;
                        var path = CStringUtils.CreateMiniPath(id: eventObj.id,
                                                               title: eventObj.title);
                        if (path.isNotEmpty())
                        {
                            WechatPlugin.instance().toOpenMiNi(path);
                        }
                    }
                        )
                }
                        )
                    );
            },
                           padding: EdgeInsets.zero,
                           child: new Container(
                               decoration: new BoxDecoration(
                                   color: CColors.PrimaryBlue,
                                   borderRadius: BorderRadius.all(4)
                                   ),
                               child: new Row(
                                   mainAxisAlignment: MainAxisAlignment.center,
                                   children: new List <Widget> {
                new Text(
                    "进入微信小程序",
                    style: CTextStyle.PLargeMediumWhite.merge(new TextStyle(height: 1))
                    )
            }
                                   )
                               )
                           )
                       ));

//            var onlineCount = eventObj.onlineMemberCount;
//            var recordWatchCount = eventObj.recordWatchCount;
//            var userIsCheckedIn = eventObj.userIsCheckedIn;
//            var title = "";
//            var subTitle = "";
//            if (eventStatus == EventStatus.live) {
//                title = "正在直播";
//                subTitle = $"{onlineCount}人正在观看";
//            }
//
//            if (eventStatus == EventStatus.past) {
//                title = "回放";
//                subTitle = $"{recordWatchCount}次观看";
//            }
//
//            if (eventStatus == EventStatus.future || eventStatus == EventStatus.countDown) {
//                var begin = eventObj.begin != null ? eventObj.begin : new TimeMap();
//                var startTime = begin.startTime;
//                if (startTime.isNotEmpty()) {
//                    subTitle = DateConvert.GetFutureTimeFromNow(startTime);
//                }
//
//                title = "距离开始还有";
//            }
//
//            var backgroundColor = CColors.PrimaryBlue;
//            var joinInText = "立即加入";
//            var textStyle = CTextStyle.PLargeMediumWhite;
//
//            Widget child = new Text(
//                joinInText,
//                style: textStyle
//            );
//
//            if (this.widget.viewModel.joinEventLoading) {
//                child = new CustomActivityIndicator(
//                    loadingColor: LoadingColor.white
//                );
//            }
//
//            return new Container(
//                height: 64,
//                padding: EdgeInsets.symmetric(horizontal: 16),
//                margin: EdgeInsets.only(bottom: MediaQuery.of(this.context).padding.bottom),
//                decoration: new BoxDecoration(
//                    CColors.White,
//                    border: new Border(new BorderSide(CColors.Separator))
//                ),
//                child: new Row(
//                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
//                    children: new List<Widget> {
//                        new Column(
//                            mainAxisAlignment: MainAxisAlignment.center,
//                            crossAxisAlignment: CrossAxisAlignment.start,
//                            children: new List<Widget> {
//                                new Text(
//                                    title,
//                                    style: CTextStyle.PSmallBody4
//                                ),
//                                new Container(height: 2),
//                                new Text(
//                                    subTitle,
//                                    style: CTextStyle.H5Body
//                                )
//                            }
//                        ),
//                        new CustomButton(
//                            onPressed: () => {
//                                if (this.widget.viewModel.joinEventLoading) {
//                                    return;
//                                }
//
//                                if (!this.widget.viewModel.isLoggedIn) {
//                                    this.widget.actionModel.pushToLogin();
//                                }
//                                else {
//                                    if (!WechatPlugin.instance().isInstalled()) {
//                                        CustomToast.show(new CustomToastItem(this.context, "需要安装微信才能打开小程序",
//                                            gravity: ToastGravity.center));
//                                        return;
//                                    }
//
//                                    CustomDialogUtils.showCustomDialog(
//                                        barrierColor: Color.fromRGBO(0, 0, 0, 0.5f),
//                                        child: new CustomAlertDialog(
//                                            "即将前往微信小程序\n开始观看",
//                                            null,
//                                            new List<Widget> {
//                                                new CustomButton(
//                                                    child: new Text(
//                                                        "稍后再说",
//                                                        style: new TextStyle(
//                                                            height: 1.33f,
//                                                            fontSize: 16,
//                                                            fontFamily: "Roboto-Regular",
//                                                            color: new Color(0xFF959595)
//                                                        ),
//                                                        textAlign: TextAlign.center
//                                                    ),
//                                                    onPressed: () => { CustomDialogUtils.hiddenCustomDialog(); }
//                                                ),
//                                                new CustomButton(
//                                                    child: new Text(
//                                                        "立即前往",
//                                                        style: CTextStyle.PLargeBlue,
//                                                        textAlign: TextAlign.center
//                                                    ),
//                                                    onPressed: () => {
//                                                        CustomDialogUtils.hiddenCustomDialog();
//                                                        WechatPlugin.instance().context = this.context;
//                                                        WechatPlugin.instance().currentEventId = eventObj.id;
//                                                        var path =
//                                                            $"pages/Detail/Detail?id={eventObj.id}&title={eventObj.title}&app=true";
//                                                        WechatPlugin.instance().toOpenMiNi(path);
//                                                    }
//                                                )
//                                            }
//                                        )
//                                    );
//                                }
//                            },
//                            child: new Container(
//                                width: 96,
//                                height: 40,
//                                decoration: new BoxDecoration(
//                                    backgroundColor,
//                                    borderRadius: BorderRadius.all(4)
//                                ),
//                                alignment: Alignment.center,
//                                child: new Row(
//                                    mainAxisAlignment: MainAxisAlignment.center,
//                                    children: new List<Widget> {
//                                        child
//                                    }
//                                )
//                            )
//                        )
//                    }
//                )
//            );
        }
        public override Widget build(BuildContext context)
        {
            Widget content;

            if (this.isLoading)
            {
                content = new GlobalLoading();
            }
            else if (this.needFetchAgain)
            {
                content = new Container(
                    child: new Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: new List <Widget> {
                    new Container(
                        margin: EdgeInsets.only(bottom: 24),
                        child: Image.asset(
                            name: "image/default-network",
                            width: 128,
                            height: 128
                            )
                        ),
                    new Container(
                        margin: EdgeInsets.only(bottom: 24),
                        child: new Text(
                            data: "数据获取失败",
                            style: new TextStyle(
                                fontSize: 16,
                                fontFamily: "Roboto-Regular",
                                color: CColors.TextBody5
                                )
                            )
                        ),
                    new Container(height: 32),
                    new CustomButton(
                        padding: EdgeInsets.zero,
                        onPressed: () => {
                        this.isLoading      = true;
                        this.needFetchAgain = false;
                        this.setState(() => {});
                        this._checkNewVersion();
                    },
                        child: new Container(
                            height: 40,
                            width: 120,
                            alignment: Alignment.center,
                            decoration: new BoxDecoration(
                                color: CColors.PrimaryBlue,
                                borderRadius: BorderRadius.all(20)
                                ),
                            child: new Text(
                                "重新获取",
                                style: CTextStyle.PLargeMediumWhite.merge(new TextStyle(height: 1))
                                )
                            )
                        )
                }
                        )
                    );
            }
            else
            {
                content = new Container(
                    padding: EdgeInsets.only(top: 120, bottom: 40),
                    child: new Column(
                        mainAxisAlignment: MainAxisAlignment.spaceBetween,
                        children: new List <Widget> {
                    new Column(
                        children: new List <Widget> {
                        new Container(
                            margin: EdgeInsets.only(bottom: 16),
                            alignment: Alignment.center,
                            child: Image.asset(
                                name: "image/unity-icon-logo",
                                width: 128,
                                height: 128,
                                fit: BoxFit.cover
                                )
                            ),
                        new Container(
                            alignment: Alignment.center,
                            child: Image.asset(
                                name: "image/unity-text-logo",
                                width: 149,
                                height: 24,
                                fit: BoxFit.cover
                                )
                            )
                    }
                        ),
                    new Text(
                        "当前版本过低,请升级后使用",
                        style: CTextStyle.PXLargeMedium
                        ),
                    new Container(
                        padding: EdgeInsets.symmetric(horizontal: 16),
                        child: new CustomButton(
                            onPressed: () => {
                        Application.OpenURL(url: this.url);
                    },
                            child: new Container(
                                height: 48,
                                alignment: Alignment.center,
                                decoration: new BoxDecoration(
                                    color: CColors.PrimaryBlue,
                                    borderRadius: BorderRadius.all(24)
                                    ),
                                child: new Text(
                                    "获取最新版本",
                                    style: CTextStyle.PLargeMediumWhite.merge(new TextStyle(height: 1))
                                    )
                                )
                            )
                        )
                }
                        )
                    );
            }

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           child: new Container(
                               color: CColors.White,
                               child: content
                               )
                           )
                       ));
        }
Example #8
0
        public override Widget build(BuildContext context)
        {
            this._context = context;
            if (!this._isShow)
            {
                return(new MainScreen());
            }

            var topPadding = 0f;

            if (Application.platform != RuntimePlatform.Android)
            {
                topPadding = MediaQuery.of(context).padding.top;
            }

            var    isShowLogo = SplashManager.getSplash().isShowLogo;
            Widget logo       = new Container();

            if (isShowLogo)
            {
                logo = new Positioned(
                    top: topPadding + 24,
                    left: 16,
                    child: new Icon(
                        Icons.LogoWithUinty,
                        size: 35,
                        color: new Color(value: this.hexColor)
                        )
                    );
            }

            return(new Container(
                       color: CColors.White,
                       child: new Stack(
                           children: new List <Widget> {
                new Column(
                    children: new List <Widget> {
                    new GestureDetector(
                        child: new Container(
                            width: MediaQuery.of(context).size.width,
                            height: MediaQuery.of(context).size.height,
                            child: Image.memory(SplashManager.readImage(), fit: BoxFit.cover)
                            ),
                        onTap: this.pushPage
                        )
                }
                    ),
                new Positioned(
                    top: topPadding + 24,
                    right: 16,
                    child: new GestureDetector(
                        child: new Container(
                            decoration: new BoxDecoration(
                                Color.fromRGBO(0, 0, 0, 0.5f),
                                borderRadius: BorderRadius.all(16)
                                ),
                            width: 65,
                            height: 32,
                            alignment: Alignment.center,
                            child: new Text($"跳过 {this._lastSecond}", style: new TextStyle(
                                                fontSize: 14,
                                                fontFamily: "PingFangSC-Regular",
                                                color: CColors.White
                                                ))
                            ),
                        onTap: this.pushCallback
                        )
                    ),
                logo
            }
                           )
                       ));
        }
        public override Widget build(BuildContext context, SwiperPluginConfig config)
        {
            D.assert(() => {
                if (config.itemCount > 20)
                {
                    Debug.LogWarning(
                        "The itemCount is too big, we suggest use FractionPaginationBuilder instead of DotSwiperPaginationBuilder in this sitituation");
                }

                return(true);
            });

            Color activeColor = this.activeColor ?? CColors.PrimaryBlue;
            Color color       = this.color ?? CColors.White;

            if (config.indicatorLayout != PageIndicatorLayout.none &&
                config.layout == SwiperLayout.normal)
            {
                return(new PageIndicator(
                           count: config.itemCount,
                           controller: config.pageController,
                           layout: config.indicatorLayout ?? PageIndicatorLayout.slide,
                           size: this.size,
                           activeColor: activeColor,
                           color: color,
                           space: this.space
                           ));
            }

            List <Widget> list      = new List <Widget> ();
            int           itemCount = config.itemCount;

            int activeIndex = config.activeIndex.Value;

            for (int i = 0; i < itemCount; ++i)
            {
                bool  active = i == activeIndex;
                float size   = active ? this.activeSize : this.size;
                list.Add(new Container(
                             Key.key($"pagination_{i}"),
                             margin: EdgeInsets.all(value: this.space),
                             child: new Container(
                                 width: size,
                                 height: size,
                                 decoration: new BoxDecoration(
                                     active ? activeColor : color,
                                     borderRadius: BorderRadius.all(size / 2.0f)
                                     )
                                 )
                             ));
            }

            if (config.scrollDirection == Axis.vertical)
            {
                return(new Column(
                           key: this.key,
                           mainAxisSize: MainAxisSize.min,
                           children: list
                           ));
            }
            return(new Row(
                       key: this.key,
                       mainAxisSize: MainAxisSize.min,
                       children: list
                       ));
        }
Example #10
0
        public override Widget build(BuildContext context)
        {
            if (!_everBuild)
            {
                _everBuild = true;
                widget.OnBuild?.Invoke();
            }

            var sendByMe = widget.Msg.author.id == Window.currentUserId;

            Widget content        = null;
            var    mediaQueryData = MediaQuery.of(context);
            var    maxWidth       = mediaQueryData.size.width * 0.7f;

            if (mediaQueryData.size.width > 750)
            {
                maxWidth -= 262.5f;
            }

            if (!string.IsNullOrEmpty(widget.Msg.deletedTime))
            {
                content = new Container(
                    padding: EdgeInsets.all(12),
                    constraints: new BoxConstraints(
                        maxWidth: maxWidth
                        ),
                    decoration: new BoxDecoration(
                        color: sendByMe ? new Color(0xffc5e8ff) : new Color(0xfff0f0f0),
                        borderRadius: BorderRadius.circular(10)
                        ),
                    child: new SelectableText(
                        textSpan: new TextSpan(
                            text: "此条消息已被删除",
                            style: DeletedTextStyle
                            ),
                        focusNode: _focusNode,
                        selectionColor: new Color(0xffd8d8d8)
                        )
                    );
            }
            else if (widget.Msg.content != null && widget.Msg.content.isNotEmpty())
            {
                var contentChildren = new List <Widget>
                {
                    new SelectableText(
                        textSpan: ParseMessage(
                            widget.Msg.content ?? "",
                            widget.Users,
                            textStyle: widget.Msg.id == null ? SendingTextStyle : null,
                            defaultOnTapUp: OnTapUp
                            ),
                        focusNode: _focusNode,
                        selectionColor: new Color(0xffd8d8d8),
                        onTapUp: OnTapUp
                        ),
                };
                if (!widget.Msg.embeds.isEmpty())
                {
                    contentChildren.Add(new Container(height: 6));
                    contentChildren.Add(new MessageEmbed(
                                            message: widget.Msg,
                                            onClickUrl: (details, url) =>
                    {
                        OnTapUp(details);
                        if (details.kind == PointerDeviceKind.mouse &&
                            details.device == InputUtils.MouseLeftKeyDevice)
                        {
                            Launch(url);
                        }
                    }));
                }

                content = new GestureDetector(
                    onTapUp: OnTapUp,
                    child: new Container(
                        padding: EdgeInsets.all(12),
                        constraints: new BoxConstraints(
                            maxWidth: maxWidth
                            ),
                        decoration: new BoxDecoration(
                            color: sendByMe ? new Color(0xffc5e8ff) : new Color(0xfff0f0f0),
                            borderRadius: BorderRadius.circular(10)
                            ),
                        child: new Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: contentChildren
                            )
                        )
                    );
            }
            else if (widget.Msg.attachments.Count > 0)
            {
                var attachment  = widget.Msg.attachments.first();
                var contentType = attachment.contentType;
                if (contentType == "image/png" ||
                    contentType == "image/jpg" ||
                    contentType == "image/jpeg" ||
                    contentType == "image/gif")
                {
                    Widget image = null;
                    if (attachment.local)
                    {
                        image = new ImageWithProgress(
                            image: new FileImage(
                                attachment.url
                                ),
                            attachment.progress
                            );
                    }
                    else
                    {
                        image = new Image(
                            image: ProxiedImage(
                                $"{attachment.url}.200x0x1.jpg",
                                cookie: $"LS={Window.loginSession};"
                                ),
                            fit: BoxFit.cover
                            );
                    }

                    content = new GestureDetector(
                        onTapUp: OnTapUp,
                        child: new Container(
                            constraints: new BoxConstraints(
                                maxWidth: 282
                                ),
                            child: new ClipRRect(
                                borderRadius: BorderRadius.circular(5),
                                child: new AspectRatio(
                                    aspectRatio: attachment.width == 0 || attachment.height == 0
                                        ? 1
                                        : (float)attachment.width / attachment.height,
                                    child: image
                                    )
                                )
                            )
                        );
                }
                else
                {
                    AssetImage image;
                    if (contentType == "application/pdf")
                    {
                        image = new AssetImage("Images/FilePdf@4x");
                    }
                    else if (contentType.StartsWith("video/"))
                    {
                        image = new AssetImage("Images/FileVideo@4x");
                    }
                    else
                    {
                        image = new AssetImage("Images/FileGeneral@4x");
                    }

                    content = new GestureDetector(
                        onTapUp: OnTapUp,
                        child: new Container(
                            padding: EdgeInsets.symmetric(horizontal: 16, vertical: 12),
                            decoration: new BoxDecoration(
                                color: new Color(0xfff0f0f0),
                                borderRadius: BorderRadius.all(10)
                                ),
                            width: 262,
                            child: new Row(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: new List <Widget>
                    {
                        new Expanded(
                            child: new Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: new List <Widget>
                        {
                            new Text(
                                attachment.filename,
                                style: new TextStyle(
                                    fontSize: 16,
                                    color: new Color(0xff000000),
                                    fontFamily: "PingFang"
                                    )
                                ),
                            new Container(
                                margin: EdgeInsets.only(top: 4),
                                child: new Text(
                                    ReadableSize(attachment.size),
                                    style: new TextStyle(
                                        fontSize: 12,
                                        color: new Color(0xff797979),
                                        fontFamily: "PingFang"
                                        )
                                    )
                                )
                        }
                                )
                            ),
                        new Container(
                            margin: EdgeInsets.only(left: 16),
                            width: 42,
                            height: 48,
                            child: new Image(
                                image: image,
                                width: 42,
                                height: 48,
                                fit: BoxFit.cover
                                )
                            )
                    }
                                )
                            )
                        );
                }
            }
            else
            {
                return(new Container(height: 0, width: 0));
            }

            var decoratedContent = new List <Widget>
            {
                content,
            };

            if (_rightClickFocus.hasFocus)
            {
                decoratedContent.Add(
                    new Positioned(
                        top: 0,
                        right: 0,
                        bottom: 0,
                        left: 0,
                        child: new Container(
                            decoration: new BoxDecoration(
                                borderRadius: BorderRadius.all(10),
                                color: new Color(0x1a000000)
                                )
                            )
                        )
                    );
            }

            if (_fetchingUrl)
            {
                decoratedContent.Add(
                    new Positioned(
                        top: 0,
                        right: 0,
                        bottom: 0,
                        left: 0,
                        child: new Container(
                            decoration: new BoxDecoration(
                                borderRadius: BorderRadius.all(10),
                                color: new Color(0x1a000000)
                                ),
                            alignment: Alignment.center,
                            child: new Loading(
                                size: 24,
                                isWhite: true
                                )
                            )
                        )
                    );
            }

            var children = new List <Widget>
            {
                new Container(
                    margin: EdgeInsets.only(
                        left: sendByMe ? 10 : 24,
                        right: sendByMe ? 24 : 10
                        ),
                    child: new Avatar(
                        widget.Msg.author,
                        size: 40
                        )
                    ),
                new Expanded(
                    child: new Column(
                        crossAxisAlignment: sendByMe ? CrossAxisAlignment.end : CrossAxisAlignment.start,
                        mainAxisAlignment: MainAxisAlignment.start,
                        children: new List <Widget>
                {
                    new Container(
                        height: 20,
                        alignment: sendByMe?Alignment.centerRight: Alignment.centerLeft,
                        margin: EdgeInsets.only(bottom: 6),
                        child: new Text(
                            widget.Msg.author.fullName,
                            style: new TextStyle(
                                fontSize: 12,
                                fontWeight: FontWeight.w500,
                                color: new Color(0xff797979),
                                fontFamily: "PingFang"
                                )
                            )
                        ),
                    new Stack(
                        children: decoratedContent
                        ),
                }
                        )
                    ),
            };

            if (sendByMe)
            {
                children.Reverse();
            }

            Widget result = new Container(
                margin: EdgeInsets.symmetric(vertical: 8),
                child: new Row(
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: children
                    )
                );

            var resultChildren = new List <Widget> {
            };

            if (widget.IsNew)
            {
                resultChildren.Add(
                    new Container(
                        height: 36,
                        alignment: Alignment.center,
                        child: new Row(
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: new List <Widget>
                {
                    new Expanded(
                        child: new Container(
                            margin: EdgeInsets.only(right: 8),
                            height: 1,
                            color: new Color(0xffd8d8d8)
                            )
                        ),
                    new Container(
                        alignment: Alignment.center,
                        child: new Text(
                            "以下为新消息",
                            style: new TextStyle(
                                fontSize: 12,
                                fontWeight: FontWeight.w500,
                                color: new Color(0xff959595),
                                fontFamily: "PingFang"
                                )
                            )
                        ),
                    new Expanded(
                        child: new Container(
                            margin: EdgeInsets.only(left: 8),
                            height: 1,
                            color: new Color(0xffd8d8d8)
                            )
                        ),
                }
                            )
                        )
                    );
            }

            if (widget.ShowTime)
            {
                resultChildren.Add(
                    new Container(
                        height: 36,
                        child: new Center(
                            child: new Text(
                                DateTimeString(widget.CreateTime),
                                style: new TextStyle(
                                    fontSize: 12,
                                    fontWeight: FontWeight.w500,
                                    color: new Color(0xff797979),
                                    fontFamily: "PingFang"
                                    )
                                )
                            )
                        )
                    );
            }

            resultChildren.Add(result);

            return(new Column(
                       children: resultChildren
                       ));
        }
        Widget _buildStack(BuildContext context, BoxConstraints constraints)
        {
            const float panelTitleHeight = 48.0f;
            Size        panelSize        = constraints.biggest;
            float       panelTop         = panelSize.height - panelTitleHeight;

            Animation <RelativeRect> panelAnimation = this._controller.drive(
                new RelativeRectTween(
                    begin: RelativeRect.fromLTRB(
                        0.0f,
                        panelTop - MediaQuery.of(context).padding.bottom,
                        0.0f,
                        panelTop - panelSize.height
                        ),
                    end: RelativeRect.fromLTRB(0.0f, 0.0f, 0.0f, 0.0f)
                    )
                );

            ThemeData     theme         = Theme.of(context);
            List <Widget> backdropItems = BackdropDemoConstants.allCategories.Select <Category, Widget>(
                (Category category) => {
                bool selected = category == this._category;
                return(new Material(
                           shape: new RoundedRectangleBorder(
                               borderRadius: BorderRadius.all(Radius.circular(4.0f))
                               ),
                           color: selected
                            ? Colors.white.withOpacity(0.25f)
                            : Colors.transparent,
                           child: new ListTile(
                               title: new Text(category.title),
                               selected: selected,
                               onTap: () => { this._changeCategory(category); }
                               )
                           ));
            }).ToList();

            return(new Container(
                       key: this._backdropKey,
                       color: theme.primaryColor,
                       child: new Stack(
                           children: new List <Widget> {
                new ListTileTheme(
                    iconColor: theme.primaryIconTheme.color,
                    textColor: theme.primaryTextTheme.title.color.withOpacity(0.6f),
                    selectedColor: theme.primaryTextTheme.title.color,
                    child: new Padding(
                        padding: EdgeInsets.symmetric(horizontal: 16.0f),
                        child: new Column(
                            crossAxisAlignment: CrossAxisAlignment.stretch,
                            children: backdropItems
                            )
                        )
                    ),
                new PositionedTransition(
                    rect: panelAnimation,
                    child: new BackdropPanel(
                        onTap: this._toggleBackdropPanelVisibility,
                        onVerticalDragUpdate: this._handleDragUpdate,
                        onVerticalDragEnd: this._handleDragEnd,
                        title: new Text(this._category.title),
                        child: new CategoryView(category: this._category)
                        )
                    ),
            }
                           )
                       ));
        }
Example #12
0
        private void OnTapUp(TapUpDetails details)
        {
            if (_rightClickFocus.hasFocus)
            {
                _rightClickEntry?.remove();
                _rightClickEntry = null;
            }

            FocusScope.of(context).requestFocus(new FocusNode());

            if (details.device == InputUtils.MouseLeftKeyDevice &&
                details.kind == PointerDeviceKind.mouse &&
                widget.Msg.attachments.Count > 0 &&
                !widget.Msg.attachments.first().local&&
                !_fetchingUrl)
            {
                _fetchingUrl = true;
                setState();
                var attachment = widget.Msg.attachments.first();
                Get <Attachment>(
                    url: $"/api/cdn-signed/message-attachments/{widget.Msg.id}/{attachment.id}"
                    ).Then(atch =>
                {
                    _fetchingUrl = false;
                    setState();
                    Launch(atch.signedUrl);
                });
            }
            else if (details.device == InputUtils.MouseRightKeyDevice &&
                     details.kind == PointerDeviceKind.mouse)
            {
                var children = new List <Widget>();
                if (widget.Msg.content.isNotEmpty() &&
                    widget.Msg.id.isNotEmpty())
                {
                    children.Add(
                        new GestureDetector(
                            onTap: () =>
                    {
                        Clipboard.setData(
                            new ClipboardData(text: ParseMessageToString(widget.Msg.content, widget.Users)));
                        FocusScope.of(context).requestFocus(new FocusNode());
                    },
                            child: new Container(
                                height: 40,
                                color: new Color(0x00000000),
                                alignment: Alignment.center,
                                child: new Text(
                                    "复制",
                                    style: new TextStyle(
                                        fontSize: 16,
                                        color: new Color(0xff000000),
                                        fontFamily: "PingFang"
                                        )
                                    )
                                )
                            )
                        );
                    children.Add(
                        new Container(
                            height: 1,
                            color: new Color(0xffd8d8d8)
                            )
                        );
                    children.Add(
                        new GestureDetector(
                            onTap: () =>
                    {
                        Sender.currentState.AppendString(
                            $"「{widget.Msg.author.fullName}: {ParseMessageToString(widget.Msg.content, widget.Users)}」\n- - - - - - - - - - - - - - -\n"
                            );
                        SchedulerBinding.instance.addPostFrameCallback(value =>
                                                                       FocusScope.of(context).requestFocus(Sender.currentState.widget.focusNode));
                    },
                            child: new Container(
                                height: 40,
                                color: new Color(0x00000000),
                                alignment: Alignment.center,
                                child: new Text(
                                    "引用",
                                    style: new TextStyle(
                                        fontSize: 16,
                                        color: new Color(0xff000000),
                                        fontFamily: "PingFang"
                                        )
                                    )
                                )
                            )
                        );
                }

                if (widget.Msg.author.id == Window.currentUserId &&
                    widget.Msg.id.isNotEmpty() &&
                    (widget.Msg.attachments.isEmpty() || !widget.Msg.attachments.first().local))
                {
                    if (children.isNotEmpty())
                    {
                        children.Add(
                            new Container(
                                height: 1,
                                color: new Color(0xffd8d8d8)
                                )
                            );
                    }

                    children.Add(
                        new GestureDetector(
                            onTap: () =>
                    {
                        FocusScope.of(context).requestFocus(new FocusNode());
                        Confirm(
                            context,
                            "删除消息",
                            "确认删除此条消息?",
                            () =>
                        {
                            Post <Models.Message>(
                                $"/api/connectapp/v1/messages/{widget.Msg.id}/delete",
                                null
                                ).Then(m => { });
                        },
                            () => { }
                            );
                    },
                            child: new Container(
                                height: 40,
                                color: new Color(0x00000000),
                                alignment: Alignment.center,
                                child: new Text(
                                    "删除",
                                    style: new TextStyle(
                                        fontSize: 16,
                                        color: new Color(0xff000000),
                                        fontFamily: "PingFang"
                                        )
                                    )
                                )
                            )
                        );
                }

                if (children.Count == 0)
                {
                    return;
                }

                var focusScopeNode = FocusScope.of(context);
                _rightClickEntry = new OverlayEntry(buildContext =>
                {
                    return(new GestureDetector(
                               onTap: () => { focusScopeNode.requestFocus(new FocusNode()); },
                               child: new Container(
                                   color: new Color(0x00000000),
                                   child: new Stack(
                                       children: new List <Widget>
                    {
                        new Positioned(
                            left: details.globalPosition.dx,
                            top: details.globalPosition.dy,
                            child: new Container(
                                width: 80,
                                decoration: new BoxDecoration(
                                    borderRadius: BorderRadius.all(6),
                                    boxShadow: new List <BoxShadow>
                        {
                            new BoxShadow(
                                blurRadius: 16,
                                color: new Color(0x33000000)
                                )
                        },
                                    color: new Color(0xffffffff)
                                    ),
                                child: new Column(
                                    children: children
                                    )
                                )
                            )
                    }
                                       )
                                   )
                               ));
                });
                FocusScope.of(context).requestFocus(_rightClickFocus);
                Overlay.of(context).insert(_rightClickEntry);
            }
        }
Example #13
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(title),
         new Divider(),
         new Text(subtitle),
         new Divider(),
         new Container(
             width: 500,
             decoration: new BoxDecoration(border: Border.all(new Color(0xFF00FF00), 1)),
             child: new EditableText(
                 controller: 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: () => {
                 setState(() => {
                     title = controller.text;
                 });
             },
                 padding: EdgeInsets.all(5.0),
                 child: new Center(
                     child: new Text("Set Title")
                     )
                 ),
             new RaisedButton(
                 onPressed: () => {
                 setState(() => {
                     subtitle = controller.text;
                 });
             },
                 padding: EdgeInsets.all(5.0),
                 child: new Center(
                     child: new Text("Set Subtitle")
                     )
                 )
         }
             )
     }
                        )
                    )
                ));
 }
        Widget _buildEventBottom(IEvent eventObj, EventType eventType, EventStatus eventStatus,
                                 bool isLoggedIn, BuildContext context)
        {
            if (!WechatPlugin.instance().isInstalled() || eventType == EventType.offline)
            {
                return(new Container());
            }

            return(new Container(
                       height: 56 + CCommonUtils.getSafeAreaBottomPadding(context: context),
                       padding: EdgeInsets.only(16, 8, 16, 8 + CCommonUtils.getSafeAreaBottomPadding(context: context)),
                       decoration: new BoxDecoration(
                           color: CColors.White,
                           border: new Border(new BorderSide(color: CColors.Separator))
                           ),
                       child: new CustomButton(
                           onPressed: () => {
                CustomDialogUtils.showCustomDialog(
                    barrierColor: Color.fromRGBO(0, 0, 0, 0.5f),
                    child: new CustomAlertDialog(
                        "即将前往微信小程序开始观看",
                        null,
                        new List <Widget> {
                    new CustomButton(
                        child: new Text(
                            "稍后再说",
                            style: new TextStyle(
                                height: 1.33f,
                                fontSize: 16,
                                fontFamily: "Roboto-Regular",
                                color: new Color(0xFF959595)
                                ),
                            textAlign: TextAlign.center
                            ),
                        onPressed: CustomDialogUtils.hiddenCustomDialog
                        ),
                    new CustomButton(
                        child: new Text(
                            "立即前往",
                            style: CTextStyle.PLargeBlue,
                            textAlign: TextAlign.center
                            ),
                        onPressed: () => {
                        CustomDialogUtils.hiddenCustomDialog();
                        WechatPlugin.instance().context = this.context;
                        WechatPlugin.instance().currentEventId = eventObj.id;
                        var path = CStringUtils.CreateMiniPath(id: eventObj.id,
                                                               title: eventObj.title);
                        if (path.isNotEmpty())
                        {
                            WechatPlugin.instance().toOpenMiNi(path);
                        }
                    }
                        )
                }
                        )
                    );
            },
                           padding: EdgeInsets.zero,
                           child: new Container(
                               decoration: new BoxDecoration(
                                   color: CColors.PrimaryBlue,
                                   borderRadius: BorderRadius.all(4)
                                   ),
                               child: new Row(
                                   mainAxisAlignment: MainAxisAlignment.center,
                                   children: new List <Widget> {
                new Text(
                    "进入微信小程序",
                    style: CTextStyle.PLargeMediumWhite.merge(new TextStyle(height: 1))
                    )
            }
                                   )
                               )
                           )
                       ));
        }
Example #15
0
        Widget _buildBottomView()
        {
            Widget right = new Container();

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

            return(new Container(
                       padding: EdgeInsets.symmetric(horizontal: 16),
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                new Container(height: 32),
                new CustomButton(
                    onPressed: this._login,
                    padding: EdgeInsets.zero,
                    child: new Container(
                        height: 48,
                        decoration: new BoxDecoration(this.widget.viewModel.loginBtnEnable
                                        ? this.widget.viewModel.loginLoading
                                            ? CColors.ButtonActive
                                            : CColors.PrimaryBlue
                                        : CColors.Disable,
                                                      borderRadius: BorderRadius.all(24)
                                                      ),
                        child: new Stack(
                            children: new List <Widget> {
                    new Align(
                        alignment: Alignment.center,
                        child: new Text(
                            "确定",
                            maxLines: 1,
                            style: CTextStyle.PLargeWhite
                            )
                        ),
                    new Positioned(
                        right: 24,
                        height: 48,
                        child: right
                        )
                }
                            )
                        )
                    ),
                new Container(height: 8),
                new CustomButton(
                    onPressed: () => this.widget.actionModel.openUrl($"{Config.idBaseUrl}/password/new"),
                    child: new Text(
                        "忘记密码",
                        style: CTextStyle.PRegularBody3
                        )
                    )
            }
                           )
                       ));
        }
Example #16
0
 public override Widget build(BuildContext context)
 {
     return(new Padding(
                padding: EdgeInsets.all(16.0f),
                child: new SafeArea(
                    top: false,
                    bottom: false,
                    child: new ClipRRect(
                        borderRadius: BorderRadius.all(Radius.circular(16.0f)),
                        child: new Column(
                            mainAxisSize: MainAxisSize.min,
                            children: new List <Widget> {
         new Container(
             decoration: new BoxDecoration(
                 color: new Color(0xfE5E5E5)
                 ),
             child: new Padding(
                 padding: EdgeInsets.symmetric(horizontal: 18.0f, vertical: 12.0f),
                 child: new Row(
                     mainAxisAlignment: MainAxisAlignment.spaceBetween,
                     children: new List <Widget> {
             new Text(
                 "SUPPORT TICKET",
                 style: new TextStyle(
                     color: new Color(0xf646464),
                     letterSpacing: -0.9f,
                     fontSize: 14.0f,
                     fontWeight: FontWeight.w500
                     )
                 ),
             new Text(
                 "Show More",
                 style: new TextStyle(
                     color: new Color(0xf646464),
                     letterSpacing: -0.6f,
                     fontSize: 12.0f,
                     fontWeight: FontWeight.w500
                     )
                 )
         }
                     )
                 )
             ),
         new Container(
             decoration: new BoxDecoration(
                 color: new Color(0xfF3F3F3)
                 ),
             child: new Padding(
                 padding: EdgeInsets.symmetric(horizontal: 18.0f, vertical: 12.0f),
                 child: new Column(
                     crossAxisAlignment: CrossAxisAlignment.start,
                     children: new List <Widget> {
             new Text(
                 "Product or product packaging damaged during transit",
                 style: new TextStyle(
                     fontSize: 16.0f,
                     fontWeight: FontWeight.w700,
                     letterSpacing: -0.46f
                     )
                 ),
             new Padding(padding: EdgeInsets.only(top: 16.0f)),
             new Text(
                 "REVIEWERS",
                 style: new TextStyle(
                     color: new Color(0xf646464),
                     fontSize: 12.0f,
                     letterSpacing: -0.6f,
                     fontWeight: FontWeight.w500
                     )
                 ),
             new Padding(padding: EdgeInsets.only(top: 8.0f)),
             new Row(
                 children: new List <Widget> {
                 new Container(
                     width: 44.0f,
                     height: 44.0f,
                     decoration: new BoxDecoration(
                         image: new DecorationImage(
                             image: new AssetImage(
                                 "people/square/trevor"
                                 )
                             ),
                         shape: BoxShape.circle
                         )
                     ),
                 new Padding(padding: EdgeInsets.only(left: 8.0f)),
                 new Container(
                     width: 44.0f,
                     height: 44.0f,
                     decoration: new BoxDecoration(
                         image: new DecorationImage(
                             image: new AssetImage(
                                 "people/square/sandra"
                                 )
                             ),
                         shape: BoxShape.circle
                         )
                     ),
                 new Padding(padding: EdgeInsets.only(left: 2.0f)),
                 new Icon(
                     CupertinoIcons.check_mark_circled,
                     color: new Color(0xf646464),
                     size: 20.0f
                     )
             }
                 )
         }
                     )
                 )
             )
     }
                            )
                        )
                    )
                ));
 }
            public override Widget build(BuildContext context)
            {
                var children = new List <Widget>();

                if (widget._prefix != null)
                {
                    children.Add(
                        new Container(
                            margin: EdgeInsets.only(right: 20f),
                            child: new Icon(
                                widget._prefix,
                                color: _hover ? NormalColor : MainColor
                                )
                            )
                        );
                }

                children.Add(
                    new Expanded(
                        child: new Text(
                            widget._text,
                            style: new TextStyle(
                                color: _hover ? NormalColor : MainColor,
                                fontSize: 16f
                                ),
                            maxLines: 5
                            )
                        )
                    );
                if (widget._suffix != null)
                {
                    children.Add(
                        new Container(
                            margin: EdgeInsets.only(left: 20f),
                            child: new Icon(
                                widget._suffix,
                                color: _hover ? NormalColor : MainColor
                                )
                            )
                        );
                }

                return(new Clickable(
                           onTap: widget._onTap,
                           hoverChanged: OnHoverChanged,
                           child: new Container(
                               padding: EdgeInsets.symmetric(
                                   horizontal: 16f,
                                   vertical: 12f
                                   ),
                               decoration: new BoxDecoration(
                                   border: Border.all(
                                       color: MainColor,
                                       width: 1f
                                       ),
                                   color: _hover ? MainColor : NormalColor,
                                   borderRadius: BorderRadius.all(3f)
                                   ),
                               child: new Row(
                                   mainAxisSize: MainAxisSize.min,
                                   crossAxisAlignment: CrossAxisAlignment.center,
                                   children: children
                                   )
                               )
                           ));
            }
Example #18
0
        public static void Confirm(
            BuildContext buildContext,
            string title,
            string msg,
            System.Action onConfirmed,
            System.Action onCanceled
            )
        {
            var focusNode = new FocusNode();

            FocusScope.of(buildContext).requestFocus(focusNode);
            OverlayEntry entry = null;

            entry = new OverlayEntry(
                context =>
            {
                return(new Positioned(
                           left: 0,
                           right: 0,
                           top: 0,
                           bottom: 0,
                           child: new GestureDetector(
                               onTap: () =>
                {
                    entry.remove();
                    onCanceled();
                },
                               child: new Container(
                                   color: new Color(0x00000000),
                                   alignment: Alignment.center,
                                   child: new GestureDetector(
                                       onTap: () => { },
                                       child: new Container(
                                           width: 327,
                                           height: 201,
                                           decoration: new BoxDecoration(
                                               borderRadius: BorderRadius.all(6),
                                               color: new Color(0xffffffff),
                                               boxShadow: new List <BoxShadow>
                {
                    new BoxShadow(
                        blurRadius: 16,
                        color: new Color(0x33000000)
                        )
                }
                                               ),
                                           child: new Column(
                                               children: new List <Widget>
                {
                    new Container(
                        height: 56,
                        padding: EdgeInsets.symmetric(horizontal: 24),
                        child: new Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: new List <Widget>
                    {
                        new Text(
                            title,
                            style: new TextStyle(
                                fontSize: 16,
                                color: new Color(0xff212121),
                                fontFamily: "PingFang"
                                )
                            ),
                        new GestureDetector(
                            onTap: () =>
                        {
                            entry.remove();
                            onCanceled();
                        },
                            child: new Icon(
                                IconFont.IconFontClose,
                                size: 24,
                                color: new Color(0xff979a9e)
                                )
                            )
                    }
                            )
                        ),
                    new Container(
                        height: 1,
                        color: new Color(0xfff0f0f0)
                        ),
                    new Expanded(
                        child: new Container(
                            padding: EdgeInsets.only(
                                top: 24,
                                left: 24,
                                right: 24,
                                bottom: 16),
                            child: new Column(
                                mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                children: new List <Widget>
                    {
                        new Row(
                            children: new List <Widget>
                        {
                            new Container(
                                width: 32,
                                height: 32,
                                margin: EdgeInsets.only(right: 8),
                                decoration: new BoxDecoration(
                                    borderRadius: BorderRadius.all(16),
                                    color: new Color(0x992196f3)
                                    ),
                                child: new Icon(
                                    IconFont.IconFontDelete,
                                    size: 32,
                                    color: new Color(0x992196f3)
                                    )
                                ),
                            new Text(
                                msg,
                                style: new TextStyle(
                                    fontSize: 14,
                                    color: new Color(0xff797979),
                                    fontFamily: "PingFang"
                                    )
                                )
                        }
                            ),
                        new Row(
                            mainAxisAlignment: MainAxisAlignment.end,
                            children: new List <Widget>
                        {
                            new GestureDetector(
                                onTap: () =>
                            {
                                entry.remove();
                                onCanceled();
                            },
                                child: new Container(
                                    width: 72,
                                    height: 40,
                                    decoration: new BoxDecoration(
                                        borderRadius: BorderRadius.all(3),
                                        border: Border.all(
                                            color: new Color(0xffd8d8d8)
                                            ),
                                        color: new Color(0xffffffff)
                                        ),
                                    alignment: Alignment.center,
                                    child: new Text(
                                        "取消"
                                        ),
                                    margin: EdgeInsets.only(right: 16)
                                    )
                                ),
                            new GestureDetector(
                                onTap: () =>
                            {
                                entry.remove();
                                onConfirmed();
                            },
                                child: new Container(
                                    width: 72,
                                    height: 40,
                                    decoration: new BoxDecoration(
                                        borderRadius: BorderRadius.all(3),
                                        color: new Color(0xff2196f3)
                                        ),
                                    alignment: Alignment.center,
                                    child: new Text(
                                        "确认",
                                        style: new TextStyle(
                                            fontSize: 14,
                                            color: new Color(0xffffffff),
                                            fontFamily: "PingFang"
                                            )
                                        )
                                    )
                                )
                        }
                            )
                    }
                                )
                            )
                        )
                }
                                               )
                                           )
                                       )
                                   )
                               )
                           ));
            }
                );
            Overlay.of(buildContext).insert(entry);
        }
        Widget _buildContentHead()
        {
            Widget _avatar = this._article.ownerType == OwnerType.user.ToString()
                ? Avatar.User(this._user.id, this._user, 32)
                : Avatar.Team(this._team.id, this._team, 32);

            var text        = this._article.ownerType == "user" ? this._user.fullName : this._team.name;
            var description = this._article.ownerType == "user" ? this._user.title : "";
            var time        = this._article.lastPublishedTime == null
                ? this._article.publishedTime
                : this._article.lastPublishedTime;
            Widget descriptionWidget = new Container();

            if (description.isNotEmpty())
            {
                descriptionWidget = new Text(
                    description,
                    style: CTextStyle.PSmallBody3
                    );
            }

            return(new Container(
                       color: CColors.White,
                       padding: EdgeInsets.only(16, 16, 16),
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                new Text(
                    this._article.title,
                    headTitleKey,
                    style: CTextStyle.H3
                    ),
                new Container(
                    margin: EdgeInsets.only(top: 8),
                    child: new Text(
                        $"阅读 {this._article.viewCount} · {DateConvert.DateStringFromNow(time)}",
                        style: CTextStyle.PSmallBody4
                        )
                    ),
                new Container(
                    margin: EdgeInsets.only(top: 24, bottom: 24),
                    child: new Row(
                        children: new List <Widget> {
                    new Container(
                        margin: EdgeInsets.only(right: 8),
                        child: _avatar
                        ),
                    new Column(
                        mainAxisAlignment: MainAxisAlignment.center,
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: new List <Widget> {
                        new Text(
                            text,
                            style: CTextStyle.PRegularBody
                            ),
                        descriptionWidget
                    }
                        )
                }
                        )
                    ),
                this._article.subTitle.isEmpty()
                            ? new Container()
                            : new Container(
                    margin: EdgeInsets.only(bottom: 24),
                    decoration: new BoxDecoration(
                        CColors.Separator2,
                        borderRadius: BorderRadius.all(4)
                        ),
                    padding: EdgeInsets.only(16, 12, 16, 12),
                    width: Screen.width - 32,
                    child: new Text($"{this._article.subTitle}", style: CTextStyle.PLargeBody4)
                    )
            }
                           )
                       ));
        }
Example #20
0
        List <Widget> OAList(BuildContext context)
        {
            List <Widget> list = new List <Widget>()
            {
                new Container(
                    child: new Center(
                        child: new Card(
                            shape: new RoundedRectangleBorder(
                                borderRadius: BorderRadius.all(5.0f)
                                ),
                            elevation: 0,
                            child: new Container(
                                width: width
                                , child: new Column(
                                    children: new List <Widget>()
                {
                    new SizedBox(height: 10),
                    new ClipOval(

                        child:
                        string.IsNullOrWhiteSpace(m_offcialAccount.open_id)?
                        Image.asset(
                            m_offcialAccount.headimage ?? "products/backpack",
                            fit: BoxFit.cover,
                            width: 120,
                            height: 120)
                                                :

                        Image.network(
                            m_offcialAccount.headimage ?? "",
                            fit: BoxFit.cover,
                            width: 120,
                            height: 120)
                        )
                    , new Row(
                        mainAxisAlignment: MainAxisAlignment.center
                        , children: new List <Widget>()
                    {
                        new Padding(
                            padding: EdgeInsets.all(16)
                            , child:
                            new Text(data: "群发数:" + m_offcialAccount?.post_perm, style: Theme.of(context).textTheme.body1)


                            )
                        ,
                        new Padding(
                            padding: EdgeInsets.all(16)
                            , child: new Text(data: "阅读量: 1000+", style: Theme.of(context).textTheme.body1)

                            )
                    }

                        )
                    , new Container(
                        alignment: Alignment.center
                        , child:
                        new Text(data: "简介", style: Theme.of(context).textTheme.body1)
                        )
                    , new Container(
                        padding: EdgeInsets.only(28, 16, 28, 8)
                        , child:
                        new Text(data: "\t" + m_offcialAccount.introduction ?? "这是一个帅气的简介这是一个帅气的简介这是一个帅气的简介这是一个帅气的简介这是一个帅气的简介这是一个帅气的简介"
                                 , style: Theme.of(context).textTheme.body2.copyWith(color: Colors.black54)
                                 , maxLines: 4)
                        )
                }

                                    )
                                )
                            )
                        )
                    )
                //,new Container(
                //    padding: EdgeInsets.all(16),
                //    child: new ArticleCard(new ArticleCover(){
                //        wechat_id = "test1"
                //        ,wechat_name = "暴走漫画"
                //        ,title = "\"网警\"人肉女孩求交往事件反转!"
                //        ,articleAbstract = "任谁都想不到,一场微博求助,居然会有如此反转"
                //        ,cover = "baozou-1"
                //    })
                //    )
            };

            //list.Add(
            //      new ArticleCard()
            //    );


            return(list);
        }
Example #21
0
 Widget _buildBottomView(BuildContext context)
 {
     return(new Container(
                padding: EdgeInsets.symmetric(horizontal: 16),
                child: new Column(
                    children: new List <Widget> {
         this._buildWeChatButton(context: context),
         new Container(height: 16),
         new CustomButton(
             onPressed: () => this.widget.actionModel.loginRouterPushToBindUnity(),
             padding: EdgeInsets.zero,
             child: new Container(
                 height: 48,
                 decoration: new BoxDecoration(
                     color: CColors.White,
                     border: Border.all(color: CColors.PrimaryBlue),
                     borderRadius: BorderRadius.all(24)
                     ),
                 child: new Row(
                     mainAxisAlignment: MainAxisAlignment.center,
                     children: new List <Widget> {
             new Text(
                 "使用 Unity ID 登录",
                 maxLines: 1,
                 style: CTextStyle.PLargeBlue
                 )
         }
                     )
                 )
             ),
         new Container(
             margin: EdgeInsets.only(top: 16),
             child: new RichText(
                 text: new TextSpan(
                     children: new List <TextSpan> {
             new TextSpan(
                 "登录代表您已经同意 ",
                 style: CTextStyle.PSmallBody4
                 ),
             new TextSpan(
                 "用户协议",
                 CTextStyle.PSmallBody4.copyWith(decoration: TextDecoration.underline),
                 recognizer: new TapGestureRecognizer {
                 onTap = () => this.widget.actionModel.openUrl(Config.termsOfService)
             }
                 ),
             new TextSpan(
                 " 和 ",
                 style: CTextStyle.PSmallBody4
                 ),
             new TextSpan(
                 "隐私政策",
                 CTextStyle.PSmallBody4.copyWith(decoration: TextDecoration.underline),
                 recognizer: new TapGestureRecognizer {
                 onTap = () => this.widget.actionModel.openUrl(Config.privacyPolicy)
             }
                 )
         }
                     )
                 )
             ),
         new Container(
             height: 16 + MediaQuery.of(context: context).padding.bottom
             )
     }
                    )
                ));
 }
Example #22
0
        public override Widget build(BuildContext context)
        {
            Widget likeCountWidget;

            if (this.widget.totalLikeCount + this._likeCount > 0)
            {
                var totalLikeCount = CStringUtils.CountToString(this.widget.totalLikeCount + this._likeCount);
                likeCountWidget = new Text(
                    data: totalLikeCount,
                    style: new TextStyle(
                        fontSize: 12,
                        fontFamily: "Roboto-Regular",
                        color: CColors.Thumb
                        )
                    );
            }
            else
            {
                likeCountWidget = new Container();
            }

            return(new Stack(
                       fit: StackFit.expand,
                       children: new List <Widget> {
                this.widget.child,
                new AnimatedPositioned(
                    right: this.widget.isPullUp ? -24 : 16,
                    bottom: 24,
                    duration: TimeSpan.FromMilliseconds(200),
                    child: new GestureDetector(
                        onTap: () => {
                    if (this.widget.isPullUp)
                    {
                        return;
                    }

                    var isLoginIn = this.widget.boolCallback();
                    if (!isLoginIn)
                    {
                        return;
                    }
                    this._controller.reset();
                    this._controller.forward();
                    if (!this._like)
                    {
                        this.setState(() => this._like = true);
                    }
                    if (this._likeCount + this.widget.likeCount < 50)
                    {
                        this.setState(() => this._likeCount += 1);
                    }
                    if (this._lastDateTime == null)
                    {
                        this._lastDateTime = DateTime.Now;
                        this.setState(() => this._isLike = true);
                        this._startTimer();
                    }
                    else
                    {
                        var currentDateTime = DateTime.Now;
                        var ts = currentDateTime.Subtract((DateTime)this._lastDateTime);
                        if (ts.TotalMilliseconds <= likeTime)
                        {
                            this._startTimer();
                        }
                        this._lastDateTime = currentDateTime;
                    }
                },
                        child: new Opacity(
                            this.widget.isPullUp ? 0.5f : 1,
                            child: new ScaleTransition(
                                scale: this._scaleAnimation,
                                child: new Container(
                                    width: 48,
                                    height: 48,
                                    decoration: new BoxDecoration(
                                        color: CColors.White,
                                        borderRadius: BorderRadius.all(24),
                                        boxShadow: new List <BoxShadow> {
                    new BoxShadow(
                        CColors.Black.withOpacity(0.1f),
                        blurRadius: 8,
                        spreadRadius: 0,
                        offset: new Offset(0, 0))
                }
                                        ),
                                    child: new Column(
                                        mainAxisAlignment: MainAxisAlignment.center,
                                        children: new List <Widget> {
                    new Icon(
                        this.widget.like || this._like ? Icons.thumb_bold : Icons.thumb_line,
                        size: 24,
                        color: CColors.Thumb
                        ),
                    likeCountWidget
                }
                                        )
                                    )
                                )
                            )
                        )
                    ),
                new AnimatedPositioned(
                    child: new Opacity(
                        this._isLike ? 1 : 0,
                        child: new ScaleTransition(
                            scale: this._scaleAnimation,
                            alignment: Alignment.center,
                            child: new Container(
                                width: 32,
                                height: 32,
                                decoration: new BoxDecoration(
                                    color: CColors.Gerakdine,
                                    borderRadius: BorderRadius.all(16)
                                    ),
                                alignment: Alignment.center,
                                child: new Text(
                                    $"+{this._likeCount + this.widget.likeCount}",
                                    style: new TextStyle(
                                        fontSize: 12,
                                        fontFamily: "Roboto-Regular",
                                        color: CColors.White
                                        )
                                    )
                                )
                            )
                        ),
                    duration: TimeSpan.FromMilliseconds(134),
                    bottom: this._isLike ? 96 : 70,
                    right: 24,
                    curve: Curves.bounceOut
                    )
            }
                       ));
        }
Example #23
0
 public override Widget build(BuildContext context)
 {
     if (width == null)
     {
         width = MediaQuery.of(context).size.width;
     }
     return
         (new Container(
              child: new Center(
                  child: new Card(
                      shape: new RoundedRectangleBorder(
                          borderRadius: BorderRadius.all(5.0f)
                          ),
                      child:
                      new InkWell(
                          onTap: () => {
         Navigator.of(context).push(new MaterialPageRoute((buildcontext) => new OAPanel(offcialAccount)));
     }
                          , child: new Container(
                              width: width * 0.95f
                              , child: new Padding(
                                  padding: EdgeInsets.only(8, 8, 8, 8)
                                  , child:
                                  new Row(
                                      children: new List <Widget>()
     {
         new ClipOval(
             child: string.IsNullOrWhiteSpace(offcialAccount.open_id)?
             Image.asset(
                 offcialAccount.headimage ?? "products/backpack",
                 fit: BoxFit.cover,
                 width: 80,
                 height: 80
                 ) :
             Image.network(
                 offcialAccount.headimage ?? "products/backpack",
                 fit: BoxFit.cover,
                 width: 80,
                 height: 80
                 )
             )
         ,
         new Expanded(
             child:
             new Column(
                 children: new List <Widget>()
         {
             new Container(
                 alignment: Alignment.topLeft
                 , padding: EdgeInsets.only(8, 4, 8, 4)
                 , child: new Text(data: offcialAccount.wechat_name ?? "这是名字", style: Theme.of(context).textTheme.headline)
                 )
             , new Container(
                 height: 42
                 , padding: EdgeInsets.only(8, 4, 8, 4)
                 , alignment: Alignment.topLeft
                 , child: new Text(data: offcialAccount.introduction ?? "这是一个帅气的简介这是一个帅气这是一个帅气这是一个帅气这是一个帅气这是一个帅气这是一个帅气"
                                   , style: Theme.of(context).textTheme.body1.copyWith(color: Colors.black54)
                                   , overflow: Unity.UIWidgets.rendering.TextOverflow.ellipsis
                                   , maxLines: 2)
                 )
         }
                 )
             )
     }
                                      )
                                  )
                              )
                          )
                      )
                  )
              ));
 }
Example #24
0
 public override Widget build(BuildContext context)
 {
     return(new Container(
                height: 49,
                padding: EdgeInsets.only(16, right: 8),
                decoration: new BoxDecoration(
                    border: new Border(new BorderSide(CColors.Separator)),
                    color: CColors.White
                    ),
                child: new Row(
                    mainAxisAlignment: MainAxisAlignment.spaceBetween,
                    crossAxisAlignment: CrossAxisAlignment.center,
                    children: new List <Widget> {
         new GestureDetector(
             onTap: this.addCommentCallback,
             child: new Container(
                 padding: EdgeInsets.only(16),
                 height: 32,
                 width: MediaQuery.of(context).size.width - 164,
                 decoration: new BoxDecoration(
                     CColors.Separator2,
                     borderRadius: BorderRadius.all(16)
                     ),
                 alignment: Alignment.centerLeft,
                 child: new Container(
                     child: new Text(
                         "说点想法...",
                         style: CTextStyle.PKeyboardTextStyle
                         )
                     )
                 )
             ),
         //评论
         new CustomButton(
             padding: EdgeInsets.symmetric(12, 10),
             onPressed: this.commentCallback,
             child: new Icon(Icons.comment, size: 24, color: CColors.Icon)
             ),
         //点赞
         new LikeButton.LikeButton(
             isLiked => new Icon(
                 isLiked ? Icons.favorite : Icons.favorite_border,
                 color: isLiked ? CColors.SecondaryPink : CColors.Icon,
                 size: 24
                 ),
             size: 24,
             circleColor: new CircleColor(
                 CColors.SecondaryPink,
                 CColors.SecondaryPink
                 ),
             likeButtonPadding: EdgeInsets.symmetric(12, 10),
             isLiked: this.like,
             isShowBubbles: false,
             onTap: () => this.favorCallback()
             ),
         //分享
         new CustomButton(
             padding: EdgeInsets.symmetric(12, 10),
             onPressed: this.shareCallback,
             child: new Icon(Icons.share, size: 24, color: CColors.Icon)
             )
     }
                    )
                ));
 }
        Widget _buildFollowButton(bool isTop = false)
        {
            if (this.widget.viewModel.isLoggedIn &&
                this.widget.viewModel.currentUserId == this.widget.viewModel.team.id)
            {
                return(new Container());
            }

            bool               isFollow      = false;
            string             followText    = "关注";
            Color              followBgColor = CColors.PrimaryBlue;
            GestureTapCallback onTap         = () => {
                this.widget.actionModel.startFollowTeam();
                this.widget.actionModel.followTeam(arg: this.widget.viewModel.team.id);
            };

            if (this.widget.viewModel.isLoggedIn &&
                this.widget.viewModel.followMap.ContainsKey(key: this.widget.viewModel.team.id))
            {
                isFollow      = true;
                followText    = "已关注";
                followBgColor = CColors.Transparent;
                onTap         = () => {
                    ActionSheetUtils.showModalActionSheet(
                        new ActionSheet(
                            title: "确定不再关注?",
                            items: new List <ActionSheetItem> {
                        new ActionSheetItem("确定", type: ActionType.normal, () => {
                            this.widget.actionModel.startUnFollowTeam();
                            this.widget.actionModel.unFollowTeam(arg: this.widget.viewModel.team.id);
                        }),
                        new ActionSheetItem("取消", type: ActionType.cancel)
                    }
                            )
                        );
                };
            }

            Widget buttonChild;
            bool   isEnable;

            if (this.widget.viewModel.team.followTeamLoading ?? false)
            {
                buttonChild = new CustomActivityIndicator(
                    loadingColor: isTop ? LoadingColor.black : LoadingColor.white,
                    size: LoadingSize.small
                    );
                isEnable = false;
            }
            else
            {
                buttonChild = new Text(
                    data: followText,
                    style: isTop
                        ? new TextStyle(
                        fontSize: 14,
                        fontFamily: "Roboto-Medium",
                        color: isFollow ? new Color(0xFF959595) : CColors.PrimaryBlue
                        )
                        : CTextStyle.PMediumWhite
                    );
                isEnable = true;
            }

            if (isTop)
            {
                return(new CustomButton(
                           padding: EdgeInsets.zero,
                           child: new Container(
                               width: 60,
                               height: 28,
                               alignment: Alignment.center,
                               decoration: new BoxDecoration(
                                   color: CColors.Transparent,
                                   borderRadius: BorderRadius.circular(14),
                                   border: isFollow
                                ? Border.all(color: CColors.Disable2)
                                : Border.all(color: CColors.PrimaryBlue)
                                   ),
                               child: buttonChild
                               ),
                           onPressed: () => {
                    if (!isEnable)
                    {
                        return;
                    }

                    if (this.widget.viewModel.isLoggedIn)
                    {
                        onTap();
                    }
                    else
                    {
                        this.widget.actionModel.pushToLogin();
                    }
                }
                           ));
            }

            return(new CustomButton(
                       padding: EdgeInsets.zero,
                       child: new Container(
                           width: 100,
                           height: 32,
                           alignment: Alignment.center,
                           decoration: new BoxDecoration(
                               color: followBgColor,
                               borderRadius: BorderRadius.all(4),
                               border: isFollow ? Border.all(CColors.White) : null
                               ),
                           child: buttonChild
                           ),
                       onPressed: () => {
                if (!isEnable)
                {
                    return;
                }

                if (this.widget.viewModel.isLoggedIn)
                {
                    onTap();
                }
                else
                {
                    this.widget.actionModel.pushToLogin();
                }
            }
                       ));
        }
Example #26
0
        Widget _buildOfflineRegisterNow(IEvent eventObj, bool isLoggedIn, EventStatus eventStatus)
        {
            if (eventObj.type.isNotEmpty() && !(eventObj.type == "bagevent" || eventObj.type == "customize"))
            {
                return(new Container());
            }

            var buttonText      = "立即报名";
            var backgroundColor = CColors.PrimaryBlue;
            var isEnabled       = true;

            if (eventStatus == EventStatus.past)
            {
                buttonText      = "已结束";
                backgroundColor = CColors.Disable;
                isEnabled       = false;
            }

            return(new Container(
                       height: 64,
                       padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
                       decoration: new BoxDecoration(
                           CColors.White,
                           border: new Border(new BorderSide(CColors.Separator))
                           ),
                       child: new CustomButton(
                           onPressed: () => {
                if (!isEnabled)
                {
                    return;
                }

                if (isLoggedIn && eventObj.type.isNotEmpty())
                {
                    if (eventObj.type == "bagevent")
                    {
                        this.widget.actionModel.openUrl(
                            $"{Config.apiAddress}/events/{eventObj.id}/purchase");
                    }
                    else if (eventObj.type == "customize" && eventObj.typeParam.isNotEmpty())
                    {
                        this.widget.actionModel.openUrl(eventObj.typeParam);
                    }
                }
                else
                {
                    this.widget.actionModel.pushToLogin();
                }
            },
                           padding: EdgeInsets.zero,
                           child: new Container(
                               decoration: new BoxDecoration(
                                   backgroundColor,
                                   borderRadius: BorderRadius.all(4)
                                   ),
                               child: new Row(
                                   mainAxisAlignment: MainAxisAlignment.center,
                                   children: new List <Widget> {
                new Text(
                    buttonText,
                    style: CTextStyle.PLargeMediumWhite
                    )
            }
                                   )
                               )
                           )
                       ));
        }
Example #27
0
        public override Widget build(BuildContext context)
        {
            return(new StoreConnector <AppState, AppState>(
                       converter: state => state,
                       builder: (buildContext, model, dispatcher) =>
            {
                return new Scaffold(
                    appBar: new AppBar(
                        centerTitle: true,
                        elevation: 0,
                        leading: new IconButton(
                            icon: new Icon(Icons.arrow_back),
                            onPressed: () => { Navigator.pop(context); }
                            ),
                        title: new Text(widget.CreateMode ? "New Habit" : "Edit Habit"),
                        bottom: new PreferredSize(
                            preferredSize: Size.fromHeight(1),
                            child: new Container(
                                height: 0.5f,
                                color: Colors.white30
                                )
                            ),
                        actions: new List <Widget>()
                {
                    new FlatButton(
                        child: new Text(widget.CreateMode ? "" : "Delete",
                                        style: new TextStyle(color: Colors.red)),
                        onPressed: () =>
                    {
                        DialogUtils.showDialog(
                            context: context,
                            builder: (context1 =>
                        {
                            return new Theme(
                                data: new ThemeData(dialogBackgroundColor: new Color(0xFF333333)),
                                child: new AlertDialog(
                                    contentPadding: EdgeInsets.fromLTRB(24, 24, 24, 0),
                                    content: new Text("Really want to delete this habit?",
                                                      style: new TextStyle(color: Colors.white70)
                                                      ),
                                    actions: new List <Widget>()
                            {
                                new FlatButton(
                                    child: new Text("Yes",
                                                    style: new TextStyle(color: Colors.red)
                                                    ),
                                    onPressed: () =>
                                {
                                    dispatcher.dispatch(
                                        new DeleteHabitAction(widget.Habit));
                                    Navigator.pop(context1);
                                    Navigator.pop(context);
                                }),
                                new FlatButton(
                                    child: new Text("No",
                                                    style: new TextStyle(color: Colors.white70)
                                                    ),
                                    onPressed: () => { Navigator.pop(context1); }),
                            }
                                    )
                                );
                        }));
                    }
                        )
                },
                        backgroundColor: new Color(0xFF212121)
                        ),
                    body: new Container(
                        margin: EdgeInsets.all(15),
                        decoration: new BoxDecoration(),
                        child: new TextField(
                            style: new TextStyle(fontSize: 18, color: Colors.white70),
                            decoration: new InputDecoration(
                                fillColor: new Color(0xFF424242),
                                filled: true,
                                hasFloatingPlaceholder: false,
                                hintText: "New Habit",
                                contentPadding: EdgeInsets.all(6),
                                focusedBorder: new OutlineInputBorder(
                                    borderRadius: BorderRadius.all(Radius.circular(6)),
                                    borderSide: new BorderSide(width: 0, color: new Color(0xFF424242))
                                    )
                                ),
                            controller: new TextEditingController(widget.CreateMode
                                    ? string.Empty
                                    : widget.Habit.Title),
                            onSubmitted: (value =>
                {
                    if (widget.CreateMode)
                    {
                        dispatcher.dispatch(new AddHabitAction(new HabitData(value)));
                    }
                    else
                    {
                        if (value != widget.Habit.Title)
                        {
                            dispatcher.dispatch(new UpdateHabitAction(widget.Habit, value));
                        }
                    }

                    Navigator.pop(context);
                }))
                        )
                    );
            }
                       ));
        }
Example #28
0
        public override Widget build(BuildContext context)
        {
            if (width == null)
            {
                width = MediaQuery.of(context).size.width;
            }
            return
                (new Container(
                     child: new Center(
                         child: new Card(
                             shape: new RoundedRectangleBorder(
                                 borderRadius: BorderRadius.all(5.0f)
                                 ),
                             child: new Container(
                                 child: new Column(

                                     children: new List <Widget> {
                new Padding(
                    padding: EdgeInsets.only(8, 8, 8, 8)
                    , child:
                    new Row(
                        children: new List <Widget>()
                {
                    new ClipOval(

                        child: Image.asset(
                            m_ArticleCover.wechat_id ?? "products/backpack",
                            fit: BoxFit.cover,
                            width: 30,
                            height: 30
                            )
                        )
                    ,
                    new Container(
                        padding: EdgeInsets.only(8, 0, 0, 0)
                        , child: new Text(m_ArticleCover.wechat_name ?? "这是名字")
                        )
                    //Image.memory()
                }
                        )

                    )
                , new InkWell(
                    onTap: () => { Debug.Log("H"); }
                    , child:
                    Image.asset(
                        m_ArticleCover.cover ?? "products/backpack",
                        fit: BoxFit.cover,
                        width: width * 0.95f,
                        height: 150
                        )
                    )

                , new Container(
                    alignment: Alignment.centerLeft
                    , padding: EdgeInsets.all(8),
                    child: new Text(m_ArticleCover.title ?? "这是标题")

                    )
                , new Container(
                    alignment: Alignment.centerLeft
                    , padding: EdgeInsets.all(8),
                    child: new Text(data: m_ArticleCover.articleAbstract ?? "这是简介"
                                    , style: Theme.of(context).textTheme.body2.copyWith(color: Colors.black54))

                    )
            }
                                     )
                                 )
                             )
                         )
                     ));
        }
Example #29
0
        Widget _buildContentHead()
        {
            Widget _avatar = this._article.ownerType == OwnerType.user.ToString()
                ? Avatar.User(user: this._user, 32)
                : Avatar.Team(team: this._team, 32);

            var text = this._article.ownerType == "user"
                ? this._user.fullName ?? this._user.name
                : this._team.name;
            var    description       = this._article.ownerType == "user" ? this._user.title : "";
            var    time              = this._article.publishedTime;
            Widget descriptionWidget = new Container();

            if (description.isNotEmpty())
            {
                descriptionWidget = new Text(
                    data: description,
                    style: CTextStyle.PSmallBody3
                    );
            }

            return(new Container(
                       color: CColors.White,
                       padding: EdgeInsets.only(16, 16, 16),
                       child: new Column(
                           crossAxisAlignment: CrossAxisAlignment.start,
                           children: new List <Widget> {
                new Text(
                    data: this._article.title,
                    style: CTextStyle.H3
                    ),
                new Container(
                    margin: EdgeInsets.only(top: 8),
                    child: new Text(
                        $"阅读 {this._article.viewCount} · {DateConvert.DateStringFromNow(dt: time)}",
                        style: CTextStyle.PSmallBody4
                        )
                    ),
                new Row(
                    children: new List <Widget> {
                    new Expanded(
                        child: new GestureDetector(
                            onTap: () => {
                        if (this._article.ownerType == OwnerType.user.ToString())
                        {
                            this.widget.actionModel.pushToUserDetail(obj: this._user.id);
                        }

                        if (this._article.ownerType == OwnerType.team.ToString())
                        {
                            this.widget.actionModel.pushToTeamDetail(obj: this._team.id);
                        }
                    },
                            child: new Container(
                                margin: EdgeInsets.only(top: 24, bottom: 24),
                                color: CColors.Transparent,
                                child: new Row(
                                    mainAxisSize: MainAxisSize.min,
                                    children: new List <Widget> {
                        new Container(
                            margin: EdgeInsets.only(right: 8),
                            child: _avatar
                            ),
                        new Column(
                            mainAxisAlignment: MainAxisAlignment.center,
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: new List <Widget> {
                            new Text(
                                data: text,
                                style: CTextStyle.PRegularBody
                                ),
                            descriptionWidget
                        }
                            )
                    }
                                    )
                                )
                            )
                        ),
                    new SizedBox(width: 8),
                    this._buildFollowButton()
                }
                    ),
                this._article.subTitle.isEmpty()
                            ? new Container()
                            : new Container(
                    margin: EdgeInsets.only(bottom: 24),
                    decoration: new BoxDecoration(
                        color: CColors.Separator2,
                        borderRadius: BorderRadius.all(4)
                        ),
                    padding: EdgeInsets.only(16, 12, 16, 12),
                    width: Screen.width - 32,
                    child: new Text($"{this._article.subTitle}", style: CTextStyle.PLargeBody4)
                    )
            }
                           )
                       ));
        }
Example #30
0
        public override Widget build(BuildContext context)
        {
            if (this.channel == null)
            {
                return(new Container());
            }

            Widget image = Positioned.fill(
                CachedNetworkImageProvider.cachedNetworkImage(
                    this.channel?.thumbnail ?? "",
                    fit: BoxFit.cover
                    )
                );
            Widget gradient = Positioned.fill(
                new Container(
                    decoration: new BoxDecoration(
                        gradient: new LinearGradient(
                            begin: Alignment.topCenter,
                            end: Alignment.bottomCenter,
                            new List <Color> {
                Color.fromARGB(20, 0, 0, 0),
                Color.fromARGB(80, 0, 0, 0)
            }
                            )
                        )
                    )
                );

            Widget title = new Container(
                height: 72,
                padding: EdgeInsets.symmetric(0, 8),
                child: new Align(
                    alignment: Alignment.bottomLeft,
                    child: new Text(
                        data: this.channel.name,
                        style: CTextStyle.PLargeMediumWhite
                        )
                    )
                );

            Widget count = new Container(
                padding: EdgeInsets.only(top: 4, left: 8),
                child: new Row(
                    children: new List <Widget> {
                new Container(
                    width: 8,
                    height: 8,
                    decoration: new BoxDecoration(
                        color: CColors.AquaMarine,
                        borderRadius: BorderRadius.all(4)
                        )
                    ),
                new Container(width: 4),
                new Text($"{this.channel.memberCount}人",
                         style: CTextStyle.PSmallWhite)
            }
                    )
                );

            Widget content = Positioned.fill(
                new Column(
                    children: new List <Widget> {
                title, count
            }
                    )
                );

            return(new GestureDetector(
                       onTap: this.onTap,
                       child: new Container(
                           width: 120,
                           height: 120,
                           margin: EdgeInsets.only(right: 16),
                           child: new ClipRRect(
                               borderRadius: BorderRadius.all(8),
                               child: new Container(
                                   child: new Stack(
                                       children: new List <Widget> {
                image, gradient, content
            }
                                       )
                                   )
                               )
                           )
                       ));
        }