[FEAT] working on the image widget for dynamic memory management and caching.
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
//s1 Imports
|
//s1 Imports
|
||||||
//s2 Core Package Imports
|
//s2 Core Package Imports
|
||||||
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
import 'package:flutter/widgets.dart';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
@@ -301,9 +303,10 @@ class AstromicImage extends StatelessWidget {
|
|||||||
// imageQuality is used as a downscale factor: 1.0 -> full target resolution, 0.5 -> half resolution
|
// imageQuality is used as a downscale factor: 1.0 -> full target resolution, 0.5 -> half resolution
|
||||||
final double factor = imageQuality.clamp(0.1, 1.0);
|
final double factor = imageQuality.clamp(0.1, 1.0);
|
||||||
|
|
||||||
// If size is infinite for a dimension, we skip resize for that dim (pass 0)
|
final double dpr = PlatformDispatcher.instance.views.first.devicePixelRatio;
|
||||||
final int? targetWidth = size.width.isFinite ? (size.width * factor).clamp(1, 4096).toInt() : null;
|
|
||||||
final int? targetHeight = size.height.isFinite ? (size.height * factor).clamp(1, 4096).toInt() : null;
|
final int? targetWidth = size.width.isFinite ? (size.width * factor * dpr).clamp(1, 4096).toInt() : null;
|
||||||
|
final int? targetHeight = size.height.isFinite ? (size.height * factor * dpr).clamp(1, 4096).toInt() : null;
|
||||||
|
|
||||||
ImageProvider baseProvider;
|
ImageProvider baseProvider;
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|||||||
Reference in New Issue
Block a user