2023-11-19 18:04:44 +02:00
|
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
|
|
|
|
|
|
|
// Error widget to be used in Scaffold when an AsyncError is received
|
|
|
|
class ScaffoldErrorBody extends StatelessWidget {
|
2023-11-29 06:17:29 +02:00
|
|
|
final bool withIcon;
|
2023-11-19 18:04:44 +02:00
|
|
|
|
2023-11-29 06:17:29 +02:00
|
|
|
const ScaffoldErrorBody({super.key, this.withIcon = true});
|
2023-11-19 18:04:44 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
2023-11-29 06:17:29 +02:00
|
|
|
Text(
|
2023-12-05 21:34:37 +02:00
|
|
|
"scaffold_body_error_occurred",
|
2023-11-29 06:17:29 +02:00
|
|
|
style: context.textTheme.displayMedium,
|
2023-11-19 18:04:44 +02:00
|
|
|
textAlign: TextAlign.center,
|
|
|
|
).tr(),
|
2023-11-29 06:17:29 +02:00
|
|
|
if (withIcon)
|
|
|
|
Center(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.only(top: 15),
|
|
|
|
child: Icon(
|
|
|
|
Icons.error_outline,
|
|
|
|
size: 100,
|
|
|
|
color: context.themeData.iconTheme.color?.withOpacity(0.5),
|
|
|
|
),
|
|
|
|
),
|
2023-11-19 18:04:44 +02:00
|
|
|
),
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|