mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-20 11:08:03 +08:00
15
lib/utils/extension/num_ext.dart
Normal file
15
lib/utils/extension/num_ext.dart
Normal file
@@ -0,0 +1,15 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
extension ImageExtension on num {
|
||||
int? cacheSize(BuildContext context) {
|
||||
if (this == 0) {
|
||||
return null;
|
||||
}
|
||||
return (this * MediaQuery.devicePixelRatioOf(context)).round();
|
||||
}
|
||||
}
|
||||
|
||||
extension IntExt on int? {
|
||||
int? operator +(int other) => this == null ? null : this! + other;
|
||||
int? operator -(int other) => this == null ? null : this! - other;
|
||||
}
|
||||
Reference in New Issue
Block a user