fixed widget mounting errors
This commit is contained in:
@@ -165,23 +165,28 @@ class _AbsenceReportViewState extends State<AbsenceReportView> {
|
||||
Widget _buildBody(BuildContext context) => FutureBuilder<void>(
|
||||
future: _init,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState != ConnectionState.done) {
|
||||
return const Center(child: AppProgressIndicator.large());
|
||||
}
|
||||
if (snapshot.hasError) {
|
||||
return PlaceholderView(
|
||||
icon: Icons.error_outline,
|
||||
text: errorToUserMessage(snapshot.error),
|
||||
button: ElevatedButton.icon(
|
||||
onPressed: () => setState(() => _init = _load()),
|
||||
icon: const Icon(Icons.refresh),
|
||||
label: const Text('Erneut versuchen'),
|
||||
),
|
||||
);
|
||||
}
|
||||
return _buildForm(context);
|
||||
},
|
||||
);
|
||||
if (snapshot.connectionState != ConnectionState.done) {
|
||||
return const Center(child: AppProgressIndicator.large());
|
||||
}
|
||||
if (snapshot.hasError) {
|
||||
return PlaceholderView(
|
||||
icon: Icons.error_outline,
|
||||
text: errorToUserMessage(snapshot.error),
|
||||
button: ElevatedButton.icon(
|
||||
onPressed: () {
|
||||
final reload = _load();
|
||||
setState(() {
|
||||
_init = reload;
|
||||
});
|
||||
},
|
||||
icon: const Icon(Icons.refresh),
|
||||
label: const Text('Erneut versuchen'),
|
||||
),
|
||||
);
|
||||
}
|
||||
return _buildForm(context);
|
||||
},
|
||||
);
|
||||
|
||||
Widget _buildForm(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
|
||||
Reference in New Issue
Block a user