作者:小小的忧伤团_170 | 来源:互联网 | 2023-07-26 09:03
文档Exampleimportpackage:fluttermaterial.dart;voidmain()>runApp(MyApp());clas
Example
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: HomePage(),
);
}
}
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
Align(
alignment: Alignment.topCenter,
child: Image.network(
"https://i.loli.net/2019/11/30/auRxklc9f6TLgdE.jpg"),
),
DraggableScrollableSheet(
initialChildSize:
1.0, // 设置父容器的高度 1 ~ 0, initialChildSize必须 <= maxChildSize
minChildSize:
0.6, // 限制child最小高度, minChildSize必须 <= initialChildSize
maxChildSize: 1.0, // 限制child最大高度,
builder: (context, scrollController) {
return Container(
color: Colors.blue[100],
child: SingleChildScrollView(
controller: scrollController,
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Image.network(
"https://i.loli.net/2019/11/30/DVJGdj3eNpakXY4.jpg",
fit: BoxFit.cover,
),
),
for (var i = 0; i <25; i++)
ListTile(title: Text('Item $i'))
],
),
),
);
},
),
],
),
);
}
}