Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
236 views
in Technique[技术] by (71.8m points)

Flutter Screen Blinking on ScaleTransition

enter image description here

I'm having this issue when i Implement flutter Youtube Video Player but if i remove video player then everything working perfectly. I also try to implement video player with listview then this error doesn't appear. It's strange behavior for me. I try to find this issue on google but didn't find anything related to my issue.

Here's my code

Widget dashboard({context}) {
    var myscreen = MediaQuery.of(context);
    return WillPopScope(
      onWillPop: () async => backPressed(),
      child: AnimatedPositioned(
        top: 0,
        bottom: 0,
        left: isCollapsed ? 0 : 0.5 * myscreen.size.width,
        right: isCollapsed ? 0 : -0.4 * myscreen.size.width,
        duration: animationDuration,
        child: ScaleTransition(
          scale: _scaleAnimation,
          child: Material(
            borderRadius: isCollapsed
                ? BorderRadius.circular(0)
                : BorderRadius.circular(40),
            elevation: 8,
            color: appbarcolor,
            child: SafeArea(
              child: Container(
                height: myscreen.size.height,
                width: myscreen.size.width,
                child: Column(
                  children: <Widget>[
                    Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      mainAxisSize: MainAxisSize.max,
                      children: <Widget>[
                        IconButton(
                          onPressed: menuButton,
                          icon: Icon(
                            isCollapsed ? Icons.menu : Icons.arrow_back_ios,
                          ),
                          iconSize: 27,
                        ),
                        RichText(
                          text: TextSpan(
                            text: "WisBig",
                            style: TextStyle(
                              color: Colors.green,
                              fontSize: 21,
                              fontWeight: FontWeight.bold,
                            ),
                            children: <TextSpan>[
                              TextSpan(
                                text: " Reward",
                                style: TextStyle(
                                  color: Colors.deepOrangeAccent,
                                  fontSize: 21,
                                  fontWeight: FontWeight.bold,
                                ),
                              ),
                            ],
                          ),
                        ),
                        IconButton(
                          icon: SvgPicture.asset(
                            "images/svg/bell.svg",
                            height: 23,
                            width: 23,
                          ),
                          onPressed: () {
                            MenuButtons(context: context).notiBTN();
                          },
                        ),
                      ],
                    ),
                    SingleChildScrollView(
                      scrollDirection: Axis.vertical,
                      physics: ScrollPhysics(),
                      child: Column(
                        mainAxisAlignment: MainAxisAlignment.start,
                        mainAxisSize: MainAxisSize.max,
                        children: <Widget>[
                          InkWell(
                            onTap: () {
                              String url = _slides[slideIndex].url;
                              MenuButtons(context: context)
                                  .slidesUrlOpener(url: url);
                            },
                            child: Container(
                              clipBehavior: Clip.antiAliasWithSaveLayer,
                              height: myscreen.size.height / 4.3,
                              margin: EdgeInsets.symmetric(
                                horizontal: sliderHorizatal,
                                vertical: sliderVertical,
                              ),
                              decoration: BoxDecoration(
                                borderRadius: BorderRadius.circular(12.0),
                              ),
                              child: isSlideLoaded
                                  ? new Swiper(
                                      controller: swiperController,
                                      onIndexChanged: (index) {
                                        slideIndex = index;
                                      },
                                      scrollDirection: Axis.horizontal,
                                      curve: Curves.easeIn,
                                      itemBuilder:
                                          (BuildContext context, int index) {
                                        return CachedNetworkImage(
                                          imageUrl: _slides[index].imageUrl,
                                          fit: BoxFit.fill,
                                        );
                                      },
                                      itemCount: _slides.length == 0
                                          ? 0
                                          : _slides.length,
                                      pagination: new SwiperPagination(),
                                      autoplay: true,
                                      autoplayDelay: 2000,
                                    )
                                  : Container(
                                      height: 150,
                                      width: double.infinity,
                                      margin: EdgeInsets.symmetric(
                                        horizontal: 20,
                                      ),
                                      child: circle(),
                                    ),
                            ),
                          ),
                          SizedBox(
                            height: 6,
                          ),
                          Container(
                            width: myscreen.size.width,
                            margin: EdgeInsets.symmetric(
                              horizontal: sliderHorizatal,
                            ),
                            decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(12.0),
                            ),
                            clipBehavior: Clip.antiAliasWithSaveLayer,
                            child: isSlideLoaded
                                ? YoutubePlayer(
                                    controller: YoutubePlayerController(
                                      initialVideoId:
                                          YoutubePlayer.convertUrlToId(
                                        youtubeList[0]['url'],
                                      ),
                                      flags: YoutubePlayerFlags(
                                        // hideControls: true,
                                        controlsVisibleAtStart: true,
                                        autoPlay: false,
                                        forceHD: false,
                                      ),
                                    ),
                                    showVideoProgressIndicator: true,
                                    progressIndicatorColor: Colors.white,
                                    progressColors: ProgressBarColors(
                                      playedColor: Colors.blue,
                                      handleColor: Colors.blueAccent,
                                    ),
                                  )
                                : circle(),
                          ),
                          SizedBox(
                            height: 6,
                          ),
                          Container(
                            margin: EdgeInsets.symmetric(
                              horizontal: cardsContainerHorizatal,
                              vertical: cardsContainerVertical,
                            ),
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceAround,
                              children: <Widget>[
                                cardView(
                                  image: card1[1],
                                  text: card1[0],
                                  button: MenuButtons(context: context).spinBTN,
                                  context: context,
                                ),
                                cardView(
                                  image: card2[1],
                                  text: card2[0],
                                  button: MenuButtons(context: context).postBTN,
                                  context: context,
                                ),
                              ],
                            ),
                          ),
                          SizedBox(
                            height: myscreen.size.height / 200,
                          ),
                          Container(
                            margin: EdgeInsets.symmetric(
                              horizontal: cardsContainerHorizatal,
                              vertical: cardsContainerVertical,
                            ),
                            child: Row(
                              mainAxisAlignment: MainAxisAlignment.spaceAround,
                              children: <Widget>[
                                cardView(
                                  image: card3[1],
                                  text: card3[0],
                                  button:
                                      MenuButtons(context: context).downloadBTN,
                                  context: context,
                                ),
                                cardView(
                                  image: card4[1],
                                  text: card4[0],
                                  button: MenuButtons(context: context).earnWis,
                                  context: context,
                                ),
                              ],
                            ),
                          ),
                        ],
                      ),
                    ),
                  ],
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
question from:https://stackoverflow.com/questions/65872070/flutter-screen-blinking-on-scaletransition

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...