mirror of
https://github.com/immich-app/immich.git
synced 2024-12-21 01:39:59 +02:00
513f252a0c
* refactor: scaffoldwhen to log errors during scaffold body render * refactor: onError and onLoading scaffoldbody * refactor: more scaffold body to custom extension * refactor: add skiploadingonrefresh * Snackbar color --------- Co-authored-by: shalong-tanwen <139912620+shalong-tanwen@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
37 lines
1.1 KiB
Dart
37 lines
1.1 KiB
Dart
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 {
|
|
final bool withIcon;
|
|
|
|
const ScaffoldErrorBody({super.key, this.withIcon = true});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
Text(
|
|
"scaffold_body_error_occured",
|
|
style: context.textTheme.displayMedium,
|
|
textAlign: TextAlign.center,
|
|
).tr(),
|
|
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),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|