loading circular

This commit is contained in:
Valentin CZERYBA 2024-08-14 22:11:38 +02:00
parent e0bdc7a633
commit 30d485d0e7

View File

@ -54,14 +54,30 @@ class DisplayPictureScreen extends StatefulWidget {
// A widget that displays the picture taken by the user.
class DisplayPictureScreenState extends State<DisplayPictureScreen>
with ShowDescImageAdd, ShowErrorDialog {
with ShowDescImageAdd, ShowErrorDialog, TickerProviderStateMixin {
late AnimationController controller;
@override
void initState() {
controller = AnimationController(
/// [AnimationController]s can be created with `vsync: this` because of
/// [TickerProviderStateMixin].
vsync: this,
duration: const Duration(seconds: 5),
)..addListener(() {
setState(() {});
});
controller.repeat(reverse: false);
super.initState();
_getEventInfosFromImage();
}
@override
void dispose() {
controller.dispose();
super.dispose();
}
Future<void> displayError(String e) async {
print("problem gemini : ${e}");
showErrorDialog(context,
@ -128,10 +144,19 @@ class DisplayPictureScreenState extends State<DisplayPictureScreen>
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: SingleChildScrollView(
child: Column(children: <Widget>[
Image.file(File(widget.imagePath)),
Text("Analyse en cours...")
body: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: <Widget>[
Text(
'Analyse de l\'image en cours',
style: Theme.of(context).textTheme.titleLarge,
),
CircularProgressIndicator(
value: controller.value,
semanticsLabel: 'Loading progress',
),
])));
}
}