Files
PiliPlus/lib/utils/extension/num_ext.dart
bggRGjQaUbCoE 0baf3fcd36 tweaks
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
2025-12-16 15:56:54 +08:00

16 lines
403 B
Dart

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;
}