我正在我的 flutter 应用程序中实现 DraggableScrollableSheet,并希望有一个粘性标题,即只有列表视图滚动,并且工作表的顶部始终保持在原位。我的小部件看起来像这样:
SizedBox.expand(
child: DraggableScrollableSheet(
maxChildSize: 0.9,
minChildSize: 0.2,
initialChildSize: 0.3,
expand: false,
builder:
(BuildContext context, ScrollController scrollController) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(20),
topRight: Radius.circular(20),
)),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Align(
alignment: Alignment.topCenter,
child: Container(
margin: EdgeInsets.symmetric(vertical: 8),
height: 8.0,
width: 70.0,
decoration: BoxDecoration(
color: Colors.grey[400],
borderRadius: BorderRadius.circular(10.0)),
),
),
SizedBox(height: 16),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Text(
'Neuigkeiten',
style: TextStyle(
fontSize: 20, fontWeight: FontWeight.bold),
),
),
Padding(
padding: …Run Code Online (Sandbox Code Playgroud)