我想在主屏幕上为图像实现英雄动画,同时在对话框的内容中呈现与对话框相同图像的AlertDialog小部件。
我希望演示文稿显示在下面的屏幕截图中。当我点击左下角的图像时,我想使用英雄动画和图像的嵌入式预览以及可以点击以关闭的透明覆盖层。
以下代码无法执行英雄动画。
class AlertDialogTest extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new Material(
child: new InkWell(
child: new Hero(
tag: "preview",
child: new Container(
alignment: FractionalOffset.bottomLeft,
child: new Image(
image: new AssetImage('assets/images/theater.png'),
),
),
),
onTap: () {
showDialog(
context: context,
child: new AlertDialog(
content: new Hero(
tag: "preview",
child: new Image(
image: new AssetImage('assets/images/theater.png'),
),
),
),
);
},
),
);
}
}
Run Code Online (Sandbox Code Playgroud)