added svg pre-cache
This commit is contained in:
parent
625ef9ce37
commit
e188536d65
@ -1,6 +1,7 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:background_fetch/background_fetch.dart';
|
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/user_provider.dart';
|
||||||
import 'package:refilc/api/providers/database_provider.dart';
|
import 'package:refilc/api/providers/database_provider.dart';
|
||||||
import 'package:refilc/database/init.dart';
|
import 'package:refilc/database/init.dart';
|
||||||
@ -18,6 +19,8 @@ import 'package:flutter_local_notifications/flutter_local_notifications.dart';
|
|||||||
|
|
||||||
// import 'firebase_options.dart';
|
// import 'firebase_options.dart';
|
||||||
|
|
||||||
|
// days without touching grass: 5,843 (16 yrs)
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
// Initalize
|
// Initalize
|
||||||
WidgetsBinding binding = WidgetsFlutterBinding.ensureInitialized();
|
WidgetsBinding binding = WidgetsFlutterBinding.ensureInitialized();
|
||||||
@ -40,6 +43,22 @@ void main() async {
|
|||||||
|
|
||||||
BackgroundFetch.registerHeadlessTask(backgroundHeadlessTask);
|
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
|
// Run App
|
||||||
runApp(App(
|
runApp(App(
|
||||||
database: startup.database,
|
database: startup.database,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user