Esempio n. 1
0
 public override Widget build(BuildContext context) {
     D.assert(this._phase != FadeInImagePhase.start);
     ImageInfo imageInfo = this._imageInfo;
     return new RawImage(
         image: imageInfo?.image,
         width: this.widget.width,
         height: this.widget.height,
         scale: imageInfo?.scale ?? 1.0f,
         color: Color.fromRGBO(255, 255, 255, this._animation?.value ?? 1.0f),
         colorBlendMode: BlendMode.modulate,
         fit: this.widget.fit,
         alignment: this.widget.alignment,
         repeat: this.widget.repeat
     );
 }
Esempio n. 2
0
        private Widget renderNoBuildButtons()
        {
            var button = new Container(color: Color.fromRGBO(33, 150, 243, 0.3f),
                                       padding: EdgeInsets.all(20),
                                       alignment: Alignment.bottomCenter,
                                       child: new Text(data: "Upload", style: new TextStyle(fontSize: 13f, color: new Color(0xFFFFFFFF))),
                                       height: 58f

                                       );

            return(new Container(color: new Color(0x00000000),
                                 alignment: Alignment.bottomCenter,
                                 child: new Container(color: new Color(0xFFFFFFFF),
                                                      padding: EdgeInsets.all(20),
                                                      alignment: Alignment.bottomCenter,
                                                      child: new Center(child: button),
                                                      height: 98f
                                                      )
                                 ));
        }
Esempio n. 3
0
        private Widget renderNoBuildLogo()
        {
            var logo  = Image.asset("html5-logo", fit: BoxFit.cover, width: 24, height: 34);
            var label = new Text(data: "Webgl", style: new TextStyle(fontSize: 15f, color: new Color(0xFF424242), fontWeight: FontWeight.w700));
            var text  = new Container(
                child:
                new Row(
                    children: new List <Widget>()
            {
                new Container(padding: EdgeInsets.only(top: 8), child: label)
            },
                    mainAxisAlignment: MainAxisAlignment.center
                    )
                );

            return(new Unity.UIWidgets.material.Material(
                       elevation: 3f,
                       shadowColor: Color.fromRGBO(0, 0, 0, 0.1f),
                       shape: new CircleBorder(
                           side: new BorderSide(
                               width: 2.0f,
                               style: BorderStyle.none
                               )
                           ),
                       child: new Container(
                           child:
                           new Column(
                               children: new List <Widget>()
            {
                logo,
                text
            },
                               mainAxisAlignment: MainAxisAlignment.center
                               ),
                           height: 110,
                           width: 110,
                           decoration: new BoxDecoration(color: new Color(0xFFFFFFFF), shape: BoxShape.circle)
                           )
                       ));
        }
Esempio n. 4
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: 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: pushCallback
                        )
                    ),
                logo
            }
                           )
                       ));
        }
        public override Widget build(BuildContext context)
        {
            var iconData = Icons.pause;

            switch (this._playState)
            {
            case PlayState.stop:
                iconData = Icons.replay;
                break;

            case PlayState.pause:
                iconData = Icons.play_arrow;
                break;
            }

            var content = new Container(
                child: new Stack(children: new List <Widget> {
                new GestureDetector(
                    onTap: () => {
                    if (this._isFailure && this._isHiddenBar == false)
                    {
                        return;
                    }

                    this._isHiddenBar      = !this._isHiddenBar;
                    this._isReadyHiddenBar = false;
                    this.setState();
                    this.cancelTimer();
                },
                    child: new Container(color: CColors.Black, child: new Texture(texture: this._texture))
                    ),
                this._isLoaded
                        ? new Align()
                        : new Align(
                    alignment: Alignment.center,
                    child: new CustomActivityIndicator(loadingColor: LoadingColor.white)
                    ),
                this._isHiddenBar
                        ? new Positioned(new Container())
                        : new Positioned(top: 0, left: 0, right: 0, child: this._isFullScreen
                            ? new Row(
                                             mainAxisAlignment: MainAxisAlignment.spaceBetween,
                                             children: new List <Widget> {
                    new GestureDetector(
                        onTap: this._setScreenOrientation,
                        child: new Container(
                            margin: EdgeInsets.only(8,
                                                    Application.platform == RuntimePlatform.IPhonePlayer ? 20 : 8),
                            child: new Icon(
                                Icons.arrow_back,
                                size: 28,
                                color: CColors.White
                                )
                            )
                        )
                }
                                             )
                            : this.widget.topWidget),
                this._isHiddenBar
                        ? new Positioned(new Container())
                        : new Positioned(
                    bottom: 0,
                    left: 0,
                    right: 0,
                    child: this._isFailure
                                ? new Container(
                        height: _toolBarHeight,
                        padding: EdgeInsets.only(top: 0, left: 8),
                        color: Color.fromRGBO(0, 0, 0, 0.2f),
                        child: new Row(children: new List <Widget> {
                    new GestureDetector(
                        child: new Container(
                            height: _toolBarHeight,
                            width: _toolBarHeight,
                            color: CColors.Transparent,
                            child: new Icon(Icons.replay, size: 24, color: CColors.White)
                            ),
                        onTap: this._reloadVideo
                        ),
                    new Text("视频播放失败", style: new TextStyle(
                                 fontSize: 15,
                                 fontFamily: "Roboto-Bold",
                                 color: CColors.White
                                 ))
                }))
                                : new Container(
                        height: _toolBarHeight,
                        decoration: new BoxDecoration(gradient: new LinearGradient(
                                                          colors: new List <Color> {
                    Color.fromRGBO(0, 0, 0, 0),
                    Color.fromRGBO(0, 0, 0, 0.5f)
                },
                                                          begin: Alignment.topCenter,
                                                          end: Alignment.bottomCenter
                                                          )),
                        child: new Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            crossAxisAlignment: CrossAxisAlignment.center,
                            children: new List <Widget> {
                    new GestureDetector(
                        child: new Container(
                            height: _toolBarHeight,
                            width: _toolBarHeight,
                            color: CColors.Transparent,
                            child: new Icon(iconData, size: 24, color: CColors.White)
                            ),
                        onTap: this._playOrPause
                        ),
                    new Container(margin: EdgeInsets.only(right: 8), child:
                                  new Text($"{DateConvert.formatTime((float) this._player.time)}",
                                           style: CTextStyle.CaptionWhite)),
                    new Expanded(
                        child: new ProgressBar(this._relative,
                                               changeCallback: relative => {
                        this._relative = relative;
                        if (this.widget.recordDuration > 0)
                        {
                            this._player.time = relative * this.widget.recordDuration;
                        }
                        else
                        {
                            this._player.time =
                                relative * this._player.frameCount /
                                this._player.frameRate;
                        }

                        this.cancelTimer();
                        this._isLoaded = false;
                        this._player.Pause();
                        this.setState(() => { });
                    }, onDragStart: () => {
                        this.cancelTimer();
                        this._isLoaded = false;
                        this._player.Pause();
                        this.setState(() => { });
                    })),
                    new Container(margin: EdgeInsets.only(left: 8, right: 8), child:
                                  new Text(
                                      $"{DateConvert.formatTime(this.widget.recordDuration > 0 ? this.widget.recordDuration : this._player.frameCount / this._player.frameRate)}",
                                      style: CTextStyle.CaptionWhite)),
                    new GestureDetector(
                        child: new Container(
                            height: _toolBarHeight,
                            width: _toolBarHeight,
                            color: CColors.Transparent,
                            child: new Icon(
                                this._isFullScreen ? Icons.fullscreen_exit : Icons.fullscreen,
                                size: 24,
                                color: CColors.White)
                            ),
                        onTap: this._setScreenOrientation
                        )
                })
                        )
                    )
            })
                );

            return(new Container(
                       width: this._isFullScreen
                    ? MediaQuery.of(context).size.height * 16 / 9
                    : MediaQuery.of(context).size.width,
                       height: this._isFullScreen
                    ? MediaQuery.of(context).size.height
                    : MediaQuery.of(context).size.width * 9 / 16,
                       child: content
                       ));
        }
Esempio n. 6
0
        public override Widget build(BuildContext context)
        {
            this._context = context;
            if (!this._isShow)
            {
                return(new MainScreen());
            }

            var topPadding = Application.platform != RuntimePlatform.Android
                ? MediaQuery.of(context: context).padding.top
                : 0f;

            var    isShowLogo = SplashManager.getSplash()?.isShowLogo ?? false;
            Widget logoWidget;

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

            return(new Container(
                       color: CColors.White,
                       child: new CustomSafeArea(
                           top: false,
                           child: new Stack(
                               children: new List <Widget> {
                new Column(
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: new List <Widget> {
                    new GestureDetector(
                        child: new Container(
                            width: MediaQuery.of(context).size.width,
                            height: MediaQuery.of(context).size.height - 116 -
                            CCommonUtils.getSafeAreaBottomPadding(context: context),
                            child: Image.memory(SplashManager.readImage(), fit: BoxFit.cover)
                            ),
                        onTap: this.pushPage
                        ),
                    new Container(
                        width: 182,
                        height: 32,
                        margin: EdgeInsets.only(top: 36),
                        child: Image.asset("image/iOS/unityConnectBlack.imageset/unityConnectBlack")
                        ),
                    new Container(
                        width: 101,
                        height: 22,
                        margin: EdgeInsets.only(top: 6, bottom: 20),
                        child: Image.asset("image/iOS/madeWithUnity.imageset/madeWithUnity")
                        )
                }
                    ),
                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: "Roboto-Regular",
                                                color: CColors.White
                                                ))
                            ),
                        onTap: this.pushCallback
                        )
                    ),
                logoWidget
            }
                               ))
                       ));
        }
Esempio n. 7
0
        public static void checkForUpdates(CheckVersionType type)
        {
            if (type == CheckVersionType.setting)
            {
                CustomDialogUtils.showCustomDialog(
                    child: new CustomLoadingDialog(message: "正在检查更新")
                    );
            }

            SettingApi.FetchVersion(Config.platform, Config.store, $"{Config.versionCode}")
            .Then(versionResponse => {
                if (type == CheckVersionType.setting)
                {
                    CustomDialogUtils.hiddenCustomDialog();
                }

                var status = versionResponse["status"];
                if (status.ToLower() == "need_update" && versionResponse.ContainsKey("url"))
                {
                    var changeLog = "发现新版本,立即更新体验吧!";
                    if (versionResponse.ContainsKey("changeLog"))
                    {
                        if (versionResponse["changeLog"].isNotEmpty())
                        {
                            changeLog = versionResponse["changeLog"];
                        }
                    }

                    CustomDialogUtils.showCustomDialog(
                        barrierColor: Color.fromRGBO(0, 0, 0, 0.5f),
                        child: new CustomAlertDialog(
                            "版本更新",
                            changeLog,
                            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: _ignoreUpdater
                            ),
                        new CustomButton(
                            child: new Text(
                                "立即更新",
                                style: CTextStyle.PLargeBlue,
                                textAlign: TextAlign.center
                                ),
                            onPressed: () => {
                            _ignoreUpdater();
                            var url = versionResponse["url"];
                            Application.OpenURL(url);
                        }
                            )
                    }
                            )
                        );
                }
                else
                {
                    if (type == CheckVersionType.setting)
                    {
                        var customSnackBar = new CustomSnackBar(
                            "当前是最新版本",
                            color: CColors.TextBody
                            );
                        customSnackBar.show();
                    }
                }
            })
            .Catch(error => {
                if (type == CheckVersionType.setting)
                {
                    CustomDialogUtils.hiddenCustomDialog();
                }
            });
        }
Esempio n. 8
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
//                                    }
//                                )
//                            )
//                        )
//                    }
//                )
//            );
        }
        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))
                    )
            }
                                   )
                               )
                           )
                       ));
        }
Esempio n. 10
0
        public static void checkForUpdates(CheckVersionType type)
        {
            if (type == CheckVersionType.setting)
            {
                CustomDialogUtils.showCustomDialog(
                    child: new CustomLoadingDialog(message: "正在检查更新")
                    );
            }

            SettingApi.CheckNewVersion(platform: Config.platform, store: Config.store, $"{Config.versionCode}")
            .Then(versionResponse => {
                if (type == CheckVersionType.setting)
                {
                    CustomDialogUtils.hiddenCustomDialog();
                }

                var status = versionResponse.status;
                if (status == "NEED_UPDATE" && versionResponse.url.isNotEmpty())
                {
                    if (type == CheckVersionType.initialize && !needNoticeNewVersion() || needForceUpdate())
                    {
                        return;
                    }
                    markUpdateNoticeTime();
                    CustomDialogUtils.showCustomDialog(
                        barrierColor: Color.fromRGBO(0, 0, 0, 0.5f),
                        child: new CustomAlertDialog(
                            null,
                            message: versionResponse.changeLog,
                            new List <Widget> {
                        new CustomButton(
                            child: new Center(
                                child: new Text(
                                    "稍后再说",
                                    style: CTextStyle.PLargeBody5.defaultHeight(),
                                    textAlign: TextAlign.center
                                    )
                                ),
                            onPressed: CustomDialogUtils.hiddenCustomDialog
                            ),
                        new CustomButton(
                            child: new Center(
                                child: new Text(
                                    "立即更新",
                                    style: CTextStyle.PLargeBlue.defaultHeight(),
                                    textAlign: TextAlign.center
                                    )
                                ),
                            onPressed: () => {
                            CustomDialogUtils.hiddenCustomDialog();
                            Application.OpenURL(url: versionResponse.url);
                        }
                            )
                    },
                            new Stack(
                                children: new List <Widget> {
                        Image.asset("image/updaterBg"),
                        new Align(
                            alignment: Alignment.bottomCenter,
                            child: new Container(height: 1, color: CColors.White)
                            )
                    }
                                )
                            )
                        );
                }
                else
                {
                    if (type == CheckVersionType.setting)
                    {
                        var customSnackBar = new CustomSnackBar(
                            "当前是最新版本",
                            color: CColors.TextBody
                            );
                        customSnackBar.show();
                    }
                }
            })
            .Catch(error => {
                if (type == CheckVersionType.setting)
                {
                    CustomDialogUtils.hiddenCustomDialog();
                }
            });
        }
Esempio n. 11
0
        public static void checkForUpdates(CheckVersionType type)
        {
            if (type == CheckVersionType.setting)
            {
                CustomDialogUtils.showCustomDialog(
                    child: new CustomLoadingDialog(message: "正在检查更新")
                    );
            }

            SettingApi.CheckNewVersion(platform: Config.platform, store: Config.store, $"{Config.versionCode}")
            .Then(versionResponse => {
                if (type == CheckVersionType.setting)
                {
                    CustomDialogUtils.hiddenCustomDialog();
                }

                var status = versionResponse.status;
                if (status == "NEED_UPDATE" && versionResponse.url.isNotEmpty())
                {
                    if (type == CheckVersionType.initialize && !needNoticeNewVersion())
                    {
                        return;
                    }

                    markUpdateNoticeTime();
                    CustomDialogUtils.showCustomDialog(
                        barrierColor: Color.fromRGBO(0, 0, 0, 0.5f),
                        child: new CustomAlertDialog(
                            "版本更新",
                            message: versionResponse.changeLog,
                            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();
                            Application.OpenURL(url: versionResponse.url);
                        }
                            )
                    }
                            )
                        );
                }
                else
                {
                    if (type == CheckVersionType.setting)
                    {
                        var customSnackBar = new CustomSnackBar(
                            "当前是最新版本",
                            color: CColors.TextBody
                            );
                        customSnackBar.show();
                    }
                }
            })
            .Catch(error => {
                if (type == CheckVersionType.setting)
                {
                    CustomDialogUtils.hiddenCustomDialog();
                }
            });
        }