mirror of
https://github.com/Xevion/paperless-mobile.git
synced 2025-12-08 04:07:51 -06:00
Precached asset images
This commit is contained in:
19
lib/core/global/asset_images.dart
Normal file
19
lib/core/global/asset_images.dart
Normal file
@@ -0,0 +1,19 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum AssetImages {
|
||||
headacheDocuments("images/documents_headache.png"),
|
||||
organizeDocuments("images/organize_documents.png"),
|
||||
secureDocuments("images/secure_documents.png"),
|
||||
success("images/success.png");
|
||||
|
||||
final String relativePath;
|
||||
const AssetImages(String relativePath)
|
||||
: relativePath = "assets/$relativePath";
|
||||
|
||||
Image get image => Image.asset(
|
||||
relativePath,
|
||||
key: ObjectKey("assetimage_$relativePath"),
|
||||
);
|
||||
|
||||
void load(context) => precacheImage(image.image, context);
|
||||
}
|
||||
Reference in New Issue
Block a user