builder method
A function that builds the UI to be shown from the ViewModel - Required
viewModel
is the ViewModel passed in and child
is the staticChildBuilder result
Implementation
@override
Widget builder(
BuildContext context,
ImageViewModel viewModel,
Widget? child,
) {
return Scaffold(
body: Stack(
children: [
PhotoView(
imageProvider: NetworkImage(url),
),
if (imageDownloadButton)
Positioned(
top: 50,
right: 20,
child: IconButton(
onPressed: () {
viewModel.saveImage(context, url);
},
icon: CircleAvatar(
backgroundColor: Colors.grey.shade500,
child: const Icon(
Icons.download,
color: Colors.white,
),
),
),
),
// Positioned(
// top: 50,
// left: 20,
// child: IconButton(
// onPressed: () {
// Navigator.pop(context);
// },
// icon: const Icon(
// Icons.close,
// color: Colors.white,
// ),
// ),
// ),
],
),
);
}