parent
b391425d48
commit
1f3c568d0c
@ -14,7 +14,7 @@ import 'package:moxxyv2/ui/pages/conversation/blink.dart';
|
|||||||
import 'package:moxxyv2/ui/pages/conversation/timer.dart';
|
import 'package:moxxyv2/ui/pages/conversation/timer.dart';
|
||||||
import 'package:moxxyv2/ui/service/data.dart';
|
import 'package:moxxyv2/ui/service/data.dart';
|
||||||
import 'package:moxxyv2/ui/theme.dart';
|
import 'package:moxxyv2/ui/theme.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/media.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/combined_picker.dart';
|
import 'package:moxxyv2/ui/widgets/combined_picker.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/textfield.dart';
|
import 'package:moxxyv2/ui/widgets/textfield.dart';
|
||||||
import 'package:phosphor_flutter/phosphor_flutter.dart';
|
import 'package:phosphor_flutter/phosphor_flutter.dart';
|
||||||
|
@ -6,7 +6,7 @@ import 'package:moxxyv2/ui/bloc/server_info_bloc.dart';
|
|||||||
import 'package:moxxyv2/ui/constants.dart';
|
import 'package:moxxyv2/ui/constants.dart';
|
||||||
import 'package:moxxyv2/ui/pages/profile/conversationheader.dart';
|
import 'package:moxxyv2/ui/pages/profile/conversationheader.dart';
|
||||||
import 'package:moxxyv2/ui/pages/profile/selfheader.dart';
|
import 'package:moxxyv2/ui/pages/profile/selfheader.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/shared/media.dart';
|
import 'package:moxxyv2/ui/widgets/chat/shared/base.dart';
|
||||||
|
|
||||||
class ProfilePage extends StatelessWidget {
|
class ProfilePage extends StatelessWidget {
|
||||||
const ProfilePage({super.key});
|
const ProfilePage({super.key});
|
||||||
|
@ -3,7 +3,7 @@ import 'package:moxxyv2/shared/helpers.dart';
|
|||||||
import 'package:moxxyv2/shared/models/media.dart';
|
import 'package:moxxyv2/shared/models/media.dart';
|
||||||
import 'package:moxxyv2/ui/constants.dart';
|
import 'package:moxxyv2/ui/constants.dart';
|
||||||
import 'package:moxxyv2/ui/controller/shared_media_controller.dart';
|
import 'package:moxxyv2/ui/controller/shared_media_controller.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/media.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/grouped_grid_view.dart';
|
import 'package:moxxyv2/ui/widgets/grouped_grid_view.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/topbar.dart';
|
import 'package:moxxyv2/ui/widgets/topbar.dart';
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import 'package:flutter_vibrate/flutter_vibrate.dart';
|
|||||||
import 'package:moxxyv2/shared/models/message.dart';
|
import 'package:moxxyv2/shared/models/message.dart';
|
||||||
import 'package:moxxyv2/shared/models/reaction.dart';
|
import 'package:moxxyv2/shared/models/reaction.dart';
|
||||||
import 'package:moxxyv2/ui/constants.dart';
|
import 'package:moxxyv2/ui/constants.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/media.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/reactionbubble.dart';
|
import 'package:moxxyv2/ui/widgets/chat/reactionbubble.dart';
|
||||||
import 'package:swipeable_tile/swipeable_tile.dart';
|
import 'package:swipeable_tile/swipeable_tile.dart';
|
||||||
|
|
||||||
|
@ -2,11 +2,12 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:moxxyv2/shared/models/media.dart';
|
import 'package:moxxyv2/shared/models/media.dart';
|
||||||
import 'package:moxxyv2/shared/models/message.dart';
|
import 'package:moxxyv2/shared/models/message.dart';
|
||||||
import 'package:moxxyv2/ui/helpers.dart';
|
import 'package:moxxyv2/ui/helpers.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/audio.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message/audio.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/file.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message/file.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/image.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message/image.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/sticker.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message/sticker.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/video.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message/text.dart';
|
||||||
|
import 'package:moxxyv2/ui/widgets/chat/message/video.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/playbutton.dart';
|
import 'package:moxxyv2/ui/widgets/chat/playbutton.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/quote/audio.dart';
|
import 'package:moxxyv2/ui/widgets/chat/quote/audio.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/quote/file.dart';
|
import 'package:moxxyv2/ui/widgets/chat/quote/file.dart';
|
||||||
@ -18,7 +19,6 @@ import 'package:moxxyv2/ui/widgets/chat/shared/audio.dart';
|
|||||||
import 'package:moxxyv2/ui/widgets/chat/shared/file.dart';
|
import 'package:moxxyv2/ui/widgets/chat/shared/file.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/shared/image.dart';
|
import 'package:moxxyv2/ui/widgets/chat/shared/image.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/shared/video.dart';
|
import 'package:moxxyv2/ui/widgets/chat/shared/video.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/text.dart';
|
|
||||||
|
|
||||||
enum MessageType {
|
enum MessageType {
|
||||||
text,
|
text,
|
@ -8,8 +8,8 @@ import 'package:moxxyv2/shared/helpers.dart';
|
|||||||
import 'package:moxxyv2/shared/models/message.dart';
|
import 'package:moxxyv2/shared/models/message.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/bottom.dart';
|
import 'package:moxxyv2/ui/widgets/chat/bottom.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/downloadbutton.dart';
|
import 'package:moxxyv2/ui/widgets/chat/downloadbutton.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/base.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message/base.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/file.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message/file.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/progress.dart';
|
import 'package:moxxyv2/ui/widgets/chat/progress.dart';
|
||||||
|
|
||||||
String doubleToTimestamp(double p) {
|
String doubleToTimestamp(double p) {
|
@ -7,7 +7,7 @@ import 'package:moxxyv2/shared/models/message.dart';
|
|||||||
import 'package:moxxyv2/ui/helpers.dart';
|
import 'package:moxxyv2/ui/helpers.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/bottom.dart';
|
import 'package:moxxyv2/ui/widgets/chat/bottom.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/downloadbutton.dart';
|
import 'package:moxxyv2/ui/widgets/chat/downloadbutton.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/base.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message/base.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/progress.dart';
|
import 'package:moxxyv2/ui/widgets/chat/progress.dart';
|
||||||
|
|
||||||
/// A base widget for sent/received files that cannot be displayed otherwise.
|
/// A base widget for sent/received files that cannot be displayed otherwise.
|
@ -9,8 +9,8 @@ import 'package:moxxyv2/ui/helpers.dart';
|
|||||||
import 'package:moxxyv2/ui/widgets/chat/bottom.dart';
|
import 'package:moxxyv2/ui/widgets/chat/bottom.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/downloadbutton.dart';
|
import 'package:moxxyv2/ui/widgets/chat/downloadbutton.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/helpers.dart';
|
import 'package:moxxyv2/ui/widgets/chat/helpers.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/base.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message/base.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/file.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message/file.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/progress.dart';
|
import 'package:moxxyv2/ui/widgets/chat/progress.dart';
|
||||||
|
|
||||||
class ImageChatWidget extends StatelessWidget {
|
class ImageChatWidget extends StatelessWidget {
|
@ -9,8 +9,8 @@ import 'package:moxxyv2/ui/helpers.dart';
|
|||||||
import 'package:moxxyv2/ui/widgets/chat/bottom.dart';
|
import 'package:moxxyv2/ui/widgets/chat/bottom.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/downloadbutton.dart';
|
import 'package:moxxyv2/ui/widgets/chat/downloadbutton.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/helpers.dart';
|
import 'package:moxxyv2/ui/widgets/chat/helpers.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/base.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message/base.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/file.dart';
|
import 'package:moxxyv2/ui/widgets/chat/message/file.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/playbutton.dart';
|
import 'package:moxxyv2/ui/widgets/chat/playbutton.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/progress.dart';
|
import 'package:moxxyv2/ui/widgets/chat/progress.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/video_thumbnail.dart';
|
import 'package:moxxyv2/ui/widgets/chat/video_thumbnail.dart';
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||||
import 'package:moxxyv2/shared/models/message.dart';
|
import 'package:moxxyv2/shared/models/message.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/quote/media.dart';
|
import 'package:moxxyv2/ui/widgets/chat/quote/base.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/shared/audio.dart';
|
import 'package:moxxyv2/ui/widgets/chat/shared/audio.dart';
|
||||||
|
|
||||||
class QuotedAudioWidget extends StatelessWidget {
|
class QuotedAudioWidget extends StatelessWidget {
|
||||||
|
@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:moxxyv2/shared/models/message.dart';
|
import 'package:moxxyv2/shared/models/message.dart';
|
||||||
import 'package:moxxyv2/ui/constants.dart';
|
import 'package:moxxyv2/ui/constants.dart';
|
||||||
import 'package:moxxyv2/ui/theme.dart';
|
import 'package:moxxyv2/ui/theme.dart';
|
||||||
|
import 'package:moxxyv2/ui/widgets/chat/quote/helpers.dart';
|
||||||
|
|
||||||
/// This Widget is used to show that a message has been quoted.
|
/// This Widget is used to show that a message has been quoted.
|
||||||
class QuoteBaseWidget extends StatelessWidget {
|
class QuoteBaseWidget extends StatelessWidget {
|
||||||
@ -89,3 +90,53 @@ class QuoteBaseWidget extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class QuotedMediaBaseWidget extends StatelessWidget {
|
||||||
|
const QuotedMediaBaseWidget(
|
||||||
|
this.message,
|
||||||
|
this.child,
|
||||||
|
this.text,
|
||||||
|
this.sent, {
|
||||||
|
this.resetQuote,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
final Message message;
|
||||||
|
final Widget child;
|
||||||
|
final String text;
|
||||||
|
final bool sent;
|
||||||
|
final void Function()? resetQuote;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return QuoteBaseWidget(
|
||||||
|
message,
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
child,
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 8),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
QuoteSenderText(
|
||||||
|
sender: message.sender,
|
||||||
|
resetQuoteNotNull: resetQuote != null,
|
||||||
|
sent: sent,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
text,
|
||||||
|
style: TextStyle(
|
||||||
|
color: getQuoteTextColor(context, resetQuote != null),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
sent,
|
||||||
|
resetQuotedMessage: resetQuote,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:moxxyv2/shared/helpers.dart';
|
import 'package:moxxyv2/shared/helpers.dart';
|
||||||
import 'package:moxxyv2/shared/models/message.dart';
|
import 'package:moxxyv2/shared/models/message.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/quote/media.dart';
|
import 'package:moxxyv2/ui/widgets/chat/quote/base.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/shared/file.dart';
|
import 'package:moxxyv2/ui/widgets/chat/shared/file.dart';
|
||||||
|
|
||||||
class QuotedFileWidget extends StatelessWidget {
|
class QuotedFileWidget extends StatelessWidget {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||||
import 'package:moxxyv2/shared/models/message.dart';
|
import 'package:moxxyv2/shared/models/message.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/quote/media.dart';
|
import 'package:moxxyv2/ui/widgets/chat/quote/base.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/shared/image.dart';
|
import 'package:moxxyv2/ui/widgets/chat/shared/image.dart';
|
||||||
|
|
||||||
class QuotedImageWidget extends StatelessWidget {
|
class QuotedImageWidget extends StatelessWidget {
|
||||||
|
@ -1,54 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:moxxyv2/shared/models/message.dart';
|
|
||||||
import 'package:moxxyv2/ui/widgets/chat/quote/base.dart';
|
|
||||||
import 'package:moxxyv2/ui/widgets/chat/quote/helpers.dart';
|
|
||||||
|
|
||||||
class QuotedMediaBaseWidget extends StatelessWidget {
|
|
||||||
const QuotedMediaBaseWidget(
|
|
||||||
this.message,
|
|
||||||
this.child,
|
|
||||||
this.text,
|
|
||||||
this.sent, {
|
|
||||||
this.resetQuote,
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
final Message message;
|
|
||||||
final Widget child;
|
|
||||||
final String text;
|
|
||||||
final bool sent;
|
|
||||||
final void Function()? resetQuote;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
return QuoteBaseWidget(
|
|
||||||
message,
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
child,
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 8),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
QuoteSenderText(
|
|
||||||
sender: message.sender,
|
|
||||||
resetQuoteNotNull: resetQuote != null,
|
|
||||||
sent: sent,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
text,
|
|
||||||
style: TextStyle(
|
|
||||||
color: getQuoteTextColor(context, resetQuote != null),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
sent,
|
|
||||||
resetQuotedMessage: resetQuote,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -5,7 +5,6 @@ import 'package:moxxyv2/shared/models/sticker.dart';
|
|||||||
import 'package:moxxyv2/ui/bloc/preferences_bloc.dart';
|
import 'package:moxxyv2/ui/bloc/preferences_bloc.dart';
|
||||||
import 'package:moxxyv2/ui/bloc/stickers_bloc.dart';
|
import 'package:moxxyv2/ui/bloc/stickers_bloc.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/quote/base.dart';
|
import 'package:moxxyv2/ui/widgets/chat/quote/base.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/quote/media.dart';
|
|
||||||
import 'package:moxxyv2/ui/widgets/chat/shared/image.dart';
|
import 'package:moxxyv2/ui/widgets/chat/shared/image.dart';
|
||||||
import 'package:phosphor_flutter/phosphor_flutter.dart';
|
import 'package:phosphor_flutter/phosphor_flutter.dart';
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||||
import 'package:moxxyv2/shared/models/message.dart';
|
import 'package:moxxyv2/shared/models/message.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/quote/media.dart';
|
import 'package:moxxyv2/ui/widgets/chat/quote/base.dart';
|
||||||
import 'package:moxxyv2/ui/widgets/chat/shared/video.dart';
|
import 'package:moxxyv2/ui/widgets/chat/shared/video.dart';
|
||||||
|
|
||||||
class QuotedVideoWidget extends StatelessWidget {
|
class QuotedVideoWidget extends StatelessWidget {
|
||||||
|
@ -1,4 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:moxxyv2/i18n/strings.g.dart';
|
||||||
|
import 'package:moxxyv2/shared/models/media.dart';
|
||||||
|
import 'package:moxxyv2/ui/widgets/chat/message.dart';
|
||||||
|
import 'package:moxxyv2/ui/widgets/chat/shared/summary.dart';
|
||||||
|
|
||||||
/// A class for adding a shadow to Containers which even works if the
|
/// A class for adding a shadow to Containers which even works if the
|
||||||
/// Container is transparent.
|
/// Container is transparent.
|
||||||
@ -62,3 +66,73 @@ class SharedMediaContainer extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class SharedMediaDisplay extends StatelessWidget {
|
||||||
|
const SharedMediaDisplay({
|
||||||
|
required this.preview,
|
||||||
|
required this.jid,
|
||||||
|
required this.title,
|
||||||
|
required this.sharedMediaAmount,
|
||||||
|
super.key,
|
||||||
|
});
|
||||||
|
|
||||||
|
/// The list of preview shared media items.
|
||||||
|
final List<SharedMedium> preview;
|
||||||
|
|
||||||
|
/// The JID of the conversation.
|
||||||
|
final String jid;
|
||||||
|
|
||||||
|
/// The title of the conversation.
|
||||||
|
final String title;
|
||||||
|
|
||||||
|
/// The total amount of shared media items associated with the conversation.
|
||||||
|
final int sharedMediaAmount;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
if (preview.isEmpty) return const SizedBox();
|
||||||
|
|
||||||
|
return Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
children: [
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(
|
||||||
|
top: 25,
|
||||||
|
left: 16,
|
||||||
|
right: 16,
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
t.pages.profile.conversation.sharedMedia,
|
||||||
|
style: Theme.of(context).textTheme.headlineSmall,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Padding(
|
||||||
|
padding: const EdgeInsets.only(top: 8, left: 16, right: 16),
|
||||||
|
child: Container(
|
||||||
|
alignment: Alignment.topLeft,
|
||||||
|
child: GridView(
|
||||||
|
shrinkWrap: true,
|
||||||
|
physics: const NeverScrollableScrollPhysics(),
|
||||||
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
|
crossAxisCount: 4,
|
||||||
|
mainAxisSpacing: 8,
|
||||||
|
crossAxisSpacing: 8,
|
||||||
|
),
|
||||||
|
children: preview.sublist(0, 8).map((el) {
|
||||||
|
if (el == preview.last && sharedMediaAmount >= 8) {
|
||||||
|
return SharedSummaryWidget(
|
||||||
|
notShown: sharedMediaAmount - 7,
|
||||||
|
conversationJid: jid,
|
||||||
|
conversationTitle: title,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return buildSharedMediaWidget(el, jid);
|
||||||
|
}).toList(),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,75 +0,0 @@
|
|||||||
import 'package:flutter/material.dart';
|
|
||||||
import 'package:moxxyv2/i18n/strings.g.dart';
|
|
||||||
import 'package:moxxyv2/shared/models/media.dart';
|
|
||||||
import 'package:moxxyv2/ui/widgets/chat/media/media.dart';
|
|
||||||
import 'package:moxxyv2/ui/widgets/chat/shared/summary.dart';
|
|
||||||
|
|
||||||
class SharedMediaDisplay extends StatelessWidget {
|
|
||||||
const SharedMediaDisplay({
|
|
||||||
required this.preview,
|
|
||||||
required this.jid,
|
|
||||||
required this.title,
|
|
||||||
required this.sharedMediaAmount,
|
|
||||||
super.key,
|
|
||||||
});
|
|
||||||
|
|
||||||
/// The list of preview shared media items.
|
|
||||||
final List<SharedMedium> preview;
|
|
||||||
|
|
||||||
/// The JID of the conversation.
|
|
||||||
final String jid;
|
|
||||||
|
|
||||||
/// The title of the conversation.
|
|
||||||
final String title;
|
|
||||||
|
|
||||||
/// The total amount of shared media items associated with the conversation.
|
|
||||||
final int sharedMediaAmount;
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context) {
|
|
||||||
if (preview.isEmpty) return const SizedBox();
|
|
||||||
|
|
||||||
return Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(
|
|
||||||
top: 25,
|
|
||||||
left: 16,
|
|
||||||
right: 16,
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
t.pages.profile.conversation.sharedMedia,
|
|
||||||
style: Theme.of(context).textTheme.headlineSmall,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.only(top: 8, left: 16, right: 16),
|
|
||||||
child: Container(
|
|
||||||
alignment: Alignment.topLeft,
|
|
||||||
child: GridView(
|
|
||||||
shrinkWrap: true,
|
|
||||||
physics: const NeverScrollableScrollPhysics(),
|
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
|
||||||
crossAxisCount: 4,
|
|
||||||
mainAxisSpacing: 8,
|
|
||||||
crossAxisSpacing: 8,
|
|
||||||
),
|
|
||||||
children: preview.sublist(0, 8).map((el) {
|
|
||||||
if (el == preview.last && sharedMediaAmount >= 8) {
|
|
||||||
return SharedSummaryWidget(
|
|
||||||
notShown: sharedMediaAmount - 7,
|
|
||||||
conversationJid: jid,
|
|
||||||
conversationTitle: title,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return buildSharedMediaWidget(el, jid);
|
|
||||||
}).toList(),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user