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.
|
// A screen that allows users to take a picture using a given camera.
|
||||||
class DisplayPictureScreen extends StatelessWidget {
|
class DisplayPictureScreen extends StatefulWidget {
|
||||||
final String imagePath;
|
final String imagePath;
|
||||||
|
|
||||||
const DisplayPictureScreen({super.key, required this.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
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(title: const Text('Display the Picture')),
|
appBar: AppBar(title: const Text('Display the Picture')),
|
||||||
// The image is stored as a file on the device. Use the `Image.file`
|
// The image is stored as a file on the device. Use the `Image.file`
|
||||||
// constructor with the given path to display the image.
|
// 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