Prevent Layout Errors Caused By Pathological Unicode
This commit is contained in:
parent
8ef40af6ad
commit
af2815957d
|
@ -159,7 +159,6 @@ class CwtchFfi implements Cwtch {
|
|||
cwtchDir = envVars['CWTCH_HOME'] ?? path.join(envVars['HOME']!, ".cwtch");
|
||||
}
|
||||
|
||||
|
||||
if (await File("linux/Tor/tor").exists()) {
|
||||
bundledTor = "linux/Tor/tor";
|
||||
} else if (await File("lib/Tor/tor").exists()) {
|
||||
|
@ -788,7 +787,6 @@ class CwtchFfi implements Cwtch {
|
|||
|
||||
@override
|
||||
String? defaultDownloadPath() {
|
||||
|
||||
Map<String, String> envVars = Platform.environment;
|
||||
String nominalPath = path.join(envVars[Platform.isWindows ? 'UserProfile' : 'HOME']!, "Downloads");
|
||||
if (Directory(nominalPath).existsSync() == false) {
|
||||
|
|
|
@ -71,7 +71,6 @@ class FlwtchState extends State<Flwtch> with WindowListener {
|
|||
|
||||
@override
|
||||
initState() {
|
||||
|
||||
globalSettings = Settings(Locale("en", ''), CwtchDark());
|
||||
globalErrorHandler = ErrorHandler();
|
||||
globalTorStatus = TorStatus();
|
||||
|
@ -204,7 +203,8 @@ class FlwtchState extends State<Flwtch> with WindowListener {
|
|||
print("Exiting...");
|
||||
exit(0);
|
||||
}
|
||||
};
|
||||
}
|
||||
;
|
||||
}
|
||||
|
||||
// Invoked via notificationClickChannel by MyBroadcastReceiver in MainActivity.kt
|
||||
|
|
|
@ -69,5 +69,4 @@ class ProfileServerListState extends ChangeNotifier {
|
|||
}
|
||||
|
||||
List<RemoteServerInfoState> get servers => _servers.sublist(0); //todo: copy?? dont want caller able to bypass changenotifier
|
||||
|
||||
}
|
||||
|
|
|
@ -68,7 +68,6 @@ class ServerListState extends ChangeNotifier {
|
|||
}
|
||||
|
||||
List<ServerInfoState> get servers => _servers.sublist(0); //todo: copy?? dont want caller able to bypass changenotifier
|
||||
|
||||
}
|
||||
|
||||
class ServerInfoState extends ChangeNotifier {
|
||||
|
|
|
@ -154,7 +154,6 @@ class NixNotificationManager implements NotificationsManager {
|
|||
}
|
||||
|
||||
NotificationsManager newDesktopNotificationsManager(Future<void> Function(String profileOnion, int convoId) notificationSelectConvo) {
|
||||
|
||||
// We don't want notifications in Dev Mode
|
||||
if (EnvironmentConfig.TEST_MODE) {
|
||||
return NullNotificationsManager();
|
||||
|
|
|
@ -294,7 +294,10 @@ class SelectableLinkify extends StatelessWidget {
|
|||
linkifiers: linkifiers,
|
||||
);
|
||||
|
||||
return SelectableText.rich(
|
||||
return Container(
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(),
|
||||
child: SelectableText.rich(
|
||||
buildTextSpan(
|
||||
elements,
|
||||
style: Theme.of(context).textTheme.bodyText2?.merge(style),
|
||||
|
@ -334,7 +337,7 @@ class SelectableLinkify extends StatelessWidget {
|
|||
selectionControls: selectionControls,
|
||||
onSelectionChanged: onSelectionChanged,
|
||||
style: style,
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -46,7 +46,11 @@ class _GroupSettingsViewState extends State<GroupSettingsView> {
|
|||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(Provider.of<ContactInfoState>(context).nickname + " " + AppLocalizations.of(context)!.conversationSettings),
|
||||
title: Container(
|
||||
height: 24,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(),
|
||||
child: Text(Provider.of<ContactInfoState>(context).nickname + " " + AppLocalizations.of(context)!.conversationSettings)),
|
||||
),
|
||||
body: _buildSettingsList(),
|
||||
);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
import 'dart:math';
|
||||
import 'dart:ui';
|
||||
import 'package:crypto/crypto.dart';
|
||||
import 'package:cwtch/cwtch/cwtch.dart';
|
||||
|
@ -208,10 +209,15 @@ class _MessageViewState extends State<MessageView> {
|
|||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
height: 24,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(),
|
||||
child: Text(
|
||||
Provider.of<ContactInfoState>(context).nickname,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
))
|
||||
overflow: TextOverflow.clip,
|
||||
maxLines: 1,
|
||||
)))
|
||||
]),
|
||||
actions: appBarButtons,
|
||||
),
|
||||
|
@ -574,7 +580,7 @@ class _MessageViewState extends State<MessageView> {
|
|||
keyboardType: TextInputType.multiline,
|
||||
enableIMEPersonalizedLearning: false,
|
||||
minLines: 1,
|
||||
maxLength: (isGroup ? GroupMessageLengthMax : P2PMessageLengthMax) - numberOfBytesMoreThanChar,
|
||||
maxLength: max(1, (isGroup ? GroupMessageLengthMax : P2PMessageLengthMax) - numberOfBytesMoreThanChar),
|
||||
maxLengthEnforcement: MaxLengthEnforcement.enforced,
|
||||
maxLines: 3,
|
||||
onFieldSubmitted: _sendMessage,
|
||||
|
|
|
@ -47,7 +47,7 @@ class _PeerSettingsViewState extends State<PeerSettingsView> {
|
|||
}
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text(handle + " " + AppLocalizations.of(context)!.conversationSettings),
|
||||
title: Container(height: 24, clipBehavior: Clip.hardEdge, decoration: BoxDecoration(), child: Text(handle + " " + AppLocalizations.of(context)!.conversationSettings)),
|
||||
),
|
||||
body: _buildSettingsList(),
|
||||
);
|
||||
|
|
|
@ -44,7 +44,10 @@ class _CwtchButtonTextFieldState extends State<CwtchButtonTextField> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<Settings>(builder: (context, theme, child) {
|
||||
return TextFormField(
|
||||
return Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(),
|
||||
child: TextFormField(
|
||||
key: widget.testKey,
|
||||
controller: widget.controller,
|
||||
readOnly: widget.readonly,
|
||||
|
@ -52,6 +55,8 @@ class _CwtchButtonTextFieldState extends State<CwtchButtonTextField> {
|
|||
focusNode: _focusNode,
|
||||
enableIMEPersonalizedLearning: false,
|
||||
onChanged: widget.onChanged,
|
||||
maxLines: 1,
|
||||
style: TextStyle(overflow: TextOverflow.clip),
|
||||
decoration: InputDecoration(
|
||||
labelText: widget.labelText,
|
||||
labelStyle: TextStyle(color: theme.current().mainTextColor, backgroundColor: theme.current().textfieldBackgroundColor),
|
||||
|
@ -79,7 +84,7 @@ class _CwtchButtonTextFieldState extends State<CwtchButtonTextField> {
|
|||
),
|
||||
contentPadding: EdgeInsets.fromLTRB(20.0, 10.0, 20.0, 10.0),
|
||||
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 1.0))),
|
||||
);
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -64,7 +64,11 @@ class _ContactRowState extends State<ContactRow> {
|
|||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
Container(
|
||||
height: 24,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(),
|
||||
child: Text(
|
||||
contact.nickname, //(contact.isInvitation ? "invite " : "non-invite ") + (contact.isBlocked ? "blokt" : "nonblokt"),//
|
||||
|
||||
style: TextStyle(
|
||||
|
@ -73,8 +77,9 @@ class _ContactRowState extends State<ContactRow> {
|
|||
? Provider.of<Settings>(context).theme.portraitBlockedTextColor
|
||||
: Provider.of<Settings>(context).theme.mainTextColor), //Provider.of<FlwtchState>(context).biggerFont,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.visible,
|
||||
),
|
||||
overflow: TextOverflow.clip,
|
||||
maxLines: 1,
|
||||
)),
|
||||
syncStatus ?? Container(),
|
||||
Visibility(
|
||||
visible: !Provider.of<Settings>(context).streamerMode,
|
||||
|
|
|
@ -144,8 +144,12 @@ class FileBubbleState extends State<FileBubble> {
|
|||
return LayoutBuilder(builder: (bcontext, constraints) {
|
||||
var wdgSender = Visibility(
|
||||
visible: widget.interactive,
|
||||
child: Container(
|
||||
height: 11,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(),
|
||||
child: SelectableText(senderDisplayStr + '\u202F',
|
||||
style: TextStyle(fontSize: 9.0, color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeTextColor : Provider.of<Settings>(context).theme.messageFromOtherTextColor)));
|
||||
style: TextStyle(fontSize: 9.0, color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeTextColor : Provider.of<Settings>(context).theme.messageFromOtherTextColor))));
|
||||
var isPreview = false;
|
||||
var wdgMessage = !showFileSharing
|
||||
? Text(AppLocalizations.of(context)!.messageEnableFileSharing)
|
||||
|
|
|
@ -42,8 +42,17 @@ class MessageBubbleState extends State<MessageBubble> {
|
|||
senderDisplayStr = Provider.of<MessageMetadata>(context).senderHandle;
|
||||
}
|
||||
}
|
||||
var wdgSender = SelectableText(senderDisplayStr,
|
||||
style: TextStyle(fontSize: 9.0, color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeTextColor : Provider.of<Settings>(context).theme.messageFromOtherTextColor));
|
||||
var wdgSender = Container(
|
||||
height: 11,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(),
|
||||
child: SelectableText(senderDisplayStr,
|
||||
maxLines: 1,
|
||||
style: TextStyle(
|
||||
fontSize: 9.0,
|
||||
overflow: TextOverflow.clip,
|
||||
color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeTextColor : Provider.of<Settings>(context).theme.messageFromOtherTextColor,
|
||||
)));
|
||||
|
||||
var wdgMessage = SelectableLinkify(
|
||||
text: widget.content + '\u202F',
|
||||
|
|
|
@ -44,13 +44,17 @@ class _ProfileRowState extends State<ProfileRow> {
|
|||
Expanded(
|
||||
child: Column(
|
||||
children: [
|
||||
Text(
|
||||
Container(
|
||||
height: 24,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(),
|
||||
child: Text(
|
||||
profile.nickname,
|
||||
semanticsLabel: profile.nickname,
|
||||
style: Provider.of<FlwtchState>(context).biggerFont,
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
)),
|
||||
Visibility(
|
||||
visible: !Provider.of<Settings>(context).streamerMode,
|
||||
child: ExcludeSemantics(
|
||||
|
|
|
@ -43,8 +43,12 @@ class QuotedMessageBubbleState extends State<QuotedMessageBubble> {
|
|||
}
|
||||
}
|
||||
|
||||
var wdgSender = SelectableText(senderDisplayStr,
|
||||
style: TextStyle(fontSize: 9.0, color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeTextColor : Provider.of<Settings>(context).theme.messageFromOtherTextColor));
|
||||
var wdgSender = Container(
|
||||
height: 11,
|
||||
clipBehavior: Clip.hardEdge,
|
||||
decoration: BoxDecoration(),
|
||||
child: SelectableText(senderDisplayStr,
|
||||
style: TextStyle(fontSize: 9.0, color: fromMe ? Provider.of<Settings>(context).theme.messageFromMeTextColor : Provider.of<Settings>(context).theme.messageFromOtherTextColor)));
|
||||
|
||||
var showClickableLinks = Provider.of<Settings>(context).isExperimentEnabled(ClickableLinksExperiment);
|
||||
var formatMessages = Provider.of<Settings>(context).isExperimentEnabled(FormattingExperiment);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
@ -42,7 +43,10 @@ class _CwtchTextFieldState extends State<CwtchTextField> {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Consumer<Settings>(builder: (context, theme, child) {
|
||||
return TextFormField(
|
||||
return Container(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
decoration: BoxDecoration(),
|
||||
child: TextFormField(
|
||||
key: widget.testKey,
|
||||
controller: widget.controller,
|
||||
validator: widget.validator,
|
||||
|
@ -60,6 +64,7 @@ class _CwtchTextFieldState extends State<CwtchTextField> {
|
|||
scrollController: _scrollController,
|
||||
enableIMEPersonalizedLearning: false,
|
||||
focusNode: _focusNode,
|
||||
style: TextStyle(overflow: TextOverflow.clip),
|
||||
decoration: InputDecoration(
|
||||
errorMaxLines: 2,
|
||||
hintText: widget.hintText,
|
||||
|
@ -72,7 +77,7 @@ class _CwtchTextFieldState extends State<CwtchTextField> {
|
|||
fillColor: theme.current().textfieldBackgroundColor,
|
||||
contentPadding: EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0),
|
||||
enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(6.0), borderSide: BorderSide(color: theme.current().textfieldBorderColor, width: 1.0))),
|
||||
);
|
||||
));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue