Exemplo n.º 1
0
        public override void initState()
        {
            base.initState();
            StatusBarManager.statusBarStyle(true);
            this._showNavBarShadow   = true;
            this._isHaveTitle        = false;
            this._titlePosition      = 0.0f;
            this._playButtonPosition = 0.0f;
            this._aspectRatio        = 16.0f / 9;
            if (CCommonUtils.isAndroid)
            {
                this._aspectRatio = 3f / 2;
            }

            this._controller = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            var rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, 44, 0, 0),
                RelativeRect.fromLTRB(0, 0, 0, 0)
                );

            this._animation = rectTween.animate(this._controller);
            // SchedulerBinding.instance.addPostFrameCallback(_ => {
            //     this.widget.actionModel.startFetchGameDetail();
            //     this.widget.actionModel.fetchGameDetail();
            // });
        }
Exemplo n.º 2
0
        public override void initState()
        {
            base.initState();
            StatusBarManager.statusBarStyle(false);
            this._favoriteInfoHeight    = 0;
            this._favoriteArticleOffset = 0;
            this._isHaveTitle           = false;
            this._controller            = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            RelativeRectTween rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, 44, 0, 0),
                RelativeRect.fromLTRB(0, 13, 0, 0)
                );

            this._animation = rectTween.animate(parent: this._controller);
            SchedulerBinding.instance.addPostFrameCallback(_ => {
                this.widget.actionModel.startFetchFavoriteDetail();
                this.widget.actionModel.fetchFavoriteDetail(arg1: this.widget.viewModel.tagId, 0);
            });
            WidgetsBinding.instance.addPostFrameCallback(_ => {
                var renderBox        = (RenderBox)this._favoriteInfoKey.currentContext.findRenderObject();
                var favoriteInfoSize = renderBox.size;
                if (this._favoriteInfoHeight != favoriteInfoSize.height)
                {
                    this.setState(() => this._favoriteInfoHeight = favoriteInfoSize.height);
                }
            });
        }
        public override void initState()
        {
            base.initState();
            StatusBarManager.statusBarStyle(true);
            this._showNavBarShadow = true;
            this._isHaveTitle      = false;
            this._titleHeight      = 0.0f;
            this._aspectRatio      = 16.0f / 9;
            if (Application.platform != RuntimePlatform.Android)
            {
                this._aspectRatio = 3f / 2;
            }

            this._controller = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            RelativeRectTween rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, 44, 0, 0),
                RelativeRect.fromLTRB(0, 13, 0, 0)
                );

            this._animation = rectTween.animate(this._controller);
            SchedulerBinding.instance.addPostFrameCallback(_ => {
                this.widget.actionModel.startFetchEventDetail();
                this.widget.actionModel.fetchEventDetail(this.widget.viewModel.eventId, EventType.offline);
            });
            this._loginSubId = EventBus.subscribe(EventBusConstant.login_success, args => {
                this.widget.actionModel.startFetchEventDetail();
                this.widget.actionModel.fetchEventDetail(this.widget.viewModel.eventId, EventType.offline);
            });
        }
        public override void initState()
        {
            base.initState();
            this._showNavBarShadow = true;
            this._titleHeight      = 0.0f;
            this._isHaveTitle      = false;
            this._controller       = new AnimationController(
                duration: new TimeSpan(0, 0, 0, 0, 300),
                vsync: this
                );
            this._titleAnimationController = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            RelativeRectTween rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, 44, 0, 0),
                RelativeRect.fromLTRB(0, 13, 0, 0)
                );

            this._titleAnimation = rectTween.animate(this._titleAnimationController);
            SchedulerBinding.instance.addPostFrameCallback(_ => {
                this.widget.actionModel.showChatWindow(false);
                this.widget.actionModel.startFetchEventDetail();
                this.widget.actionModel.fetchEventDetail(this.widget.viewModel.eventId, EventType.online);
            });
            this._loginSubId = EventBus.subscribe(EventBusConstant.login_success, args => {
                this.widget.actionModel.startFetchEventDetail();
                this.widget.actionModel.fetchEventDetail(this.widget.viewModel.eventId, EventType.online);
            });
        }
Exemplo n.º 5
0
        public override void initState()
        {
            base.initState();
            this._refreshController = new RefreshController();
            this._isHaveTitle       = false;
            this._titleHeight       = 0.0f;
            this._controller        = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            RelativeRectTween rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, navBarHeight, 0, 0),
                RelativeRect.fromLTRB(0, 13, 0, 0)
                );

            this._animation = rectTween.animate(this._controller);
            SchedulerBinding.instance.addPostFrameCallback(_ => {
                this.widget.actionModel.startFetchArticleDetail();
                this.widget.actionModel.fetchArticleDetail(this.widget.viewModel.articleId);
            });
            this._loginSubId = EventBus.subscribe(EventBusConstant.login_success, args => {
                this.widget.actionModel.startFetchArticleDetail();
                this.widget.actionModel.fetchArticleDetail(this.widget.viewModel.articleId);
            });
            this._jumpState             = _ArticleJumpToCommentState.Inactive;
            this._cachedCommentPosition = null;
        }
Exemplo n.º 6
0
        public override void initState()
        {
            base.initState();
            StatusBarManager.statusBarStyle(true);
            this._articlePageNumber     = 1;
            this._favoriteArticleOffset = 0;
            this._refreshController     = new RefreshController();
            this._isHaveTitle           = false;
            this._hideNavBar            = true;
            this._isShowTop             = false;
            this._selectedIndex         = 0;
            this._controller            = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            RelativeRectTween rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, top: navBarHeight, 0, 0),
                RelativeRect.fromLTRB(0, 0, 0, 0)
                );

            this._animation = rectTween.animate(parent: this._controller);
            SchedulerBinding.instance.addPostFrameCallback(_ => {
                this.widget.actionModel.startFetchUserProfile();
                this.widget.actionModel.fetchUserProfile();
                this.widget.actionModel.startFetchUserArticle();
                this.widget.actionModel.startFetchUserFavorite();
            });
        }
Exemplo n.º 7
0
        public override void initState()
        {
            base.initState();
            StatusBarManager.statusBarStyle(true);
            this._articleOffset     = 0;
            this._refreshController = new RefreshController();
            this._isHaveTitle       = false;
            this._hideNavBar        = true;
            this._controller        = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            RelativeRectTween rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, 44, 0, 0),
                RelativeRect.fromLTRB(0, 0, 0, 0)
                );

            this._animation = rectTween.animate(this._controller);
            SchedulerBinding.instance.addPostFrameCallback(_ => {
                this.widget.actionModel.startFetchTeam();
                this.widget.actionModel.fetchTeam();
                this.widget.actionModel.startFetchTeamArticle();
                this.widget.actionModel.fetchTeamArticle(0);
            });
        }
Exemplo n.º 8
0
        private void ShowContextMenu(BuildContext context)
        {
            if (!GameObject.Find("Panel").GetComponent <UIClickProperty>().IsMRBClicked)
            {
                return;
            }
            using (WindowProvider.of(GameObject.Find("Panel")).getScope())
            {
                PopupMenuUtils.showMenu <MenuItem>(
                    context,
                    RelativeRect.fromLTRB(Input.mousePosition.x, Screen.height - Input.mousePosition.y,
                                          Screen.width - Input.mousePosition.x, Input.mousePosition.y),
                    new List <PopupMenuEntry <MenuItem> >
                {
                    new PopupMenuItem <MenuItem>(
                        value: MenuItem.LoadPreview,
                        child: new Text("Load Preview")
                        )
                },
                    initialValue: MenuItem.LoadPreview
                    ).Then(x =>
                {
                    try
                    {
                        var token = (MenuItem)x;
                        switch (token)
                        {
                        case MenuItem.LoadPreview:
                            var builder = GameObject.Find("MMDRenderer")
                                          .GetComponent <PreviewBuilder.PreviewBuilder>();
                            builder.StartRender(_mmdObject);
                            break;

                        default:
                            throw new ArgumentOutOfRangeException();
                        }
                    }
                    catch
                    {
                        // ignored
                    }
                });
            }
        }
        public override void initState()
        {
            base.initState();
            StatusBarManager.statusBarStyle(false);
            this._pageNumber        = 1;
            this._refreshController = new RefreshController();
            this._controller        = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            RelativeRectTween rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, 44, 0, 0),
                RelativeRect.fromLTRB(0, 13, 0, 0)
                );

            this._animation = rectTween.animate(parent: this._controller);
            SchedulerBinding.instance.addPostFrameCallback(_ => {
                this.widget.actionModel.startFetchDetailList();
                this.widget.actionModel.fetchDetailList(this._pageNumber);
            });
        }
        public override void initState()
        {
            base.initState();
            StatusBarManager.statusBarStyle(false);
            this._showNavBarShadow = true;
            this._isHaveTitle      = false;
            this._controller       = new AnimationController(
                duration: new TimeSpan(0, 0, 0, 0, 300),
                vsync: this
                );
            this._titleAnimationController = new AnimationController(
                duration: TimeSpan.FromMilliseconds(100),
                vsync: this
                );
            RelativeRectTween rectTween = new RelativeRectTween(
                RelativeRect.fromLTRB(0, 44, 0, 0),
                RelativeRect.fromLTRB(0, 13, 0, 0)
                );

            this._titleAnimation = rectTween.animate(this._titleAnimationController);
            SchedulerBinding.instance.addPostFrameCallback(_ => {
                AVPlayerPlugin.initVideoPlayer("", "",
                                               0, (int)MediaQuery.of(this.context).padding.top, MediaQuery.of(this.context).size.width,
                                               MediaQuery.of(this.context).size.width * 9 / 16, true);
                AVPlayerPlugin.hiddenPlayer();
                this.widget.actionModel.showChatWindow(false);
                this.widget.actionModel.startFetchEventDetail();
                this.widget.actionModel.fetchEventDetail(this.widget.viewModel.eventId, EventType.online);
            });
            this._loginSubId = EventBus.subscribe(EventBusConstant.login_success, args => {
                this.widget.actionModel.startFetchEventDetail();
                this.widget.actionModel.fetchEventDetail(this.widget.viewModel.eventId, EventType.online);
            });
            this._shareActionSubId = EventBus.subscribe(EventBusConstant.shareAction, args => {
                if (this.widget.viewModel.eventsDict.ContainsKey(this.widget.viewModel.eventId))
                {
                    this._showShareView(this.widget.viewModel.eventsDict[this.widget.viewModel.eventId]);
                }
            });
        }
Exemplo n.º 11
0
        Widget _buildStack(BuildContext context, BoxConstraints constraints)
        {
            Animation <RelativeRect> frontRelativeRect = this._controller.drive(new RelativeRectTween(
                                                                                    begin: RelativeRect.fromLTRB(0.0f, constraints.biggest.height - BackdropConstants._kFrontClosedHeight,
                                                                                                                 0.0f, 0.0f),
                                                                                    end: RelativeRect.fromLTRB(0.0f, BackdropConstants._kBackAppBarHeight, 0.0f, 0.0f)
                                                                                    ));

            List <Widget> layers = new List <Widget> {
                new Column(
                    crossAxisAlignment: CrossAxisAlignment.stretch,
                    children: new List <Widget> {
                    new _BackAppBar(
                        leading: this.widget.frontAction,
                        title: new _CrossFadeTransition(
                            progress: this._controller,
                            alignment: Alignment.centerLeft,
                            child0: this.widget.frontTitle,
                            child1: this.widget.backTitle
                            ),
                        trailing: new IconButton(
                            onPressed: this._toggleFrontLayer,
                            tooltip: "Toggle options page",
                            icon: new AnimatedIcon(
                                icon: AnimatedIcons.close_menu,
                                progress: this._controller
                                )
                            )
                        ),
                    new Expanded(
                        child: new Visibility(
                            child: this.widget.backLayer,
                            visible: this._controller.status != AnimationStatus.completed,
                            maintainState: true
                            )
                        )
                }
                    ),
                new PositionedTransition(
                    rect: frontRelativeRect,
                    child: new AnimatedBuilder(
                        animation: this._controller,
                        builder: (BuildContext _context, Widget child) => {
                    return(new PhysicalShape(
                               elevation: 12.0f,
                               color: Theme.of(_context).canvasColor,
                               clipper: new ShapeBorderClipper(
                                   shape: new BeveledRectangleBorder(
                                       borderRadius: BackdropConstants._kFrontHeadingBevelRadius.evaluate(
                                           this._controller)
                                       )
                                   ),
                               clipBehavior: Clip.antiAlias,
                               child: child
                               ));
                },
                        child: new _TappableWhileStatusIs(
                            AnimationStatus.completed,
                            controller: this._controller,
                            child: new FadeTransition(
                                opacity: this._frontOpacity,
                                child: this.widget.frontLayer
                                )
                            )
                        )
                    )
            };

            if (this.widget.frontHeading != null)
            {
                layers.Add(
                    new PositionedTransition(
                        rect: frontRelativeRect,
                        child: new Container(
                            alignment: Alignment.topLeft,
                            child: new GestureDetector(
                                behavior: HitTestBehavior.opaque,
                                onTap: this._toggleFrontLayer,
                                onVerticalDragUpdate: this._handleDragUpdate,
                                onVerticalDragEnd: this._handleDragEnd,
                                child: this.widget.frontHeading
                                )
                            )
                        )
                    );
            }

            return(new Stack(
                       key: this._backdropKey,
                       children: layers
                       ));
        }
Exemplo n.º 12
0
        public override Widget build(BuildContext context)
        {
            LayerLink layerLink          = null;
            TextSelectionHandleType type = TextSelectionHandleType.left;

            switch (widget.position)
            {
            case _TextSelectionHandlePosition.start:
                layerLink = widget.startHandleLayerLink;
                type      = _chooseType(
                    widget.renderObject.textDirection,
                    TextSelectionHandleType.left,
                    TextSelectionHandleType.right
                    );
                break;

            case _TextSelectionHandlePosition.end:
                D.assert(!widget.selection.isCollapsed);
                layerLink = widget.endHandleLayerLink;
                type      = _chooseType(
                    widget.renderObject.textDirection,
                    TextSelectionHandleType.right,
                    TextSelectionHandleType.left
                    );
                break;
            }

            Offset handleAnchor = widget.selectionControls.getHandleAnchor(
                type,
                widget.renderObject.preferredLineHeight
                );
            Size handleSize = widget.selectionControls.getHandleSize(
                widget.renderObject.preferredLineHeight
                );

            Rect handleRect = Rect.fromLTWH(
                -handleAnchor.dx,
                -handleAnchor.dy,
                handleSize.width,
                handleSize.height
                );

            Rect interactiveRect = handleRect.expandToInclude(
                Rect.fromCircle(center: handleRect.center, radius: kMinInteractiveDimension / 2)
                );
            RelativeRect padding = RelativeRect.fromLTRB(
                Mathf.Max((interactiveRect.width - handleRect.width) / 2, 0),
                Mathf.Max((interactiveRect.height - handleRect.height) / 2, 0),
                Mathf.Max((interactiveRect.width - handleRect.width) / 2, 0),
                Mathf.Max((interactiveRect.height - handleRect.height) / 2, 0)
                );

            return(new CompositedTransformFollower(
                       link: layerLink,
                       offset: interactiveRect.topLeft,
                       showWhenUnlinked: false,
                       child: new FadeTransition(
                           opacity: _opacity,
                           child: new Container(
                               alignment: Alignment.topLeft,
                               width: interactiveRect.width,
                               height: interactiveRect.height,
                               child: new GestureDetector(
                                   behavior: HitTestBehavior.translucent,
                                   dragStartBehavior: widget.dragStartBehavior,
                                   onPanStart: _handleDragStart,
                                   onPanUpdate: _handleDragUpdate,
                                   onTap: _handleTap,
                                   child: new Padding(
                                       padding: EdgeInsets.only(
                                           left: padding.left,
                                           top: padding.top,
                                           right: padding.right,
                                           bottom: padding.bottom
                                           ),
                                       child: widget.selectionControls.buildHandle(context, type,
                                                                                   widget.renderObject.preferredLineHeight)
                                       )
                                   )
                               )
                           )
                       ));
        }
Exemplo n.º 13
0
        Animation <RelativeRect> _getLayerAnimation(Size layerSize, float layerTop)
        {
            Curve             firstCurve;
            Curve             secondCurve;
            float             firstWeight;
            float             secondWeight;
            Animation <float> animation;

            if (_frontLayerVisible)
            {
                firstCurve   = backdropUtils._kAccelerateCurve;
                secondCurve  = backdropUtils._kDecelerateCurve;
                firstWeight  = backdropUtils._kPeakVelocityTime;
                secondWeight = 1.0f - backdropUtils._kPeakVelocityTime;
                animation    = new CurvedAnimation(
                    parent: _controller.view,
                    curve: new Interval(0.0f, 0.78f)
                    );
            }
            else
            {
                firstCurve   = backdropUtils._kDecelerateCurve.flipped;
                secondCurve  = backdropUtils._kAccelerateCurve.flipped;
                firstWeight  = 1.0f - backdropUtils._kPeakVelocityTime;
                secondWeight = backdropUtils._kPeakVelocityTime;
                animation    = _controller.view;
            }

            return(new TweenSequence <RelativeRect>(
                       new List <TweenSequenceItem <RelativeRect> > {
                new TweenSequenceItem <RelativeRect>(
                    tween: new RelativeRectTween(
                        begin: RelativeRect.fromLTRB(
                            0.0f,
                            layerTop,
                            0.0f,
                            layerTop - layerSize.height
                            ),
                        end: RelativeRect.fromLTRB(
                            0.0f,
                            layerTop * backdropUtils._kPeakVelocityProgress,
                            0.0f,
                            (layerTop - layerSize.height) * backdropUtils._kPeakVelocityProgress
                            )
                        ).chain(new CurveTween(curve: firstCurve)),
                    weight: firstWeight
                    ),
                new TweenSequenceItem <RelativeRect>(
                    tween: new RelativeRectTween(
                        begin: RelativeRect.fromLTRB(
                            0.0f,
                            layerTop * backdropUtils._kPeakVelocityProgress,
                            0.0f,
                            (layerTop - layerSize.height) * backdropUtils._kPeakVelocityProgress
                            ),
                        end: RelativeRect.fill
                        ).chain(new CurveTween(curve: secondCurve)),
                    weight: secondWeight
                    ),
            }
                       ).animate(animation));
        }
Exemplo n.º 14
0
        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)
                        )
                    ),
            }
                           )
                       ));
        }