diff --git a/refilc/lib/main.dart b/refilc/lib/main.dart index 4842961..26f53cf 100644 --- a/refilc/lib/main.dart +++ b/refilc/lib/main.dart @@ -1,6 +1,7 @@ import 'dart:io'; import 'package:background_fetch/background_fetch.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:refilc/api/providers/user_provider.dart'; import 'package:refilc/api/providers/database_provider.dart'; import 'package:refilc/database/init.dart'; @@ -18,6 +19,8 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart'; // import 'firebase_options.dart'; +// days without touching grass: 5,843 (16 yrs) + void main() async { // Initalize WidgetsBinding binding = WidgetsFlutterBinding.ensureInitialized(); @@ -40,6 +43,22 @@ void main() async { BackgroundFetch.registerHeadlessTask(backgroundHeadlessTask); + // pre-cache required icons + const todaySvg = SvgAssetLoader('assets/svg/menu_icons/today_selected.svg'); + const gradesSvg = SvgAssetLoader('assets/svg/menu_icons/grades_selected.svg'); + const timetableSvg = + SvgAssetLoader('assets/svg/menu_icons/timetable_selected.svg'); + const notesSvg = SvgAssetLoader('assets/svg/menu_icons/notes_selected.svg'); + + svg.cache + .putIfAbsent(todaySvg.cacheKey(null), () => todaySvg.loadBytes(null)); + svg.cache + .putIfAbsent(gradesSvg.cacheKey(null), () => gradesSvg.loadBytes(null)); + svg.cache.putIfAbsent( + timetableSvg.cacheKey(null), () => timetableSvg.loadBytes(null)); + svg.cache + .putIfAbsent(notesSvg.cacheKey(null), () => notesSvg.loadBytes(null)); + // Run App runApp(App( database: startup.database,