diff --git a/lib/controls/html_text_viewer_control.dart b/lib/controls/html_text_viewer_control.dart
index aaa64ba..0504a65 100644
--- a/lib/controls/html_text_viewer_control.dart
+++ b/lib/controls/html_text_viewer_control.dart
@@ -1,11 +1,10 @@
import 'dart:async';
-import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart';
import 'package:html/dom.dart' as dom;
-import '../globals.dart';
+import 'image_control.dart';
const _emojiSize = {'width': '20px', 'height': '20px', 'margin-left': '-3px'};
@@ -43,19 +42,6 @@ class MyWidgetFactory extends WidgetFactory {
return super.buildImageWidget(meta, src);
}
- Map headers = {'user-agent': userAgent};
-
- return CachedNetworkImage(
- httpHeaders: headers,
- errorWidget: (context, _, error) =>
- onErrorBuilder(context, meta, error, src) ?? widget0,
- fit: BoxFit.fill,
- imageUrl: url,
- progressIndicatorBuilder: (context, _, progress) {
- final t = progress.totalSize;
- final v = t != null && t > 0 ? progress.downloaded / t : null;
- return onLoadingBuilder(context, meta, v, src) ?? widget0;
- },
- );
+ return ImageControl(imageUrl: url);
}
}
diff --git a/lib/controls/timeline/link_preview_control.dart b/lib/controls/timeline/link_preview_control.dart
index abca75b..54ef5b2 100644
--- a/lib/controls/timeline/link_preview_control.dart
+++ b/lib/controls/timeline/link_preview_control.dart
@@ -1,9 +1,9 @@
-import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import '../../models/link_preview_data.dart';
import '../../utils/string_utils.dart';
import '../../utils/url_opening_utils.dart';
+import '../image_control.dart';
class LinkPreviewControl extends StatelessWidget {
final LinkPreviewData preview;
@@ -24,7 +24,7 @@ class LinkPreviewControl extends StatelessWidget {
},
child: Column(
children: [
- CachedNetworkImage(imageUrl: preview.selectedImageUrl),
+ ImageControl(imageUrl: preview.selectedImageUrl),
ListTile(
title: Text(preview.title,
style: const TextStyle(fontWeight: FontWeight.bold)),