效果
![](https://img-blog.csdnimg.cn/20210702105000630.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM2MjM3MTY1,size_16,color_FFFFFF,t_70)
核心代码
void _showUpdateDialog(widgetContext) {
String content =
"1、更新内容更新内容更新内容更新内容更新内容更新内容更新内容;\n2、更新内容更新内容更新内容;\n3、更新内容更新内容更新内容更新内容更新内容\n4、更新更新内容更新内容更新内容更新内容更新内容更新更新更新更新更新。1、更新内容更新内容更新内容更新内容更新内容更新内容更新内容;\n2、更新内容更新内容更新内容;\n3、更新内容更新内容更新内容更新内容更新内容\n4、更新更新内容更新内容更新内容更新内容更新内容更新更新更新更新更新。";
showGeneralDialog(
context: context,
pageBuilder: (BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation) {
return Center(
child: Stack(
children: [
Container(
width: 320,
height: 344,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
color: Colors.white),
margin: EdgeInsetsDirectional.only(top: 64),
child: Center(
child: Column(
children: [
Container(
margin: EdgeInsetsDirectional.only(top: 80),
child: Text(
"发现新版本",
style: TextStyle(
fontSize: 20,
decoration: TextDecoration.none,
color: Color(0xff4079FF),
),
),
),
Container(
width: 272,
height: 132,
margin: EdgeInsetsDirectional.only(top: 8),
child: SingleChildScrollView(
child: Text(
content,
style: TextStyle(
fontSize: 12,
color: Color(0xff8D94A6),
decoration: TextDecoration.none),
),
),
),
Container(
width: 240,
height: 40,
alignment: Alignment.center,
margin: EdgeInsetsDirectional.only(top: 20),
decoration: BoxDecoration(
gradient: LinearGradient(colors: [
Color(0xFF73ACFF),
Color(0xFFF4079FF),
]),
borderRadius: BorderRadius.circular(24),
),
child: Text(
"立即更新",
style: TextStyle(
fontSize: 14,
color: Colors.white,
decoration: TextDecoration.none),
),
),
],
),
),
),
Container(
width: 320,
height: 144,
alignment: Alignment.center,
child: Image.asset(
"assets/images/icon_update.png",
width: 144,
height: 144,
),
),
],
));
});
}