update archive

This commit is contained in:
OfficialDakari 2025-06-09 15:14:19 +05:00
parent 451c05b98e
commit d3d75252ee
7 changed files with 114 additions and 93 deletions

View File

@ -136,6 +136,7 @@ class ChatController extends State<ChatPageWithRoom>
builder: (c) => SendFileDialog(
files: details.files,
room: room,
replyEvent: replyEvent,
outerContext: context,
),
);
@ -273,10 +274,11 @@ class ChatController extends State<ChatPageWithRoom>
showAdaptiveDialog(
context: context,
builder: (c) => SendFileDialog(
files: files,
room: room,
outerContext: context,
replyEvent: replyEvent),
files: files,
room: room,
outerContext: context,
replyEvent: replyEvent,
),
);
}
@ -554,7 +556,10 @@ class ChatController extends State<ChatPageWithRoom>
allowMultiple: true,
type: type,
);
if (files.isEmpty) return;
if (files.isEmpty) {
Logs().v("Returning in sendFileAction, bc files.isEmpty==true");
return;
}
await showAdaptiveDialog(
context: context,
builder: (c) => SendFileDialog(
@ -764,9 +769,10 @@ class ChatController extends State<ChatPageWithRoom>
);
return;
}
var content = {...event.content};
var content = {...event.content};
try {
text = await Translator.translate(text, PlatformDispatcher.instance.locale.languageCode);
text = await Translator.translate(
text, PlatformDispatcher.instance.locale.languageCode);
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(L10n.of(context).errorTranslatingMessage)),
@ -782,7 +788,14 @@ class ChatController extends State<ChatPageWithRoom>
Navigator.of(context).push(new MaterialPageRoute(
builder: (BuildContext ctx) {
return TranslatedEventDialog(
event: new Event(content: content, type: 'm.room.message', eventId: event.eventId, senderId: event.senderId, originServerTs: event.originServerTs, room: room), timeline: timeline!);
event: new Event(
content: content,
type: 'm.room.message',
eventId: event.eventId,
senderId: event.senderId,
originServerTs: event.originServerTs,
room: room),
timeline: timeline!);
},
fullscreenDialog: true));
}

View File

@ -243,82 +243,82 @@ class SendFileDialogState extends State<SendFileDialog> {
mainAxisSize: MainAxisSize.min,
children: [
const SizedBox(height: 12),
if (uniqueFileType == 'image')
Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: SizedBox(
height: 256,
child: Center(
child: ListView.builder(
shrinkWrap: true,
itemCount: widget.files.length,
scrollDirection: Axis.horizontal,
itemBuilder: (context, i) => Padding(
padding: const EdgeInsets.only(right: 8.0),
child: Material(
borderRadius: BorderRadius.circular(
AppConfig.borderRadius / 2,
),
color: Colors.black,
clipBehavior: Clip.hardEdge,
child: FutureBuilder(
future: widget.files[i].readAsBytes(),
builder: (context, snapshot) {
final bytes = snapshot.data;
if (bytes == null) {
return const Center(
child: CircularProgressIndicator
.adaptive(),
);
}
if (snapshot.error != null) {
Logs().w(
'Unable to preview image',
snapshot.error,
snapshot.stackTrace,
);
return const Center(
child: SizedBox(
width: 256,
height: 256,
child: Icon(
Icons.broken_image_outlined,
size: 64,
),
),
);
}
return Image.memory(
bytes,
height: 256,
width: widget.files.length == 1
? 256 - 36
: null,
fit: BoxFit.contain,
errorBuilder: (context, e, s) {
Logs()
.w('Unable to preview image', e, s);
return const Center(
child: SizedBox(
width: 256,
height: 256,
child: Icon(
Icons.broken_image_outlined,
size: 64,
),
),
);
},
);
},
),
),
),
),
),
),
),
if (uniqueFileType != 'image')
// if (uniqueFileType == 'image')
// Padding(
// padding: const EdgeInsets.only(bottom: 16.0),
// child: SizedBox(
// height: 256,
// child: Center(
// child: ListView.builder(
// shrinkWrap: true,
// itemCount: widget.files.length,
// scrollDirection: Axis.horizontal,
// itemBuilder: (context, i) => Padding(
// padding: const EdgeInsets.only(right: 8.0),
// child: Material(
// borderRadius: BorderRadius.circular(
// AppConfig.borderRadius / 2,
// ),
// color: Colors.black,
// clipBehavior: Clip.hardEdge,
// child: FutureBuilder(
// future: widget.files[i].readAsBytes(),
// builder: (context, snapshot) {
// final bytes = snapshot.data;
// if (bytes == null) {
// return const Center(
// child: CircularProgressIndicator
// .adaptive(),
// );
// }
// if (snapshot.error != null) {
// Logs().w(
// 'Unable to preview image',
// snapshot.error,
// snapshot.stackTrace,
// );
// return const Center(
// child: SizedBox(
// width: 256,
// height: 256,
// child: Icon(
// Icons.broken_image_outlined,
// size: 64,
// ),
// ),
// );
// }
// return Image.memory(
// bytes,
// height: 256,
// width: widget.files.length == 1
// ? 256 - 36
// : null,
// fit: BoxFit.contain,
// errorBuilder: (context, e, s) {
// Logs()
// .w('Unable to preview image', e, s);
// return const Center(
// child: SizedBox(
// width: 256,
// height: 256,
// child: Icon(
// Icons.broken_image_outlined,
// size: 64,
// ),
// ),
// );
// },
// );
// },
// ),
// ),
// ),
// ),
// ),
// ),
// ),
// if (uniqueFileType != 'image')
Padding(
padding: const EdgeInsets.only(bottom: 16.0),
child: Row(

View File

@ -286,9 +286,9 @@ class EmotesSettingsController extends State<EmotesSettings> {
if (result.isEmpty) return null;
final buffer = InputStream(await result.first.readAsBytes());
final buffer = await result.first.readAsBytes();
final archive = ZipDecoder().decodeBuffer(buffer);
final archive = ZipDecoder().decodeBytes(buffer);
return archive;
},

View File

@ -118,7 +118,7 @@ abstract class ClientManager {
},
logLevel: kReleaseMode ? Level.warning : Level.verbose,
//database: flutterMatrixSdkDatabaseBuilder(client),
legacyDatabaseBuilder: flutterMatrixSdkDatabaseBuilder,
databaseBuilder: flutterMatrixSdkDatabaseBuilder,
supportedLoginTypes: {
AuthenticationTypes.password,
AuthenticationTypes.sso,

View File

@ -19,7 +19,7 @@ extension LocalizedBody on Event {
void saveFile(BuildContext context) async {
final matrixFile = await _getFile(context);
matrixFile.result?.save(context);
}

View File

@ -69,10 +69,10 @@ packages:
dependency: "direct main"
description:
name: archive
sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d
sha256: "2fde1607386ab523f7a36bb3e7edb43bd58e6edaf2ffb29d8a6d578b297fdbbd"
url: "https://pub.dev"
source: hosted
version: "3.6.1"
version: "4.0.7"
args:
dependency: transitive
description:
@ -901,10 +901,10 @@ packages:
dependency: "direct main"
description:
name: image
sha256: f31d52537dc417fdcde36088fdf11d191026fd5e4fae742491ebd40e5a8bea7d
sha256: "4e973fcf4caae1a4be2fa0a13157aa38a8f9cb049db6529aa00b4d71abc4d928"
url: "https://pub.dev"
source: hosted
version: "4.3.0"
version: "4.5.4"
image_picker:
dependency: "direct main"
description:
@ -1445,6 +1445,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.5.1"
posix:
dependency: transitive
description:
name: posix
sha256: f0d7856b6ca1887cfa6d1d394056a296ae33489db914e365e2044fdada449e62
url: "https://pub.dev"
source: hosted
version: "6.0.2"
pretty_qr_code:
dependency: "direct main"
description:

View File

@ -10,7 +10,7 @@ environment:
dependencies:
animations: ^2.0.11
app_links: ^6.3.3
archive: ^3.4.10
archive: ^4.0.7
async: ^2.11.0
badges: ^3.1.2
blurhash_dart: ^1.2.1