Skip to content

Commit

Permalink
Added custom ErrorWidget
Browse files Browse the repository at this point in the history
  • Loading branch information
reza00farjam committed Oct 8, 2023
1 parent 8d8f857 commit 9bee777
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/app/constants/strings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ class ArchiveStrings {
static const errorTitle = 'خطایی رخ داد';
static const errorDescription =
'لطفا از برقراری اتصال اینترنت خود مطمئن شوید و مجددا تلاش کنید.';
static const errorUnknownDescription =
'لطفا Cache را پاک کرده و صفحه را Refresh کنید.';
static const errorButton = 'تلاش مجدد';

static const courseTypeBasic = 'پایه';
Expand Down
16 changes: 16 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,28 @@ import 'package:sentry_flutter/sentry_flutter.dart';

import 'app/bindings/controllers.dart';
import 'app/bindings/services.dart';
import 'app/constants/strings.dart';
import 'app/routes/config.dart';
import 'app/services/theme_mode.dart';
import 'app/scroll_behavior.dart';
import 'app/themes.dart';
import 'app/widgets/error.dart';

void main() async {
// Widget to show on errors instead of default grey screen
ErrorWidget.builder = (errorDetails) {
return Scaffold(
body: Center(
child: ArchiveError(
title: ArchiveStrings.errorTitle,
description: kDebugMode
? errorDetails.summary.toString()
: ArchiveStrings.errorUnknownDescription,
),
),
);
};

await dotenv.load();

await servicesBinding();
Expand Down

0 comments on commit 9bee777

Please sign in to comment.