49 lines
1 KiB
Dart
49 lines
1 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
class AwaitLoading extends StatefulWidget {
|
|
const AwaitLoading({super.key});
|
|
|
|
@override
|
|
State<AwaitLoading> createState() => _AwaitLoadingState();
|
|
}
|
|
|
|
class _AwaitLoadingState extends State<AwaitLoading> {
|
|
String text = "";
|
|
|
|
Timer? t;
|
|
|
|
@override
|
|
void dispose() {
|
|
t?.cancel();
|
|
super.dispose();
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
t = Timer(Duration(seconds: 8), () {
|
|
if (context.mounted) {
|
|
setState(() {
|
|
text =
|
|
"Il semblerait qu'il y ait un problème. Vérifiez que vous êtes connecté·e à internet.";
|
|
});
|
|
}
|
|
});
|
|
|
|
return Column(
|
|
children: [
|
|
Expanded(child: SizedBox()),
|
|
Center(child: CircularProgressIndicator()),
|
|
Expanded(
|
|
child: Center(
|
|
child: SizedBox(
|
|
width: 300,
|
|
child: Text(text, textAlign: TextAlign.center),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|