mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-06 09:13:48 +08:00
opt: get cacheSize
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -4,9 +4,12 @@ import 'package:floating/floating.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
|
||||
extension ImageExtension on num {
|
||||
int cacheSize(BuildContext context) {
|
||||
return (this * MediaQuery.of(context).devicePixelRatio).round();
|
||||
extension ImageExtension on num? {
|
||||
int? cacheSize(BuildContext context) {
|
||||
if (this == null || this == 0) {
|
||||
return null;
|
||||
}
|
||||
return (this! * MediaQuery.of(context).devicePixelRatio).round();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user