fix: Desktop images
This commit is contained in:
parent
46c606ef29
commit
95e130281e
|
@ -1,4 +1,5 @@
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/utils/string_color.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
@ -41,7 +42,11 @@ class Avatar extends StatelessWidget {
|
|||
onTap: onTap,
|
||||
child: CircleAvatar(
|
||||
radius: size / 2,
|
||||
backgroundImage: !noPic ? CachedNetworkImageProvider(src) : null,
|
||||
backgroundImage: !noPic
|
||||
? PlatformInfos.isBetaDesktop
|
||||
? NetworkImage(src)
|
||||
: CachedNetworkImageProvider(src)
|
||||
: null,
|
||||
backgroundColor: noPic
|
||||
? name?.lightColor ?? Theme.of(context).secondaryHeaderColor
|
||||
: Theme.of(context).secondaryHeaderColor,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
|
@ -48,7 +49,13 @@ class ContentBanner extends StatelessWidget {
|
|||
opacity: 0.75,
|
||||
child: !loading
|
||||
? mxContent != null
|
||||
? CachedNetworkImage(
|
||||
? PlatformInfos.isBetaDesktop
|
||||
? Image.network(
|
||||
src,
|
||||
height: 300,
|
||||
fit: BoxFit.cover,
|
||||
)
|
||||
: CachedNetworkImage(
|
||||
imageUrl: src,
|
||||
height: 300,
|
||||
fit: BoxFit.cover,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/utils/app_route.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/views/image_view.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
@ -121,13 +122,20 @@ class _ImageBubbleState extends State<ImageBubble> {
|
|||
fit: widget.fit,
|
||||
);
|
||||
} else if (isUnencrypted) {
|
||||
renderWidget = CachedNetworkImage(
|
||||
imageUrl: Uri.parse(widget.event.content['url']).getThumbnail(
|
||||
final src = Uri.parse(widget.event.content['url']).getThumbnail(
|
||||
widget.event.room.client,
|
||||
width: 800,
|
||||
height: 800,
|
||||
method: ThumbnailMethod.scale),
|
||||
placeholder: (context, url) => generatePlaceholderWidget(),
|
||||
method: ThumbnailMethod.scale);
|
||||
renderWidget = PlatformInfos.isBetaDesktop
|
||||
? Image.network(
|
||||
src,
|
||||
fit: widget.fit,
|
||||
)
|
||||
: CachedNetworkImage(
|
||||
imageUrl: src,
|
||||
placeholder: (context, url) =>
|
||||
generatePlaceholderWidget(),
|
||||
fit: widget.fit,
|
||||
);
|
||||
} else {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
|
@ -146,7 +147,13 @@ class InputBar extends StatelessWidget {
|
|||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
CachedNetworkImage(
|
||||
PlatformInfos.isBetaDesktop
|
||||
? Image.network(
|
||||
url,
|
||||
width: size,
|
||||
height: size,
|
||||
)
|
||||
: CachedNetworkImage(
|
||||
imageUrl: url,
|
||||
width: size,
|
||||
height: size,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
|
||||
|
@ -92,7 +93,12 @@ class _Reaction extends StatelessWidget {
|
|||
content = Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
CachedNetworkImage(
|
||||
PlatformInfos.isBetaDesktop
|
||||
? Image.network(
|
||||
src,
|
||||
height: fontSize,
|
||||
)
|
||||
: CachedNetworkImage(
|
||||
imageUrl: src,
|
||||
height: fontSize,
|
||||
),
|
||||
|
|
|
@ -4,6 +4,12 @@ import 'package:flutter/foundation.dart';
|
|||
|
||||
abstract class PlatformInfos {
|
||||
static bool get isWeb => kIsWeb;
|
||||
|
||||
static bool get isMobile => !kIsWeb && (Platform.isAndroid || Platform.isIOS);
|
||||
|
||||
/// For desktops which don't support ChachedNetworkImage yet
|
||||
static bool get isBetaDesktop =>
|
||||
!kIsWeb && (Platform.isWindows || Platform.isLinux);
|
||||
|
||||
static bool get usesTouchscreen => !isMobile;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:bot_toast/bot_toast.dart';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:famedlysdk/famedlysdk.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
@ -415,7 +416,14 @@ class _EmoteImage extends StatelessWidget {
|
|||
height: size * devicePixelRatio,
|
||||
method: ThumbnailMethod.scale,
|
||||
);
|
||||
return CachedNetworkImage(
|
||||
return PlatformInfos.isBetaDesktop
|
||||
? Image.network(
|
||||
url,
|
||||
fit: BoxFit.contain,
|
||||
width: size,
|
||||
height: size,
|
||||
)
|
||||
: CachedNetworkImage(
|
||||
imageUrl: url,
|
||||
fit: BoxFit.contain,
|
||||
width: size,
|
||||
|
|
|
@ -31,7 +31,7 @@ dependencies:
|
|||
memoryfilepicker: ^0.1.3
|
||||
url_launcher: ^5.4.1
|
||||
url_launcher_web: ^0.1.0
|
||||
cached_network_image: ^2.3.1
|
||||
cached_network_image: ^2.3.2+1
|
||||
firebase_messaging: ^7.0.2
|
||||
flutter_local_notifications: ^1.4.3
|
||||
matrix_link_text: ^0.1.5
|
||||
|
|
Loading…
Reference in a new issue