2

i want to put a card between an image and the rest of the page

so i used stack in listview builder but it doesn't give the expected result

what i want

enter image description here

what i get => https://i.sstatic.net/Oxy41.jpg

ListView.builder(
      itemCount: 1,
      itemBuilder: (context, i) {
        return Stack(
          children: <Widget>[
            first(_listviewurl, _listViewData[0], _listviewwe9t),
            Container(
              padding: EdgeInsets.all(40),
              child: Text(
                "News",
                style: TextStyle(
                    color: Colors.white,
                    fontWeight: FontWeight.bold,
                    fontSize: 32),
              ),
            ),
        Positioned(
        width: MediaQuery.of(context).size.width / 2.5,
        height: MediaQuery.of(context).size.height / 5,
        left: MediaQuery.of(context).size.width / 9,
        top: MediaQuery.of(context).size.height / 1.9,
        child: Card(
          semanticContainer: true,
          clipBehavior: Clip.antiAliasWithSaveLayer,
          shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.circular(20),
          ),
          child: Image.asset(
            "images/img1.jpg",
            fit: BoxFit.fill,
          ),
        ),
      ),
          ],
        );
      },
    ),

1 Answer 1

1

Because your card is in your listview and your listview's height is the same with your first Widget, you can add Container as parent widget of your Stack widget and set height for it:

Container(
  child: Stack(...)
)
Sign up to request clarification or add additional context in comments.

1 Comment

well thank you man .. the first time i post a question and get an answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.