diff --git a/lib/config/themes.dart b/lib/config/themes.dart index 5b04925..8d4b199 100644 --- a/lib/config/themes.dart +++ b/lib/config/themes.dart @@ -79,6 +79,7 @@ abstract class FluffyThemes { useMaterial3: true, brightness: brightness, colorScheme: colorScheme, + useSystemColors: true, dividerColor: brightness == Brightness.dark ? colorScheme.surfaceContainerHighest : colorScheme.surfaceContainer, diff --git a/lib/pages/chat/chat_input_row.dart b/lib/pages/chat/chat_input_row.dart index 0786be2..6728c73 100644 --- a/lib/pages/chat/chat_input_row.dart +++ b/lib/pages/chat/chat_input_row.dart @@ -152,30 +152,30 @@ class ChatInputRow extends StatelessWidget { contentPadding: const EdgeInsets.all(0), ), ), - // PopupMenuItem( - // value: 'image', - // child: ListTile( - // leading: CircleAvatar( - // backgroundColor: theme.colorScheme.onPrimaryContainer, - // foregroundColor: theme.colorScheme.primaryContainer, - // child: const Icon(Icons.photo_outlined), - // ), - // title: Text(L10n.of(context).sendImage), - // contentPadding: const EdgeInsets.all(0), - // ), - // ), - // PopupMenuItem( - // value: 'video', - // child: ListTile( - // leading: CircleAvatar( - // backgroundColor: theme.colorScheme.onPrimaryContainer, - // foregroundColor: theme.colorScheme.primaryContainer, - // child: const Icon(Icons.video_camera_back_outlined), - // ), - // title: Text(L10n.of(context).sendVideo), - // contentPadding: const EdgeInsets.all(0), - // ), - // ), + PopupMenuItem( + value: 'image', + child: ListTile( + leading: CircleAvatar( + backgroundColor: theme.colorScheme.onPrimaryContainer, + foregroundColor: theme.colorScheme.primaryContainer, + child: const Icon(Icons.photo_outlined), + ), + title: Text(L10n.of(context).sendImage), + contentPadding: const EdgeInsets.all(0), + ), + ), + PopupMenuItem( + value: 'video', + child: ListTile( + leading: CircleAvatar( + backgroundColor: theme.colorScheme.onPrimaryContainer, + foregroundColor: theme.colorScheme.primaryContainer, + child: const Icon(Icons.video_camera_back_outlined), + ), + title: Text(L10n.of(context).sendVideo), + contentPadding: const EdgeInsets.all(0), + ), + ), PopupMenuItem( value: 'file', child: ListTile( diff --git a/lib/pages/chat/input_bar.dart b/lib/pages/chat/input_bar.dart index aab1457..accdd8e 100644 --- a/lib/pages/chat/input_bar.dart +++ b/lib/pages/chat/input_bar.dart @@ -372,14 +372,14 @@ class InputBar extends StatelessWidget { if (suggestion['type'] == 'user') { insertText = '${suggestion['mention']!} '; startText = replaceText.replaceAllMapped( - RegExp(r'(\s|^)(@[-\w]+)$'), - (Match m) => '${m[1]}$insertText', + RegExp(r'(?:\s|^)@([^ \[\]]+)$', unicode: true), + (Match m) => '$insertText', ); } if (suggestion['type'] == 'room') { insertText = '${suggestion['mxid']!} '; startText = replaceText.replaceAllMapped( - RegExp(r'(\s|^)(#[-\w]+)$'), + RegExp(r'(\s|^)(#[-\w]+)$', unicode: true), (Match m) => '${m[1]}$insertText', ); } diff --git a/lib/pages/download_manager/download_manager.dart b/lib/pages/download_manager/download_manager.dart index 1c48902..359b9f4 100644 --- a/lib/pages/download_manager/download_manager.dart +++ b/lib/pages/download_manager/download_manager.dart @@ -27,33 +27,33 @@ class Download { try { final mx = Matrix.of(context).client; // final directory = await getDownloadsDirectory(); - downloadPath = - "/sdcard/Download/Extera"; + downloadPath = "/sdcard/Download/Extera"; httpUrl = (await Uri.parse(url).getDownloadUri(mx)).toString(); if (downloadPath != null) { // Create Dio instance final dio = Dio(); - + ct = CancelToken(); // Download the file - response = dio.download( - httpUrl, - "$downloadPath/$name", - onReceiveProgress: (received, total) { - receivedBytes = received; - totalBytes = total; - progress = (receivedBytes / totalBytes) * 100; - print("Download progress: $progress%"); - }, - options: Options( - responseType: ResponseType.bytes, - headers: {'authorization': "Bearer ${mx.accessToken}"} - ), - cancelToken: ct - ); + response = dio.download(httpUrl, "$downloadPath/$name", + onReceiveProgress: (received, total) { + receivedBytes = received; + totalBytes = total; + progress = (receivedBytes / totalBytes) * 100; + if (progress == 100) { + Provider.of(context) + .downloads + .remove(this); + } + print("Download progress: $progress%"); + }, + options: Options( + responseType: ResponseType.bytes, + headers: {'authorization': "Bearer ${mx.accessToken}"}), + cancelToken: ct); print("Download completed and saved to $downloadPath/$name"); } } catch (e) { @@ -63,6 +63,7 @@ class Download { void cancel() async { ct.cancel(); + Provider.of(context).downloads.remove(this); } }