简体   繁体   中英

Create ListView Flutter

im new in flutter, and im trying to create a listView Like this photo in my app: 描述颤动

this is my code:

return Scaffold(
      body: Container(
        child: Column(
          children: <Widget>[
            Align(
              alignment: Alignment.topRight,
              child: Container(
                child: const Text(
                  ':الآن',
                  style: TextStyle(
                    fontSize: 20,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
            ),
            const SizedBox(
              height: 4,
            ),
            Align(
                alignment: Alignment.center,
                child: Card(
                  semanticContainer: true,
                  clipBehavior: Clip.antiAliasWithSaveLayer,
                  shape: RoundedRectangleBorder(
                    borderRadius: BorderRadius.circular(10.0),
                  ),
                  elevation: 5,
                  margin: const EdgeInsets.all(8),
                  child: Image.asset(
                    'assets/aire.jpeg',
                    fit: BoxFit.fill,
                  ),
                )),
            const SizedBox(
              height: 4,
              
            ),
            Align(
              alignment: Alignment.topRight,
              child: Container(
                child: const Text(
                  ':آخر الأخبـار',
                  style: TextStyle(
                    fontSize: 20,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );

My probleme is when i use the ListView.builder, Or ListTitle, all the views in the top disappear. how can i solve it, Thanks

Wrap your ListView with Expanded to get available height inside column.

  body: Container(
    child: Column(
      children: <Widget>[
    .....
          Expanded(
             child: ListView( ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM