kopia lustrzana https://gitlab.com/mysocialportal/relatica
Use ImageControl for link preview and HTML embedded images since has Low-bandwidth awareness
rodzic
bde307ab8d
commit
feed6e122a
|
@ -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<String, String> 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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)),
|
||||
|
|
Ładowanie…
Reference in New Issue