Esempio n. 1
0
        Widget _buildEventDetail(BuildContext context, IEvent eventObj, EventType eventType, EventStatus eventStatus,
                                 bool isLoggedIn)
        {
//            if (eventObj.record.isEmpty() && eventStatus == EventStatus.past) {
//                return new Expanded(
//                    child: new Stack(
//                        children: new List<Widget> {
//                            new EventDetail(
//                                false,
//                                eventObj,
//                                this.widget.actionModel.openUrl,
//                                topWidget: new EventHeader(eventObj, eventType, eventStatus, isLoggedIn),
//                                titleKey: eventTitleKey
//                            ),
//                            new Positioned(
//                                left: 0,
//                                top: 0,
//                                right: 0,
//                                child: this._buildHeadTop(true, eventObj)
//                            )
//                        }
//                    )
//                );
//            }

            return(new Expanded(
                       child: new EventDetail(
                           false,
                           eventObj,
                           this.widget.actionModel.openUrl,
                           pushToUserDetail: this.widget.actionModel.pushToUserDetail,
                           titleKey: eventTitleKey
                           )
                       ));
        }
Esempio n. 2
0
        Widget _buildEventHeader(BuildContext context, IEvent eventObj, EventType eventType, EventStatus eventStatus,
                                 bool isLoggedIn)
        {
            if (isLoggedIn && eventStatus == EventStatus.past && eventObj.record.isNotEmpty())
            {
                return(new CustomVideoPlayer(
                           eventObj.record,
                           context,
                           this._buildHeadTop(false, eventObj),
                           isFullScreen => {
                    using (WindowProvider.of(context).getScope()) {
                        this.setState(() => { this._isFullScreen = isFullScreen; });
                    }
                },
                           eventObj.recordDuration
                           ));
            }

//            if (eventStatus == EventStatus.past && eventObj.record.isEmpty()) {
//                return new Container();
//            }

            return(new Stack(
                       children: new List <Widget> {
                new EventHeader(eventObj, eventType, eventStatus, isLoggedIn),
                new Positioned(
                    left: 0,
                    top: 0,
                    right: 0,
                    child: this._buildHeadTop(false, eventObj)
                    )
            }
                       ));
        }
        Widget _buildEventHeader(BuildContext context, IEvent eventObj, EventType eventType, EventStatus eventStatus,
                                 bool isLoggedIn)
        {
            if (isLoggedIn && eventStatus == EventStatus.past && eventObj.record.isNotEmpty())
            {
                if (eventObj.record.isNotEmpty() && !AVPlayerPlugin.isConfigPlayer && AVPlayerPlugin.isExistPlayer)
                {
                    AVPlayerPlugin.configVideoPlayer(eventObj.record, HttpManager.getCookie());
                    AVPlayerPlugin.showPlayer();
                    this._showPlayer = true;
                }

                return(new Container(
                           color: CColors.Black,
                           height: MediaQuery.of(this.context).size.width * 9 / 16
                           ));
            }

            return(new Stack(
                       children: new List <Widget> {
                new EventHeader(eventObj, eventType, eventStatus, isLoggedIn),
                new Positioned(
                    left: 0,
                    top: 0,
                    right: 0,
                    child: this._buildHeadTop(false, eventObj)
                    )
            }
                       ));
        }
Esempio n. 4
0
        public static object fetchEventDetail(string eventId, EventType eventType)
        {
            return(new ThunkAction <AppState>((dispatcher, getState) => {
                return EventApi.FetchEventDetail(eventId)
                .Then(eventObj => {
                    if (getState().loginState.isLoggedIn&& eventType == EventType.online)
                    {
                        dispatcher.dispatch(new StartFetchMessagesAction());
                        dispatcher.dispatch(fetchMessages(eventObj.channelId, "", true));
                    }

                    var userMap = new Dictionary <string, User> {
                        { eventObj.user.id, eventObj.user }
                    };
                    eventObj.hosts.ForEach(host => {
                        if (userMap.ContainsKey(host.id))
                        {
                            userMap[host.id] = host;
                        }
                        else
                        {
                            userMap.Add(host.id, host);
                        }
                    });
                    dispatcher.dispatch(new UserMapAction {
                        userMap = userMap
                    });
                    dispatcher.dispatch(new UserLicenseMapAction {
                        userLicenseMap = eventObj.userLicenseMap
                    });
                    if (getState().eventState.eventsDict.ContainsKey(eventObj.id))
                    {
                        var oldEventObj = getState().eventState.eventsDict[eventObj.id];
                        var newEventObj = eventObj;
                        newEventObj.userId = eventObj.user.id;
                        newEventObj.placeId = oldEventObj.placeId;
                        newEventObj.mode = oldEventObj.mode;
                        newEventObj.avatar = oldEventObj.avatar;
                        newEventObj.type = oldEventObj.type;
                        newEventObj.typeParam = oldEventObj.typeParam;
                        eventObj = newEventObj;
                    }

                    eventObj.isNotFirst = true;
                    dispatcher.dispatch(new FetchEventDetailSuccessAction {
                        eventObj = eventObj
                    });
                    dispatcher.dispatch(new SaveEventHistoryAction {
                        eventObj = eventObj, eventType = eventType
                    });
                })
                .Catch(error => {
                    dispatcher.dispatch(new FetchEventDetailFailedAction());
                    Debug.Log(error);
                });
            }));
        }
 Widget _buildEventDetail(BuildContext context, IEvent eventObj, EventType eventType, EventStatus eventStatus,
                          bool isLoggedIn)
 {
     return(new Expanded(
                child: new EventDetail(
                    false,
                    userLicenseDict: this.widget.viewModel.userLicenseDict,
                    eventObj: eventObj,
                    openUrl: this.widget.actionModel.openUrl,
                    this.widget.actionModel.browserImage,
                    pushToUserDetail: this.widget.actionModel.pushToUserDetail,
                    titleKey: eventTitleKey
                    )
                ));
 }
Esempio n. 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
//                                    }
//                                )
//                            )
//                        )
//                    }
//                )
//            );
        }
        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))
                    )
            }
                                   )
                               )
                           )
                       ));
        }