首页 > 解决方案 > 我如何在颤动中获得这种计时器类型的视频播放器?

问题描述

新手来了 当我像第一张图片一样单击开始按钮时,我希望能够使用计时器和所有东西来获得该播放器之类的东西。但是我怎么得到这个?在此处输入图像描述

在此处输入图像描述

标签: flutter

解决方案


您可以通过添加插件并像这样使用它来做到这一点:

Scaffold(
    appBar: AppBar(
      title: Text(widget.title),
    ),
    body: Center(
        child: CircularCountDownTimer(
          // Countdown duration in Seconds
          duration: 10,

          // Width of the Countdown Widget
          width: MediaQuery.of(context).size.width / 2,

          // Height of the Countdown Widget
          height: MediaQuery.of(context).size.height / 2,

          // Default Color for Countdown Timer
          color: Colors.white,

          // Filling Color for Countdown Timer
          fillColor: Colors.red,

          // Border Thickness of the Countdown Circle
          strokeWidth: 5.0,

          // Text Style for Countdown Text
          textStyle: TextStyle(
              fontSize: 22.0,
              color: Colors.black87,
              fontWeight: FontWeight.bold),

          // true for reverse countdown (max to 0), false for forward countdown (0 to max)
          isReverse: false,

          // Function which will execute when the Countdown Ends
          onComplete: () {
            // Here, do whatever you want
            print('Countdown Ended');
          },
        ))

推荐阅读