separate cass displayscreenstate
This commit is contained in:
parent
3ad8eb9033
commit
216c403625
@ -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)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user