chore: Follow up search
This commit is contained in:
parent
e40e24e97d
commit
b20b599ce4
5 changed files with 32 additions and 25 deletions
|
|
@ -2540,7 +2540,7 @@
|
|||
"chat": {}
|
||||
}
|
||||
},
|
||||
"photos": "Photos",
|
||||
"gallery": "Gallery",
|
||||
"files": "Files",
|
||||
"databaseBuildErrorBody": "Unable to build the SQlite database. The app tries to use the legacy database for now. Please report this error to the developers at {url}. The error message is: {error}",
|
||||
"@databaseBuildErrorBody": {
|
||||
|
|
|
|||
|
|
@ -155,10 +155,7 @@ class MessageContent extends StatelessWidget {
|
|||
}
|
||||
return MessageDownloadContent(event, textColor);
|
||||
case MessageTypes.Video:
|
||||
if (PlatformInfos.isMobile || PlatformInfos.isWeb) {
|
||||
return EventVideoPlayer(event);
|
||||
}
|
||||
return MessageDownloadContent(event, textColor);
|
||||
return EventVideoPlayer(event);
|
||||
case MessageTypes.File:
|
||||
return MessageDownloadContent(event, textColor);
|
||||
|
||||
|
|
|
|||
|
|
@ -10,9 +10,11 @@ import 'package:path_provider/path_provider.dart';
|
|||
import 'package:universal_html/html.dart' as html;
|
||||
import 'package:video_player/video_player.dart';
|
||||
|
||||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pages/chat/events/image_bubble.dart';
|
||||
import 'package:fluffychat/utils/localized_exception_extension.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/event_extension.dart';
|
||||
import 'package:fluffychat/utils/platform_infos.dart';
|
||||
import 'package:fluffychat/widgets/blur_hash.dart';
|
||||
import '../../../utils/error_reporter.dart';
|
||||
|
||||
|
|
@ -31,6 +33,10 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
|||
File? _tmpFile;
|
||||
|
||||
void _downloadAction() async {
|
||||
if (PlatformInfos.isDesktop) {
|
||||
widget.event.saveFile(context);
|
||||
return;
|
||||
}
|
||||
setState(() => _isDownloading = true);
|
||||
try {
|
||||
final videoFile = await widget.event.downloadAndDecryptAttachment();
|
||||
|
|
@ -98,6 +104,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
|||
final chewieManager = _chewieManager;
|
||||
return Material(
|
||||
color: Colors.black,
|
||||
borderRadius: BorderRadius.circular(AppConfig.borderRadius),
|
||||
child: SizedBox(
|
||||
height: 300,
|
||||
child: chewieManager != null
|
||||
|
|
@ -114,9 +121,10 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
|||
else
|
||||
BlurHash(blurhash: blurHash, width: 300, height: 300),
|
||||
Center(
|
||||
child: OutlinedButton.icon(
|
||||
style: OutlinedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context).colorScheme.surface,
|
||||
child: IconButton(
|
||||
style: IconButton.styleFrom(
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.background,
|
||||
),
|
||||
icon: _isDownloading
|
||||
? const SizedBox(
|
||||
|
|
@ -126,14 +134,12 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
|||
strokeWidth: 2,
|
||||
),
|
||||
)
|
||||
: const Icon(Icons.download_outlined),
|
||||
label: Text(
|
||||
_isDownloading
|
||||
? L10n.of(context)!.loadingPleaseWait
|
||||
: L10n.of(context)!.videoWithSize(
|
||||
widget.event.sizeString ?? '?MB',
|
||||
),
|
||||
),
|
||||
: const Icon(Icons.play_circle_outlined),
|
||||
tooltip: _isDownloading
|
||||
? L10n.of(context)!.loadingPleaseWait
|
||||
: L10n.of(context)!.videoWithSize(
|
||||
widget.event.sizeString ?? '?MB',
|
||||
),
|
||||
onPressed: _isDownloading ? null : _downloadAction,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import 'package:intl/intl.dart';
|
|||
import 'package:matrix/matrix.dart';
|
||||
|
||||
import 'package:fluffychat/pages/chat/events/image_bubble.dart';
|
||||
import 'package:fluffychat/pages/chat/events/video_player.dart';
|
||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||
|
||||
class ChatSearchImagesTab extends StatelessWidget {
|
||||
|
|
@ -146,14 +147,17 @@ class ChatSearchImagesTab extends StatelessWidget {
|
|||
crossAxisSpacing: padding,
|
||||
padding: const EdgeInsets.all(padding),
|
||||
crossAxisCount: 3,
|
||||
children: monthEvents
|
||||
.map(
|
||||
(event) => ImageBubble(
|
||||
event,
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
children: monthEvents.map(
|
||||
(event) {
|
||||
if (event.messageType == MessageTypes.Video) {
|
||||
return EventVideoPlayer(event);
|
||||
}
|
||||
return ImageBubble(
|
||||
event,
|
||||
fit: BoxFit.cover,
|
||||
);
|
||||
},
|
||||
).toList(),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ class ChatSearchView extends StatelessWidget {
|
|||
controller: controller.tabController,
|
||||
tabs: [
|
||||
Tab(child: Text(L10n.of(context)!.messages)),
|
||||
Tab(child: Text(L10n.of(context)!.photos)),
|
||||
Tab(child: Text(L10n.of(context)!.gallery)),
|
||||
Tab(child: Text(L10n.of(context)!.files)),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue