chore: switch to cached_network_image

This commit is contained in:
Sorunome 2020-09-07 17:08:01 +02:00
parent fadf8715c3
commit bbca0c2bee
No known key found for this signature in database
GPG Key ID: B19471D07FC9BE9C
9 changed files with 29 additions and 81 deletions

View File

@ -2,7 +2,7 @@ import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/utils/string_color.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_advanced_networkimage/provider.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'matrix.dart';
@ -41,12 +41,7 @@ class Avatar extends StatelessWidget {
onTap: onTap,
child: CircleAvatar(
radius: size / 2,
backgroundImage: !noPic
? AdvancedNetworkImage(
src,
useDiskCache: !kIsWeb,
)
: null,
backgroundImage: !noPic ? CachedNetworkImageProvider(src) : null,
backgroundColor: noPic
? name?.lightColor ?? Theme.of(context).secondaryHeaderColor
: Theme.of(context).secondaryHeaderColor,

View File

@ -1,7 +1,7 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_advanced_networkimage/provider.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'matrix.dart';
@ -48,13 +48,10 @@ class ContentBanner extends StatelessWidget {
opacity: 0.75,
child: !loading
? mxContent != null
? Image(
? CachedNetworkImage(
imageUrl: src,
height: 300,
fit: BoxFit.cover,
image: AdvancedNetworkImage(
src,
useDiskCache: !kIsWeb,
),
)
: Icon(defaultIcon, size: 300)
: Icon(defaultIcon, size: 300),

View File

@ -5,8 +5,7 @@ import 'package:fluffychat/views/image_view.dart';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_blurhash/flutter_blurhash.dart';
import 'package:flutter_advanced_networkimage/provider.dart';
import 'package:flutter_advanced_networkimage/transition.dart';
import 'package:cached_network_image/cached_network_image.dart';
class ImageBubble extends StatefulWidget {
final Event event;
@ -126,16 +125,13 @@ class _ImageBubbleState extends State<ImageBubble> {
fit: widget.fit,
);
} else if (isUnencrypted) {
renderWidget = TransitionToImage(
image: AdvancedNetworkImage(
Uri.parse(widget.event.content['url']).getThumbnail(
renderWidget = CachedNetworkImage(
imageUrl: Uri.parse(widget.event.content['url']).getThumbnail(
widget.event.room.client,
width: 800,
height: 800,
method: ThumbnailMethod.scale),
useDiskCache: !kIsWeb,
),
loadingWidget: generatePlaceholderWidget(),
placeholder: (context, url) => generatePlaceholderWidget(),
fit: widget.fit,
);
} else {

View File

@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:flutter_advanced_networkimage/provider.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'avatar.dart';
class InputBar extends StatelessWidget {
@ -146,8 +146,8 @@ class InputBar extends StatelessWidget {
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Image(
image: AdvancedNetworkImage(url, useDiskCache: !kIsWeb),
CachedNetworkImage(
imageUrl: url,
width: size,
height: size,
),

View File

@ -1,7 +1,6 @@
import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_advanced_networkimage/provider.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'matrix.dart';
@ -89,13 +88,11 @@ class _Reaction extends StatelessWidget {
content = Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Image(
image: AdvancedNetworkImage(
src,
useDiskCache: !kIsWeb,
),
CachedNetworkImage(
imageUrl: src,
height: fontSize,
),
Container(width: 4),
Text(count.toString(),
style: TextStyle(
color: textColor,

View File

@ -2,7 +2,7 @@ import 'package:famedlysdk/famedlysdk.dart';
import 'package:fluffychat/components/image_bubble.dart';
import 'package:fluffychat/components/matrix.dart';
import 'package:flutter/material.dart';
import 'package:flutter_advanced_networkimage/zoomable.dart';
import 'package:photo_view/photo_view.dart';
import '../utils/event_extension.dart';
class ImageView extends StatelessWidget {
@ -41,7 +41,7 @@ class ImageView extends StatelessWidget {
),
],
),
body: ZoomableWidget(
body: PhotoView.customChild(
minScale: 1.0,
maxScale: 10.0,
child: ImageBubble(

View File

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter_advanced_networkimage/provider.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:famedlysdk/famedlysdk.dart';
import 'package:image_picker/image_picker.dart';
import 'package:bot_toast/bot_toast.dart';
@ -329,11 +329,8 @@ class _EmoteImage extends StatelessWidget {
height: size * devicePixelRatio,
method: ThumbnailMethod.scale,
);
return Image(
image: AdvancedNetworkImage(
url,
useDiskCache: !kIsWeb,
),
return CachedNetworkImage(
imageUrl: url,
fit: BoxFit.contain,
width: size,
height: size,

View File

@ -79,7 +79,7 @@ packages:
source: hosted
version: "1.1.9+1"
cached_network_image:
dependency: transitive
dependency: "direct main"
description:
name: cached_network_image
url: "https://pub.dartlang.org"
@ -232,15 +232,6 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_advanced_networkimage:
dependency: "direct main"
description:
path: "."
ref: master
resolved-ref: f0f599fb89c494d9158fb6f13d4870582f8ecfcb
url: "https://github.com/mchome/flutter_advanced_networkimage"
source: git
version: "0.8.0"
flutter_blurhash:
dependency: "direct main"
description:
@ -330,13 +321,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
flutter_svg:
dependency: transitive
description:
name: flutter_svg
url: "https://pub.dartlang.org"
source: hosted
version: "0.18.0"
flutter_test:
dependency: "direct dev"
description: flutter
@ -594,20 +578,6 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0-nullsafety"
path_drawing:
dependency: transitive
description:
name: path_drawing
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.1"
path_parsing:
dependency: transitive
description:
name: path_parsing
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.4"
path_provider:
dependency: "direct main"
description:
@ -656,7 +626,7 @@ packages:
name: photo_view
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.2"
version: "0.10.2"
platform:
dependency: transitive
description:

View File

@ -34,10 +34,7 @@ dependencies:
memoryfilepicker: ^0.1.3
url_launcher: ^5.4.1
url_launcher_web: ^0.1.0
flutter_advanced_networkimage:
git:
url: https://github.com/mchome/flutter_advanced_networkimage
ref: master
cached_network_image: ^2.3.1
firebase_messaging: ^6.0.13
flutter_local_notifications: ^1.4.3
matrix_link_text: ^0.1.5
@ -49,7 +46,7 @@ dependencies:
universal_html: ^1.1.12
receive_sharing_intent: ^1.3.3
flutter_slidable: ^0.5.4
photo_view: ^0.9.2
photo_view: ^0.10.2
flutter_sound: ^2.1.1
open_file: ^3.0.1
mime_type: ^0.3.0
@ -71,7 +68,6 @@ dependencies:
ref: master
flutter_blurhash: ^0.5.0
dev_dependencies:
flutter_test:
sdk: flutter