fluffychat merge

This commit is contained in:
ggurdin 2026-02-03 13:05:34 -05:00
commit 07f14c35f1
No known key found for this signature in database
GPG key ID: A01CB41737CBB478
6 changed files with 106 additions and 121 deletions

View file

@ -3,7 +3,6 @@ import 'package:flutter/widgets.dart';
import 'package:file_picker/file_picker.dart';
import 'package:file_selector/file_selector.dart';
import 'package:fluffychat/utils/platform_infos.dart';
import 'package:fluffychat/widgets/app_lock.dart';
import 'package:fluffychat/widgets/future_loading_dialog.dart';
@ -13,31 +12,18 @@ Future<List<XFile>> selectFiles(
FileSelectorType type = FileSelectorType.any,
bool allowMultiple = false,
}) async {
if (!PlatformInfos.isLinux) {
final result = await AppLock.of(context).pauseWhile(
showFutureLoadingDialog(
context: context,
future: () => FilePicker.platform.pickFiles(
compressionQuality: 0,
allowMultiple: allowMultiple,
type: type.filePickerType,
allowedExtensions: type.extensions,
),
final result = await AppLock.of(context).pauseWhile(
showFutureLoadingDialog(
context: context,
future: () => FilePicker.platform.pickFiles(
compressionQuality: 0,
allowMultiple: allowMultiple,
type: type.filePickerType,
allowedExtensions: type.extensions,
),
);
return result.result?.xFiles ?? [];
}
if (allowMultiple) {
return await AppLock.of(context).pauseWhile(
openFiles(confirmButtonText: title, acceptedTypeGroups: type.groups),
);
}
final file = await AppLock.of(context).pauseWhile(
openFile(confirmButtonText: title, acceptedTypeGroups: type.groups),
),
);
if (file == null) return [];
return [file];
return result.result?.xFiles ?? [];
}
enum FileSelectorType {

View file

@ -3,7 +3,6 @@ import 'dart:io';
import 'package:flutter/material.dart';
import 'package:file_picker/file_picker.dart';
import 'package:file_selector/file_selector.dart';
import 'package:matrix/matrix.dart';
import 'package:share_plus/share_plus.dart';
import 'package:universal_html/html.dart' as html;
@ -20,18 +19,12 @@ extension MatrixFileExtension on MatrixFile {
return;
}
final downloadPath = !PlatformInfos.isMobile
? (await getSaveLocation(
suggestedName: name,
confirmButtonText: L10n.of(context).saveFile,
))
?.path
: await FilePicker.platform.saveFile(
dialogTitle: L10n.of(context).saveFile,
fileName: name,
type: filePickerFileType,
bytes: bytes,
);
final downloadPath = await FilePicker.platform.saveFile(
dialogTitle: L10n.of(context).saveFile,
fileName: name,
type: filePickerFileType,
bytes: bytes,
);
if (downloadPath == null) return;
if (PlatformInfos.isDesktop) {

View file

@ -81,61 +81,61 @@ class Avatar extends StatelessWidget {
),
clipBehavior: Clip.antiAlias,
// #Pangea
// child: noPic
// child: MxcImage(
child: (userId ?? presenceUserId) == BotName.byEnvironment
? BotFace(
width: size,
expression: BotExpression.idle,
useRive: useRive,
)
: noPic
// Pangea#
? Container(
decoration:
BoxDecoration(color: name?.lightColorAvatar),
alignment: Alignment.center,
child: Text(
fallbackLetters,
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'RobotoMono',
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: (size / 2.5).roundToDouble(),
: !(mxContent.toString().startsWith('mxc://'))
? ImageByUrl(
imageUrl: mxContent,
width: size,
replacement: Center(
child: Icon(
icon ?? Icons.person_2,
color: theme.colorScheme.tertiary,
size: size / 1.5,
),
),
borderRadius: borderRadius,
)
// #Pangea
: !(mxContent.toString().startsWith('mxc://'))
? ImageByUrl(
imageUrl: mxContent,
width: size,
replacement: Center(
child: Icon(
icon ?? Icons.person_2,
color: theme.colorScheme.tertiary,
size: size / 1.5,
),
),
borderRadius: borderRadius,
)
: MxcImage(
// Pangea#
: MxcImage(
client: client,
key: ValueKey(mxContent.toString()),
cacheKey: '${mxContent}_$size',
uri: mxContent,
fit: BoxFit.cover,
width: size,
height: size,
placeholder: (_) => Center(
child: Icon(
Icons.person_2,
color: theme.colorScheme.tertiary,
size: size / 1.5,
client: client,
borderRadius: borderRadius,
key: ValueKey(mxContent.toString()),
cacheKey: '${mxContent}_$size',
uri: mxContent,
fit: BoxFit.cover,
width: size,
height: size,
placeholder: (_) => noPic
? Container(
decoration: BoxDecoration(
color: name?.lightColorAvatar,
),
alignment: Alignment.center,
child: Text(
fallbackLetters,
textAlign: TextAlign.center,
style: TextStyle(
fontFamily: 'RobotoMono',
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: (size / 2.5).roundToDouble(),
),
),
)
: Center(
child: Icon(
Icons.person_2,
color: theme.colorScheme.tertiary,
size: size / 1.5,
),
),
),
),
),
),
),
// #Pangea

View file

@ -26,6 +26,7 @@ class MxcImage extends StatefulWidget {
final Widget Function(BuildContext context)? placeholder;
final String? cacheKey;
final Client? client;
final BorderRadius borderRadius;
const MxcImage({
this.uri,
@ -42,6 +43,7 @@ class MxcImage extends StatefulWidget {
this.thumbnailMethod = ThumbnailMethod.scale,
this.cacheKey,
this.client,
this.borderRadius = BorderRadius.zero,
super.key,
});
@ -166,30 +168,34 @@ class _MxcImageState extends State<MxcImage> {
final hasData = data != null && data.isNotEmpty;
return AnimatedSwitcher(
duration: const Duration(milliseconds: 128),
duration: FluffyThemes.animationDuration,
child: hasData
? Image.memory(
data,
width: widget.width,
height: widget.height,
fit: widget.fit,
filterQuality:
widget.isThumbnail ? FilterQuality.low : FilterQuality.medium,
errorBuilder: (context, e, s) {
Logs().d('Unable to render mxc image', e, s);
return SizedBox(
width: widget.width,
height: widget.height,
child: Material(
color: Theme.of(context).colorScheme.surfaceContainer,
child: Icon(
Icons.broken_image_outlined,
size: min(widget.height ?? 64, 64),
color: Theme.of(context).colorScheme.onSurface,
? ClipRRect(
borderRadius: widget.borderRadius,
child: Image.memory(
data,
width: widget.width,
height: widget.height,
fit: widget.fit,
filterQuality: widget.isThumbnail
? FilterQuality.low
: FilterQuality.medium,
errorBuilder: (context, e, s) {
Logs().d('Unable to render mxc image', e, s);
return SizedBox(
width: widget.width,
height: widget.height,
child: Material(
color: Theme.of(context).colorScheme.surfaceContainer,
child: Icon(
Icons.broken_image_outlined,
size: min(widget.height ?? 64, 64),
color: Theme.of(context).colorScheme.onSurface,
),
),
),
);
},
);
},
),
)
// #Pangea
// : placeholder(context),

View file

@ -1278,66 +1278,66 @@ packages:
dependency: "direct main"
description:
name: image_picker
sha256: "021834d9c0c3de46bf0fe40341fa07168407f694d9b2bb18d532dc1261867f7a"
sha256: "736eb56a911cf24d1859315ad09ddec0b66104bc41a7f8c5b96b4e2620cf5041"
url: "https://pub.dev"
source: hosted
version: "1.1.2"
version: "1.2.0"
image_picker_android:
dependency: transitive
description:
name: image_picker_android
sha256: "317a5d961cec5b34e777b9252393f2afbd23084aa6e60fcf601dcf6341b9ebeb"
sha256: e83b2b05141469c5e19d77e1dfa11096b6b1567d09065b2265d7c6904560050c
url: "https://pub.dev"
source: hosted
version: "0.8.12+23"
version: "0.8.13"
image_picker_for_web:
dependency: transitive
description:
name: image_picker_for_web
sha256: "717eb042ab08c40767684327be06a5d8dbb341fe791d514e4b92c7bbe1b7bb83"
sha256: "40c2a6a0da15556dc0f8e38a3246064a971a9f512386c3339b89f76db87269b6"
url: "https://pub.dev"
source: hosted
version: "3.0.6"
version: "3.1.0"
image_picker_ios:
dependency: transitive
description:
name: image_picker_ios
sha256: "05da758e67bc7839e886b3959848aa6b44ff123ab4b28f67891008afe8ef9100"
sha256: eb06fe30bab4c4497bad449b66448f50edcc695f1c59408e78aa3a8059eb8f0e
url: "https://pub.dev"
source: hosted
version: "0.8.12+2"
version: "0.8.13"
image_picker_linux:
dependency: transitive
description:
name: image_picker_linux
sha256: "34a65f6740df08bbbeb0a1abd8e6d32107941fd4868f67a507b25601651022c9"
sha256: "1f81c5f2046b9ab724f85523e4af65be1d47b038160a8c8deed909762c308ed4"
url: "https://pub.dev"
source: hosted
version: "0.2.1+2"
version: "0.2.2"
image_picker_macos:
dependency: transitive
description:
name: image_picker_macos
sha256: "1b90ebbd9dcf98fb6c1d01427e49a55bd96b5d67b8c67cf955d60a5de74207c1"
sha256: d58cd9d67793d52beefd6585b12050af0a7663c0c2a6ece0fb110a35d6955e04
url: "https://pub.dev"
source: hosted
version: "0.2.1+2"
version: "0.2.2"
image_picker_platform_interface:
dependency: transitive
description:
name: image_picker_platform_interface
sha256: "886d57f0be73c4b140004e78b9f28a8914a09e50c2d816bdd0520051a71236a0"
sha256: "9f143b0dba3e459553209e20cc425c9801af48e6dfa4f01a0fcf927be3f41665"
url: "https://pub.dev"
source: hosted
version: "2.10.1"
version: "2.11.0"
image_picker_windows:
dependency: transitive
description:
name: image_picker_windows
sha256: "6ad07afc4eb1bc25f3a01084d28520496c4a3bb0cb13685435838167c9dcedeb"
sha256: d248c86554a72b5495a31c56f060cf73a41c7ff541689327b1a7dbccc33adfae
url: "https://pub.dev"
source: hosted
version: "0.2.1+1"
version: "0.2.2"
import_sorter:
dependency: "direct dev"
description:

View file

@ -60,7 +60,7 @@ dependencies:
html: ^0.15.4
http: ^1.5.0
image: ^4.1.7
image_picker: ^1.1.0
image_picker: ^1.2.0
intl: any
just_audio: ^0.10.4
latlong2: ^0.9.1
@ -205,4 +205,4 @@ dependency_overrides:
git:
url: https://github.com/ThexXTURBOXx/flutter_web_auth_2.git
ref: 3.x-without-v1
path: flutter_web_auth_2
path: flutter_web_auth_2