【问题标题】:Flutter video background player instead of image backgroundFlutter 视频背景播放器代替图片背景
【发布时间】:2021-05-18 20:30:58
【问题描述】:

这是我的问题,我正在尝试实现视频背景播放器,而不是我尝试使用 gif 的图像背景,但渲染只有 256 种颜色。非常感谢,我一直在努力整合,但没有成功


class Login extends StatelessWidget {
static const your_client_id = '0000000000000000';
final FirebaseAuth _auth = FirebaseAuth.instance;
static const your_redirect_url =
'https://xxxxxxx.firebaseapp.com/__/auth/handler';

final GlobalKey<ScaffoldState> _scaffoldKey = new GlobalKey<ScaffoldState>();

@override
Widget build(BuildContext context) {
  return WillPopScope(
    child: Scaffold(

  backgroundColor: Colors.white,
  body: Container(
  constraints: BoxConstraints.expand(),
  decoration: BoxDecoration(
  image: DecorationImage(
  image: AssetImage("asset/images/bg.jpg"),
  fit: BoxFit.cover,
  )
  ),

试图用这段代码替换我的容器内容,我不知道这样做是否正确

Container(
 width: *screen width*,
 height: *screen height*,
 child: Stack(
   children: <Widget>[
     Center(
       child: Transform.scale(
         scale: 3.9, //change this number as needed
         AspectRatio(
           aspectRatio: _controller.value.aspectRatio,
           child: VideoPlayer(_controller),
         ),
       ),
     ),

【问题讨论】:

    标签: android flutter dart video-player


    【解决方案1】:

    您可以使用stack 让您的视频在循环播放时在后台播放,而您的另一个widget 位于stack 的顶部。

    这个人解决了请参考他的回答 https://stackoverflow.com/a/57763089/8572736

    【讨论】:

    • 我会在上面的代码中集成吗?剩下的代码是登录过程,谢谢
    • 抱歉没看懂你的问题,能再解释一下吗?
    • 我的意思是在我的容器中我想放置视频播放器,但它无法正常工作并出现错误
    • 你能分享错误吗?所以我可以帮你调试问题
    猜你喜欢
    • 2015-03-19
    • 1970-01-01
    • 1970-01-01
    • 2022-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-20
    相关资源
    最近更新 更多