首页 > 解决方案 > 为什么在 Flutter 的 Chewie 视频中没有全屏应用更改主题?

问题描述

我已将自定义主题数据应用于 Chewie 视频,它工作正常,但在全屏播放视频时不起作用,它只是返回默认主题

@override
  Widget build(BuildContext context) {
    return Column(
      children: <Widget>[
        Expanded(
          child: Center(
            child: _chewieController != null &&
                    _chewieController.videoPlayerController.value.isInitialized
                ? Theme(
                    data: Theme.of(context).copyWith(
                      accentColor: kPrimaryColor,
                      backgroundColor: kLightPrimaryColor,
                      iconTheme: IconThemeData(color: kPrimaryColor),
                    ),
                    child: Chewie(
                      controller: _chewieController,
                    ),
                  )
                : Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: [
                      LoadingCircle(),
                      SizedBox(height: 20),
                      Text('Loading'),
                    ],
                  ),
          ),
        ),
      ],
    );
  }

标签: flutterflutter-layoutflutter-animationflutter-video-playerflutter-theme

解决方案


我发现现在工作的唯一方法是将主题添加到整个应用程序


推荐阅读