user12986521
user12986521

Reputation:

How to implement an image background in flutter

I want to have a background Image, but don't know how to implement it , I wrote down the first part of my code, which I think , needed to solve my problem.

I need the solution in Dart (Flutter).I tried something with the DecoratedBox but it didn´t work, hope somebody can help me.

 @override
  Widget build(BuildContext context) {
    return SafeArea(
      child: Scaffold(
        // appBar: AppBar(title: Text('App',style: TextStyle(fontWeight: FontWeight.w900),),backgroundColor: Colors.brown[500],),
        body: Center(
          child: Padding(

Upvotes: 0

Views: 56

Answers (1)

Jim
Jim

Reputation: 7601

Try this:

  @override
  Widget build(BuildContext context){
    return Scaffold(
      body: Container(
        decoration: BoxDecoration(
          image: DecorationImage(
            image: NetworkImage(''),
            fit: BoxFit.cover,
          ),
        ),
        child: Container(),
      ),
    );
  }

Upvotes: 2

Related Questions