我试图使我的列表视图的项目在我的底部工作表滚动。我使它与DraggableScrollableSheet小部件,但有这个尴尬白色。有人能检查我的代码,并告诉我什么是错的?
onPressed: () {
showModalBottomSheet(
isDismissible: true,
isScrollControlled: true,
context: context,
shape: const RoundedRectangleBorder(
borderRadius: const BorderRadius.vertical(
top: Radius.circular(20),
)),
builder: (context) => DraggableScrollableSheet(
initialChildSize: 0.7,
minChildSize: 0.2,
maxChildSize: 0.75,
builder: (_, controller) => Container(
padding: const EdgeInsets.all(16),
child: ListView(
children: [
Image.network(
imageURl,
loadingBuilder: (context, child, loadingProgress) {
if (loadingProgress == null) return child;
return const CircularProgressIndicator();
},
errorBuilder: (context, error, stackTrace) =>
Text(errorMessage),
),
ListTile(
title: Text(
information1,
textAlign: TextAlign.justify,
),
),
ListTile(
title: Text(
information2,
textAlign: TextAlign.justify,
),
),
Padding(
padding: const EdgeInsets.all(10.0),
child: Container(
child: CupertinoButton.filled(
padding: EdgeInsets.all(15),
child: Text(information3),
onPressed: () async {
if (await canLaunch(linkURl)) {
await launch(
linkURl,
universalLinksOnly: true,
);
} else {
throw 'There was a problem to open the url.';
}
},
),
),
),
],
),
),
),
);
},
工作原理示例:
正如你在上面的视频中所看到的,在图片的顶部有一个令人尴尬的白色。是什么原因造成的?我该如何消除它?
谢谢!
1条答案
按热度按时间sulc1iza1#
DraggableScrollableSheet
小部件有一个名为expand
的属性,默认设置为“true”,您需要将其设置为expand = false
。