separate cass displayscreenstate

This commit is contained in:
Valentin CZERYBA 2024-07-08 23:01:07 +02:00
parent 3ad8eb9033
commit 216c403625

View File

@ -34,19 +34,25 @@ class MyApp extends StatelessWidget {
}
}
// A widget that displays the picture taken by the user.
class DisplayPictureScreen extends StatelessWidget {
// A screen that allows users to take a picture using a given camera.
class DisplayPictureScreen extends StatefulWidget {
final String imagePath;
const DisplayPictureScreen({super.key, required this.imagePath});
@override
DisplayPictureScreenState createState() => DisplayPictureScreenState();
}
// A widget that displays the picture taken by the user.
class DisplayPictureScreenState extends State<DisplayPictureScreen> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Display the Picture')),
// The image is stored as a file on the device. Use the `Image.file`
// constructor with the given path to display the image.
body: Image.file(File(imagePath)),
body: Image.file(File(widget.imagePath)),
);
}
}