Fix debug layout errors + Fix Quoted File Message Layout
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Sarah Jamie Lewis 2022-12-29 20:27:25 -08:00 committed by Gitea
parent 23ae1ac0bb
commit bf05a52d63
6 changed files with 22 additions and 17 deletions

View File

@ -59,7 +59,7 @@ class FileMessage extends Message {
if (shareObj == null) { if (shareObj == null) {
return MessageRow(MalformedBubble(), 0); return MessageRow(MalformedBubble(), 0);
} }
String nameSuggestion = shareObj['n'] as String; String nameSuggestion = shareObj['f'] as String;
String rootHash = shareObj['h'] as String; String rootHash = shareObj['h'] as String;
String nonce = shareObj['n'] as String; String nonce = shareObj['n'] as String;
int fileSize = shareObj['s'] as int; int fileSize = shareObj['s'] as int;
@ -68,8 +68,7 @@ class FileMessage extends Message {
} }
return Container( return Container(
alignment: Alignment.center, alignment: Alignment.center,
width: 50, height: 100,
height: 50,
child: FileBubble( child: FileBubble(
nameSuggestion, nameSuggestion,
rootHash, rootHash,

View File

@ -28,12 +28,12 @@ class TextMessage extends Message {
return SelectableLinkify( return SelectableLinkify(
text: content + '\u202F', text: content + '\u202F',
options: LinkifyOptions(messageFormatting: formatMessages, parseLinks: false, looseUrl: true, defaultToHttps: true), options: LinkifyOptions(messageFormatting: formatMessages, parseLinks: false, looseUrl: true, defaultToHttps: true),
linkifiers: [UrlLinkifier()], linkifiers: [],
onOpen: null, onOpen: null,
textAlign: TextAlign.left, textAlign: TextAlign.left,
style: TextStyle(overflow: TextOverflow.ellipsis), style: TextStyle(overflow: TextOverflow.fade),
codeStyle: TextStyle(overflow: TextOverflow.ellipsis), codeStyle: TextStyle(overflow: TextOverflow.ellipsis),
textWidthBasis: TextWidthBasis.longestLine, textWidthBasis: TextWidthBasis.parent,
); );
}); });
} }

View File

@ -333,6 +333,7 @@ class SelectableLinkify extends StatelessWidget {
cursorHeight: cursorHeight, cursorHeight: cursorHeight,
selectionControls: selectionControls, selectionControls: selectionControls,
onSelectionChanged: onSelectionChanged, onSelectionChanged: onSelectionChanged,
style: style,
); );
} }
} }

View File

@ -149,6 +149,8 @@ class _MessageViewState extends State<MessageView> {
backgroundColor: Provider.of<Settings>(context).theme.backgroundMainColor, backgroundColor: Provider.of<Settings>(context).theme.backgroundMainColor,
floatingActionButton: showDown floatingActionButton: showDown
? FloatingActionButton( ? FloatingActionButton(
// heroTags need to be unique per screen (important when we pop up and down)...
heroTag: "popDown" + Provider.of<ContactInfoState>(context, listen: false).onion,
child: Icon(Icons.arrow_downward, color: Provider.of<Settings>(context).current().defaultButtonTextColor), child: Icon(Icons.arrow_downward, color: Provider.of<Settings>(context).current().defaultButtonTextColor),
onPressed: () { onPressed: () {
Provider.of<AppState>(context, listen: false).initialScrollIndex = 0; Provider.of<AppState>(context, listen: false).initialScrollIndex = 0;

View File

@ -2,6 +2,7 @@ import 'dart:io';
import 'dart:math'; import 'dart:math';
import 'package:cwtch/config.dart'; import 'package:cwtch/config.dart';
import 'package:cwtch/cwtch_icons_icons.dart';
import 'package:cwtch/models/contact.dart'; import 'package:cwtch/models/contact.dart';
import 'package:cwtch/models/filedownloadprogress.dart'; import 'package:cwtch/models/filedownloadprogress.dart';
import 'package:cwtch/models/message.dart'; import 'package:cwtch/models/message.dart';
@ -131,6 +132,13 @@ class FileBubbleState extends State<FileBubble> {
// we don't preview a non downloaded file... // we don't preview a non downloaded file...
if (widget.isPreview && myFile != null) { if (widget.isPreview && myFile != null) {
return getPreview(context); return getPreview(context);
} else if (widget.isPreview && myFile == null) {
return Row(
children: [
Icon(CwtchIcons.attached_file_2, size: 32, color: Provider.of<Settings>(context).theme.messageFromMeTextColor),
Flexible(child: Text(widget.nameSuggestion, style: TextStyle(color: Provider.of<Settings>(context).theme.messageFromMeTextColor)))
],
);
} }
return LayoutBuilder(builder: (bcontext, constraints) { return LayoutBuilder(builder: (bcontext, constraints) {
@ -329,7 +337,7 @@ class FileBubbleState extends State<FileBubble> {
maxLines: 4, maxLines: 4,
textWidthBasis: TextWidthBasis.parent, textWidthBasis: TextWidthBasis.parent,
), ),
leading: Icon(Icons.attach_file, size: 32, color: Provider.of<Settings>(context).theme.messageFromMeTextColor)); leading: Icon(CwtchIcons.attached_file_2, size: 32, color: Provider.of<Settings>(context).theme.messageFromMeTextColor));
} }
// Construct an file chrome // Construct an file chrome
@ -377,7 +385,7 @@ class FileBubbleState extends State<FileBubble> {
maxLines: 4, maxLines: 4,
textWidthBasis: TextWidthBasis.parent, textWidthBasis: TextWidthBasis.parent,
), ),
leading: Icon(Icons.attach_file, size: 32, color: Provider.of<Settings>(context).theme.messageFromOtherTextColor), leading: Icon(CwtchIcons.attached_file_2, size: 32, color: Provider.of<Settings>(context).theme.messageFromOtherTextColor),
trailing: Visibility( trailing: Visibility(
visible: speed != "0 B/s", visible: speed != "0 B/s",
child: SelectableText( child: SelectableText(

View File

@ -125,16 +125,11 @@ class QuotedMessageBubbleState extends State<QuotedMessageBubble> {
height: 75, height: 75,
child: Column(children: [ child: Column(children: [
Align(alignment: Alignment.centerLeft, child: wdgReplyingTo), Align(alignment: Alignment.centerLeft, child: wdgReplyingTo),
Row(mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.start, children: [ Flexible(
child: Row(mainAxisSize: MainAxisSize.max, mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, children: [
Padding(padding: EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0), child: Icon(Icons.reply, size: 32, color: qTextColor)), Padding(padding: EdgeInsets.symmetric(vertical: 5.0, horizontal: 10.0), child: Icon(Icons.reply, size: 32, color: qTextColor)),
Flexible( Flexible(child: qMessage.getPreviewWidget(context)),
child: DefaultTextStyle( ]))
textWidthBasis: TextWidthBasis.parent,
child: qMessage.getPreviewWidget(context),
style: TextStyle(color: qTextColor),
overflow: TextOverflow.fade,
))
])
])))); ]))));
} catch (e) { } catch (e) {
return MalformedBubble(); return MalformedBubble();