fix: Image search rendering problem
This commit is contained in:
parent
d7ac0aa605
commit
59648bf2d7
4 changed files with 33 additions and 9 deletions
|
|
@ -14,7 +14,6 @@ class ImageBubble extends StatelessWidget {
|
||||||
final Event event;
|
final Event event;
|
||||||
final bool tapToView;
|
final bool tapToView;
|
||||||
final BoxFit fit;
|
final BoxFit fit;
|
||||||
final bool maxSize;
|
|
||||||
final Color? backgroundColor;
|
final Color? backgroundColor;
|
||||||
final Color? textColor;
|
final Color? textColor;
|
||||||
final Color? linkColor;
|
final Color? linkColor;
|
||||||
|
|
@ -29,7 +28,6 @@ class ImageBubble extends StatelessWidget {
|
||||||
const ImageBubble(
|
const ImageBubble(
|
||||||
this.event, {
|
this.event, {
|
||||||
this.tapToView = true,
|
this.tapToView = true,
|
||||||
this.maxSize = true,
|
|
||||||
this.backgroundColor,
|
this.backgroundColor,
|
||||||
this.fit = BoxFit.contain,
|
this.fit = BoxFit.contain,
|
||||||
this.thumbnailOnly = true,
|
this.thumbnailOnly = true,
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ class NaviRailItem extends StatelessWidget {
|
||||||
borderRadius: borderRadius,
|
borderRadius: borderRadius,
|
||||||
color: isSelected
|
color: isSelected
|
||||||
? theme.colorScheme.primaryContainer
|
? theme.colorScheme.primaryContainer
|
||||||
: theme.colorScheme.surfaceBright,
|
: theme.colorScheme.surfaceContainerHigh,
|
||||||
child: Tooltip(
|
child: Tooltip(
|
||||||
message: toolTip,
|
message: toolTip,
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,11 @@ import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:intl/intl.dart';
|
import 'package:intl/intl.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
import 'package:fluffychat/pages/chat/events/image_bubble.dart';
|
import 'package:fluffychat/config/app_config.dart';
|
||||||
import 'package:fluffychat/pages/chat/events/video_player.dart';
|
import 'package:fluffychat/pages/chat/events/video_player.dart';
|
||||||
|
import 'package:fluffychat/pages/image_viewer/image_viewer.dart';
|
||||||
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
import 'package:fluffychat/utils/matrix_sdk_extensions/matrix_locals.dart';
|
||||||
|
import 'package:fluffychat/widgets/mxc_image.dart';
|
||||||
|
|
||||||
class ChatSearchImagesTab extends StatelessWidget {
|
class ChatSearchImagesTab extends StatelessWidget {
|
||||||
final Room room;
|
final Room room;
|
||||||
|
|
@ -25,6 +27,7 @@ class ChatSearchImagesTab extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final borderRadius = BorderRadius.circular(AppConfig.borderRadius / 2);
|
||||||
return StreamBuilder(
|
return StreamBuilder(
|
||||||
stream: searchStream,
|
stream: searchStream,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
|
|
@ -144,16 +147,39 @@ class ChatSearchImagesTab extends StatelessWidget {
|
||||||
shrinkWrap: true,
|
shrinkWrap: true,
|
||||||
mainAxisSpacing: padding,
|
mainAxisSpacing: padding,
|
||||||
crossAxisSpacing: padding,
|
crossAxisSpacing: padding,
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
padding: const EdgeInsets.all(padding),
|
padding: const EdgeInsets.all(padding),
|
||||||
crossAxisCount: 3,
|
crossAxisCount: 3,
|
||||||
children: monthEvents.map(
|
children: monthEvents.map(
|
||||||
(event) {
|
(event) {
|
||||||
if (event.messageType == MessageTypes.Video) {
|
if (event.messageType == MessageTypes.Video) {
|
||||||
return EventVideoPlayer(event);
|
return Material(
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
borderRadius: borderRadius,
|
||||||
|
child: EventVideoPlayer(event),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return ImageBubble(
|
return InkWell(
|
||||||
event,
|
onTap: () => showDialog(
|
||||||
fit: BoxFit.cover,
|
context: context,
|
||||||
|
builder: (_) => ImageViewer(
|
||||||
|
event,
|
||||||
|
outerContext: context,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
borderRadius: borderRadius,
|
||||||
|
child: Material(
|
||||||
|
clipBehavior: Clip.hardEdge,
|
||||||
|
borderRadius: borderRadius,
|
||||||
|
child: MxcImage(
|
||||||
|
event: event,
|
||||||
|
width: 128,
|
||||||
|
height: 128,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
animated: true,
|
||||||
|
isThumbnail: true,
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
).toList(),
|
).toList(),
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ class ChatSearchView extends StatelessWidget {
|
||||||
enabled: controller.tabController.index == 0,
|
enabled: controller.tabController.index == 0,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
hintText: L10n.of(context).search,
|
hintText: L10n.of(context).search,
|
||||||
suffixIcon: const Icon(Icons.search_outlined),
|
prefixIcon: const Icon(Icons.search_outlined),
|
||||||
filled: true,
|
filled: true,
|
||||||
fillColor: theme.colorScheme.secondaryContainer,
|
fillColor: theme.colorScheme.secondaryContainer,
|
||||||
border: OutlineInputBorder(
|
border: OutlineInputBorder(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue