refactor(mobile): log asyncvalue errors (#5327)

* 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>
This commit is contained in:
shenlong 2023-11-29 04:17:29 +00:00 committed by GitHub
parent 0fe704c6f9
commit 513f252a0c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
26 changed files with 203 additions and 215 deletions

View file

@ -4,9 +4,9 @@ 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 IconData icon;
final bool withIcon;
const ScaffoldErrorBody({this.icon = Icons.error_outline, super.key});
const ScaffoldErrorBody({super.key, this.withIcon = true});
@override
Widget build(BuildContext context) {
@ -14,19 +14,22 @@ class ScaffoldErrorBody extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
Text(
"scaffold_body_error_occured",
style:
TextStyle(fontSize: 14, fontWeight: FontWeight.bold, height: 3),
style: context.textTheme.displayMedium,
textAlign: TextAlign.center,
).tr(),
Center(
child: Icon(
icon,
size: 100,
color: context.themeData.iconTheme.color?.withOpacity(0.5),
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),
),
),
),
),
],
);
}