Skip to content

Commit

Permalink
(feat/refactor): register and configure EasyLoading loading indicator
Browse files Browse the repository at this point in the history
  • Loading branch information
mediocre9 committed Jan 6, 2024
1 parent 8ef5377 commit 6f788eb
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:smart_link/config/router/route_generator.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:smart_link/config/config.dart';
import 'firebase_options.dart';
import 'config/index.dart';

Future<void> initializeFirebaseModule() async {
await Firebase.initializeApp(
Expand All @@ -14,6 +14,15 @@ Future<void> initializeFirebaseModule() async {
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;
}

void configureLoadingIndicator() {
EasyLoading.instance
..dismissOnTap = false
..userInteractions = false
..indicatorType = EasyLoadingIndicatorType.wave
..loadingStyle = EasyLoadingStyle.dark
..animationStyle = EasyLoadingAnimationStyle.offset;
}

Future<void> main() async {
runZonedGuarded(() async {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -22,6 +31,8 @@ Future<void> main() async {
}, (error, stack) {
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
});

configureLoadingIndicator();
}

class SmartLinkApp extends StatelessWidget {
Expand All @@ -33,8 +44,9 @@ class SmartLinkApp extends StatelessWidget {
title: AppStrings.appName,
color: AppColors.primary,
theme: AppTheme.darkTheme,
builder: EasyLoading.init(),
onGenerateRoute: RouteGenerator.generate,
initialRoute: kDebugMode ? Routes.bluetoothHome : Routes.auth,
initialRoute: kDebugMode ? AppRoutes.bluetoothHome : AppRoutes.auth,
debugShowCheckedModeBanner: kDebugMode ? true : false,
);
}
Expand Down

0 comments on commit 6f788eb

Please sign in to comment.