12345678910111213141516171819202122232425 |
- import 'package:flutter/material.dart';
- import '../utils/utils.dart';
- class ShowImageCache extends StatelessWidget {
- const ShowImageCache({Key? key}) : super(key: key);
- ImageCache? get imageCache => PaintingBinding.instance?.imageCache;
- @override
- Widget build(BuildContext context) {
- return Column(mainAxisAlignment: MainAxisAlignment.center, children: [
- const SizedBox(height: 8),
- Text(
- '当前图像缓存数量: ${imageCache?.currentSize ?? 0}',
- style: const TextStyle(fontSize: 12),
- ),
- const SizedBox(height: 8),
- Text(
- '当前图像缓存大小: ${imageCache?.currentSizeBytes ?? 0}bytes = ${byte2MB(imageCache?.currentSizeBytes ?? 0)}MB',
- style: const TextStyle(fontSize: 12),
- ),
- const SizedBox(height: 8),
- ]);
- }
- }
|