Fixup Malformed Sizes + Preview Contraints

This commit is contained in:
Sarah Jamie Lewis 2024-02-08 14:10:43 -08:00
parent abd32293eb
commit 659c7fe75e
3 changed files with 37 additions and 45 deletions

View File

@ -55,14 +55,14 @@ class FileMessage extends Message {
builder: (bcontext, child) {
dynamic shareObj = jsonDecode(this.content);
if (shareObj == null) {
return MessageRow(MalformedBubble(), 0);
return MalformedBubble();
}
String nameSuggestion = shareObj['f'] as String;
String rootHash = shareObj['h'] as String;
String nonce = shareObj['n'] as String;
int fileSize = shareObj['s'] as int;
if (!validHash(rootHash, nonce)) {
return MessageRow(MalformedBubble(), 0);
return MalformedBubble();
}
return Container(
alignment: Alignment.center,

View File

@ -40,7 +40,7 @@ class QuotedMessage extends Message {
);
var content = message["body"];
var formatMessages = Provider.of<Settings>(bcontext).isExperimentEnabled(FormattingExperiment);
return compileMessageContentWidget(context, constraints ?? BoxConstraints.expand(), false, content, FocusNode(), formatMessages, false);
return compileMessageContentWidget(context, constraints ?? BoxConstraints.loose(MediaQuery.sizeOf(context)), false, content, FocusNode(), formatMessages, false);
} catch (e) {
return MalformedBubble();
}

View File

@ -13,10 +13,7 @@ class MalformedBubble extends StatefulWidget {
class MalformedBubbleState extends State<MalformedBubble> {
@override
Widget build(BuildContext context) {
return LayoutBuilder(builder: (context, constraints) {
return Center(
widthFactor: 1.0,
child: Container(
return Container(
decoration: BoxDecoration(
color: malformedColor,
border: Border.all(color: malformedColor, width: 1),
@ -27,6 +24,8 @@ class MalformedBubbleState extends State<MalformedBubble> {
bottomRight: Radius.zero,
),
),
child: FittedBox(
fit: BoxFit.contain,
child: Center(
widthFactor: 1.0,
child: Padding(
@ -42,18 +41,11 @@ class MalformedBubbleState extends State<MalformedBubble> {
))),
Center(
widthFactor: 1.0,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Text(
child: Text(
AppLocalizations.of(context)!.malformedMessage,
overflow: TextOverflow.ellipsis,
)
],
textWidthBasis: TextWidthBasis.longestLine,
))
])))));
});
}
}