1

I'm flutter begginner. I tried to make a listview and make some containers and text widgets. but there's only text widget and don't appear containers that have images. Could you review where's some problems in code below.


class  DonatePage extends StatelessWidget {
  const DonatePage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body:
            ListView(
            scrollDirection: Axis.vertical,
            reverse: true,
            addAutomaticKeepAlives: false,

            children: [
              Column(
                children: [
                  Container(
                    width: double.infinity,
                    height: 400,
                    decoration: BoxDecoration(
                        image: DecorationImage(
                            image: AssetImage("assets/images/components/shop/donate/card2.png")
                        )
                    ),
                  ),
                  Text("Campaign of the week"),
                  Container(
                    width: double.infinity,
                    height: 400,
                    decoration: BoxDecoration(
                        image: DecorationImage(
                            image: AssetImage("assets/images/components/shop/donate/card1.png")
                        )
                    ),
                  ),
                  Text("for good"),
                  Container(
                    width: double.infinity,
                    height: 400,
                    decoration: BoxDecoration(
                        image: DecorationImage(
                            image: AssetImage("assets/images/components/shop/donate/card3.png")
                        )
                    ),
                  ),
                ]
              )
            ],
            ),
    );
  }
}

Problems Screenshots below.

enter image description here

enter image description here enter image description here enter image description here

4
  • 2
    You are probably not calling the images properly, share your pubspec.yaml and a screenshot of your folder structure where you put your images. Commented Sep 26, 2022 at 7:11
  • @Denzel Thanks.I attached pictures above. Could check that please? I put the images in container that in donate folder in assets folder, and I put that in pubspec.yaml and did pub get but they're not loaded. Commented Sep 26, 2022 at 7:19
  • oh I did not attached '/' in the path. Thanks..!! Commented Sep 26, 2022 at 7:21
  • @Denzel Do you know why the path 'assets/' can't load asset's below folders and have to write the path like 'assets/a/b/c' when I want to load c? Commented Sep 26, 2022 at 7:23

1 Answer 1

1

Please add folder path like this:

  • assets/images/components/shop/donate/
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.