Handle viewing replies to images correctly
continuous-integration/drone/pr Build is passing
Details
continuous-integration/drone/pr Build is passing
Details
This commit is contained in:
parent
ad52f2e0c8
commit
7540aed701
|
@ -372,74 +372,80 @@ void modalShowReplies(
|
||||||
builder: (BuildContext bcontext) {
|
builder: (BuildContext bcontext) {
|
||||||
List<Message> replies = getReplies(cache, messageID);
|
List<Message> replies = getReplies(cache, messageID);
|
||||||
|
|
||||||
return LayoutBuilder(builder: (BuildContext context, BoxConstraints viewportConstraints) {
|
return ChangeNotifierProvider.value(
|
||||||
var replyWidgets = replies.map((e) {
|
value: profile,
|
||||||
var fromMe = e.getMetadata().senderHandle == profile.onion;
|
builder: (bcontext, child) {
|
||||||
|
return LayoutBuilder(builder: (BuildContext context, BoxConstraints viewportConstraints) {
|
||||||
|
var replyWidgets = replies.map((e) {
|
||||||
|
var fromMe = e.getMetadata().senderHandle == profile.onion;
|
||||||
|
|
||||||
var bubble = StaticMessageBubble(profile, settings, e.getMetadata(), Row(children: [Flexible(child: e.getPreviewWidget(context))]));
|
var bubble = StaticMessageBubble(profile, settings, e.getMetadata(), Row(children: [Flexible(child: e.getPreviewWidget(context))]));
|
||||||
|
|
||||||
String imagePath = e.getMetadata().senderImage!;
|
String imagePath = e.getMetadata().senderImage!;
|
||||||
var sender = profile.contactList.findContact(e.getMetadata().senderHandle);
|
var sender = profile.contactList.findContact(e.getMetadata().senderHandle);
|
||||||
if (sender != null) {
|
if (sender != null) {
|
||||||
imagePath = showImage ? sender.imagePath : sender.defaultImagePath;
|
imagePath = showImage ? sender.imagePath : sender.defaultImagePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fromMe) {
|
if (fromMe) {
|
||||||
imagePath = profile.imagePath;
|
imagePath = profile.imagePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
var image = Padding(
|
var image = Padding(
|
||||||
padding: EdgeInsets.all(4.0),
|
padding: EdgeInsets.all(4.0),
|
||||||
child: ProfileImage(
|
child: ProfileImage(
|
||||||
imagePath: imagePath,
|
imagePath: imagePath,
|
||||||
diameter: 48.0,
|
diameter: 48.0,
|
||||||
border: borderColor,
|
border: borderColor,
|
||||||
badgeTextColor: Colors.red,
|
badgeTextColor: Colors.red,
|
||||||
badgeColor: Colors.red,
|
badgeColor: Colors.red,
|
||||||
));
|
));
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.all(10.0),
|
padding: EdgeInsets.all(10.0),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [image, Flexible(child: bubble)],
|
children: [image, Flexible(child: bubble)],
|
||||||
));
|
));
|
||||||
}).toList();
|
}).toList();
|
||||||
|
|
||||||
var withHeader = replyWidgets;
|
var withHeader = replyWidgets;
|
||||||
|
|
||||||
var original = StaticMessageBubble(profile, settings, cache.cache[messageID]!.metadata, Row(children: [Flexible(child: compileOverlay(cache.cache[messageID]!).getPreviewWidget(context))]));
|
var original =
|
||||||
|
StaticMessageBubble(profile, settings, cache.cache[messageID]!.metadata, Row(children: [Flexible(child: compileOverlay(cache.cache[messageID]!).getPreviewWidget(context))]));
|
||||||
|
|
||||||
withHeader.insert(0, Padding(padding: EdgeInsets.fromLTRB(10.0, 10.0, 2.0, 15.0), child: Center(child: original)));
|
withHeader.insert(0, Padding(padding: EdgeInsets.fromLTRB(10.0, 10.0, 2.0, 15.0), child: Center(child: original)));
|
||||||
|
|
||||||
withHeader.insert(
|
withHeader.insert(
|
||||||
1,
|
1,
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.fromLTRB(10.0, 10.0, 2.0, 15.0),
|
padding: EdgeInsets.fromLTRB(10.0, 10.0, 2.0, 15.0),
|
||||||
child: Divider(
|
child: Divider(
|
||||||
color: settings.theme.mainTextColor,
|
color: settings.theme.mainTextColor,
|
||||||
)));
|
)));
|
||||||
|
|
||||||
if (replies.isNotEmpty) {
|
if (replies.isNotEmpty) {
|
||||||
withHeader.insert(2, Padding(padding: EdgeInsets.fromLTRB(10.0, 10.0, 2.0, 15.0), child: Text(replyHeader, style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold))));
|
withHeader.insert(2, Padding(padding: EdgeInsets.fromLTRB(10.0, 10.0, 2.0, 15.0), child: Text(replyHeader, style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold))));
|
||||||
} else {
|
} else {
|
||||||
withHeader.insert(2, Padding(padding: EdgeInsets.fromLTRB(10.0, 10.0, 2.0, 15.0), child: Center(child: Text(noRepliesText, style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold)))));
|
withHeader.insert(
|
||||||
}
|
2, Padding(padding: EdgeInsets.fromLTRB(10.0, 10.0, 2.0, 15.0), child: Center(child: Text(noRepliesText, style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold)))));
|
||||||
|
}
|
||||||
|
|
||||||
return Scrollbar(
|
return Scrollbar(
|
||||||
isAlwaysShown: true,
|
isAlwaysShown: true,
|
||||||
child: SingleChildScrollView(
|
child: SingleChildScrollView(
|
||||||
clipBehavior: Clip.antiAlias,
|
clipBehavior: Clip.antiAlias,
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: BoxConstraints(
|
constraints: BoxConstraints(
|
||||||
minHeight: viewportConstraints.maxHeight,
|
minHeight: viewportConstraints.maxHeight,
|
||||||
),
|
),
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 0.0, horizontal: 20.0),
|
padding: EdgeInsets.symmetric(vertical: 0.0, horizontal: 20.0),
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: withHeader,
|
children: withHeader,
|
||||||
)))));
|
)))));
|
||||||
});
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue