Exemple #1
0
        static Widget renderLoading()
        {
            List <string> images = new List <string>();

            for (int index = 1; index < 2; index++)
            {
                images.Add($"image/refresh-loading/refresh-loading{index}");
            }

            Widget child = new AnimatedCrossFade(
                firstChild: new Container(),
                secondChild: new FrameAnimationImage(
                    images: images
                    ),
                duration: TimeSpan.FromMilliseconds(300),
                crossFadeState: CrossFadeState.showSecond,
                alignment: Alignment.center,
                layoutBuilder: _layoutBuilder
                );

            return(new Container(
//                height: 56.0f,
                       alignment: Alignment.center,
                       child: child
                       ));
        }
        Widget _buildOther()
        {
            CrossFadeState?crossFadeState = null;
            string         refreshText    = "";

            if (this.mode == 0 || this.mode == 1)
            {
                refreshText    = "探索新鲜内容";
                crossFadeState = CrossFadeState.showFirst;
            }

            if (this.mode == 2)
            {
                crossFadeState = CrossFadeState.showSecond;
            }

            if (this.mode == 3)
            {
                refreshText    = "刷新成功";
                crossFadeState = CrossFadeState.showFirst;
            }

            if (this.mode == 4)
            {
                refreshText    = "刷新失败";
                crossFadeState = CrossFadeState.showFirst;
            }

            Widget child = new AnimatedCrossFade(
                firstChild: _buildText(text: refreshText),
                secondChild: Image.asset(
                    "image/loading.gif",
                    width: 235,
                    height: 40,
                    filterMode: FilterMode.Point
                    ),
                duration: TimeSpan.FromMilliseconds(500),
                crossFadeState: crossFadeState,
                alignment: Alignment.center
                );

            return(new Container(
                       height: 56.0f,
                       alignment: Alignment.center,
                       child: child
                       ));
        }
        Widget _buildOther()
        {
            CrossFadeState?crossFadeState;
            string         refreshText;
            AnimatingType  type;

            switch (this.mode)
            {
            case 0: {
                refreshText    = "探索新鲜内容";
                type           = AnimatingType.stop;
                crossFadeState = CrossFadeState.showFirst;
                break;
            }

            case 1: {
                refreshText    = "探索新鲜内容";
                type           = AnimatingType.stop;
                crossFadeState = CrossFadeState.showFirst;
                break;
            }

            case 2: {
                refreshText    = "";
                type           = AnimatingType.repeat;
                crossFadeState = CrossFadeState.showSecond;
                break;
            }

            case 3: {
                refreshText    = "刷新成功";
                type           = AnimatingType.stop;
                crossFadeState = CrossFadeState.showFirst;
                break;
            }

            case 4: {
                refreshText    = "刷新失败";
                type           = AnimatingType.stop;
                crossFadeState = CrossFadeState.showFirst;
                break;
            }

            default: {
                refreshText    = "";
                type           = AnimatingType.stop;
                crossFadeState = null;
                break;
            }
            }

            List <string> images = new List <string>();

            for (int index = 0; index < 237; index++)
            {
                images.Add($"image/refresh-loading/refresh-loading{index}");
            }

            Widget child = new AnimatedCrossFade(
                firstChild: _buildText(text: refreshText),
                secondChild: new FrameAnimationImage(
                    images: images,
                    type: type
                    ),
                duration: TimeSpan.FromMilliseconds(300),
                crossFadeState: crossFadeState,
                alignment: Alignment.center,
                layoutBuilder: _layoutBuilder
                );

            return(new Container(
                       height: 56.0f,
                       alignment: Alignment.center,
                       child: child
                       ));
        }