flutter - 像谷歌日历一样颤动底页
解决方案
它可以通过使用堆栈小部件来实现
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: RaisedButton(
onPressed: () {
_settingModalBottomSheet();
},
child: Text('Show Bottom Sheet'),
),
),
);
}
void _settingModalBottomSheet() {
final double imageRadius = 50;
showModalBottomSheet(
context: context,
backgroundColor: Colors.transparent,
builder: (BuildContext bc) {
return Column(
mainAxisSize: MainAxisSize.min,
children: [
Stack(
children: [
Container(
margin: EdgeInsets.only(top: imageRadius),
padding: EdgeInsets.only(top: imageRadius),
decoration: BoxDecoration(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(16),
topRight: Radius.circular(16),
),
color: Colors.white,
),
child: Column(
children: [
Text('asdfsdf asdfasdf'),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
icon: Icon(Icons.message),
onPressed: () {},
),
SizedBox(
width: 16,
),
IconButton(
icon: Icon(Icons.message),
onPressed: () {},
),
SizedBox(
width: 16,
),
IconButton(
icon: Icon(Icons.message),
onPressed: () {},
)
],
),
],
),
),
Align(
alignment: Alignment.topCenter,
child: CircleAvatar(
radius: imageRadius,
),
),
],
)
],
);
},
);
}
}
推荐阅读
- vue.js - 在计算属性中使用地图时的意外行为
- google-apps-script - 在 Google 表单上提交显示链接以下载您的格式化回复
- javascript - 为什么拖动完成后输入框会阻塞
- docker - 运行.net核心应用程序时如何在docker中进行端口映射?
- python - 遍历字典 x 次
- python - 如何连接两个数组的对应值?
- c++ - 当字符串包含 %2C 时,C++ 中的 std::string 不完整
- java - Java中有没有办法按照固定的平均值和标准偏差生成随机数?
- javascript - 提交表单,其中输入是php中的数组
- postgresql - 无法使用命令行连接 Postgres