I want to disply a image in flutter in an transparent dialog. I've set opaque
to false and used MaterialType.transparency
. When I open the dialog the background is black.
class ShowProfileImage extends ModalRoute<void> {
final String url;
@override
Duration get transitionDuration => Duration(milliseconds: 500);
@override
bool get opaque => false;
@override
bool get barrierDismissible => false;
@override
Color get barrierColor => Colors.black;
@override
String get barrierLabel => null;
@override
bool get maintainState => true;
VoidCallback onDeleteImage;
ShowProfileImage(String this.url);
@override
Widget buildPage(
BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
) {
// This makes sure that text and other content follows the material style
return Material(
type: MaterialType.transparency,
// make sure that the overlay content is not cut off
child: SafeArea(
child: InkWell(
onTap: () => Navigator.of(context).pop(),
child: Container(
height: double.infinity,
width: double.infinity,
color: Colors.transparent,
child: Center(
child: Container(
width: 300,
child: Image(image: NetworkImageWithRetry(url)))))),
),
);
}
}