ListView.builder() 破坏了我应用程序的整个页面。我究竟做错了什么?

ListView.builder() breaking the whole page of my app. What am I doing wrong?

当我使用 .builder() 方法实现 ListView class 时,我的应用程序中断并且不会在该页面上显示任何内容。

这是我实现 ListView 的方式

Column(children: <Widget>[
  ListView.builder(
    itemCount: profileListItems.length,
    itemBuilder: (BuildContext context, int index) {
      ProfileListItem profileListItem = profileListItems[index];
      return InkWell(
        onTap: () {},
        child: Padding(
          padding: const EdgeInsets.all(12.0),
          child: Row(
            children: <Widget>[
              Stack(
                children: <Widget>[
                  ClipRRect(
                    borderRadius: BorderRadius.circular(28.0),
                    child: Container(
                       height: 50.0,
                       width: 50.0,
                       color: Theme.of(context).primaryColor,
                       child: profileListItem.icon
                     ),
                   ),
                 ],
               ),
               SizedBox(width: 16),
               Text(
                 profileListItem.text,
                 style: TextStyle(
                   color: Colors.black87,
                   fontWeight: FontWeight.bold,
                   fontSize: 16
                 ),
               )
             ],
           ),
         ),
       );
     }
   )
])

这是我的 ProfileListItem class

import 'package:flutter/material.dart';

class ProfileListItem {
  Icon icon;
  String text;
  String navigation;

  ProfileListItem({
    this.icon,
    this.text,
    this.navigation,
  });
}

List<ProfileListItem> profileListItems = [
  ProfileListItem(
    icon: Icon(
      Icons.dashboard,
      color: Colors.white,
      size: 24.0,
    ),
    text: 'Dashoard',
    navigation: 'Italy',
  )
];

当我添加 ListView class 时,页面上的所有其他小部件也会消失。只是一个白屏。

也许您可以使用扩展小部件作为列表视图的父级

Column(
 children: <Widget>[
Expanded(
child: ListView.builder(
shrinkWrap: true,
itemCount: ordersList.length,// Your List
itemBuilder: (context, index) {
// Followed by your return widget.
})),
]
)

如果您不想使用完整的 space,您可以删除展开的,只保留 shrinkWrap: true, 参数。