Home > Software design >  Background image with Youtube Player in place
Background image with Youtube Player in place

Time:06-24

I have a page on my flutter app where I play a video from youtube. So the thing is that I want to have a background image on the whole page but for some reason the image doesnt appear. Can anyone please look at my code and tell me what am I doing wrong here


  @override
  Widget build(BuildContext context) {
    return YoutubePlayerBuilder(

    player: YoutubePlayer(
      controller: controller,
    ),
    builder: (context, player) {
         return Container(
          constraints: const BoxConstraints.expand(),
          decoration:  const BoxDecoration(
            image: DecorationImage(
                image: AssetImage('assets/images/9prosthetics-iStock1545696-copy2.png')
                ,  fit: BoxFit.fill),
          ),
          child: Scaffold(

          appBar:  AppBar(......

Thank you in Advance

CodePudding user response:

In scaffold add a background color

backgroundColor: Colors.transparent,

By default scaffold has a white background

Btw is good to add the image inside scaffold in a container and as the child of the container add a column and add the player inside the column

  • Related