forked from cwtch.im/cwtch-ui
Compare commits
3 Commits
Author | SHA1 | Date |
---|---|---|
Sarah Jamie Lewis | 1c79e0842c | |
Sarah Jamie Lewis | e37fb54fd4 | |
Sarah Jamie Lewis | cb582751b2 |
|
@ -123,6 +123,7 @@ class FlwtchState extends State<Flwtch> with WindowListener {
|
|||
key: Key('app'),
|
||||
navigatorKey: navKey,
|
||||
locale: settings.locale,
|
||||
showPerformanceOverlay: false,
|
||||
localizationsDelegates: <LocalizationsDelegate<dynamic>>[
|
||||
AppLocalizations.delegate,
|
||||
MaterialLocalizationDelegate(),
|
||||
|
|
|
@ -59,7 +59,7 @@ class FileMessage extends Message {
|
|||
if (shareObj == null) {
|
||||
return MessageRow(MalformedBubble(), 0);
|
||||
}
|
||||
String nameSuggestion = shareObj['n'] as String;
|
||||
String nameSuggestion = shareObj['f'] as String;
|
||||
String rootHash = shareObj['h'] as String;
|
||||
String nonce = shareObj['n'] as String;
|
||||
int fileSize = shareObj['s'] as int;
|
||||
|
@ -68,8 +68,7 @@ class FileMessage extends Message {
|
|||
}
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
width: 50,
|
||||
height: 50,
|
||||
height: 100,
|
||||
child: FileBubble(
|
||||
nameSuggestion,
|
||||
rootHash,
|
||||
|
|
|
@ -28,12 +28,12 @@ class TextMessage extends Message {
|
|||
return SelectableLinkify(
|
||||
text: content + '\u202F',
|
||||
options: LinkifyOptions(messageFormatting: formatMessages, parseLinks: false, looseUrl: true, defaultToHttps: true),
|
||||
linkifiers: [UrlLinkifier()],
|
||||
linkifiers: [],
|
||||
onOpen: null,
|
||||
textAlign: TextAlign.left,
|
||||
style: TextStyle(overflow: TextOverflow.ellipsis),
|
||||
style: TextStyle(overflow: TextOverflow.fade),
|
||||
codeStyle: TextStyle(overflow: TextOverflow.ellipsis),
|
||||
textWidthBasis: TextWidthBasis.longestLine,
|
||||
textWidthBasis: TextWidthBasis.parent,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -122,12 +122,15 @@ class Linkify extends StatelessWidget {
|
|||
linkifiers: linkifiers,
|
||||
);
|
||||
|
||||
return Text.rich(
|
||||
buildTextSpan(
|
||||
return SelectionArea(
|
||||
child: RichText(
|
||||
selectionRegistrar: SelectionContainer.maybeOf(context),
|
||||
text: buildTextSpan(
|
||||
elements,
|
||||
style: Theme.of(context).textTheme.bodyText2?.merge(style),
|
||||
onOpen: onOpen,
|
||||
useMouseRegion: true,
|
||||
context: context,
|
||||
linkStyle: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyText2
|
||||
|
@ -148,7 +151,7 @@ class Linkify extends StatelessWidget {
|
|||
locale: locale,
|
||||
textWidthBasis: textWidthBasis,
|
||||
textHeightBehavior: textHeightBehavior,
|
||||
);
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -297,6 +300,7 @@ class SelectableLinkify extends StatelessWidget {
|
|||
style: Theme.of(context).textTheme.bodyText2?.merge(style),
|
||||
codeStyle: Theme.of(context).textTheme.bodyText2?.merge(codeStyle),
|
||||
onOpen: onOpen,
|
||||
context: context,
|
||||
linkStyle: Theme.of(context)
|
||||
.textTheme
|
||||
.bodyText2
|
||||
|
@ -329,6 +333,7 @@ class SelectableLinkify extends StatelessWidget {
|
|||
cursorHeight: cursorHeight,
|
||||
selectionControls: selectionControls,
|
||||
onSelectionChanged: onSelectionChanged,
|
||||
style: style,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -337,11 +342,13 @@ class LinkableSpan extends WidgetSpan {
|
|||
LinkableSpan({
|
||||
required MouseCursor mouseCursor,
|
||||
required InlineSpan inlineSpan,
|
||||
required BuildContext context,
|
||||
}) : super(
|
||||
child: MouseRegion(
|
||||
cursor: mouseCursor,
|
||||
child: Text.rich(
|
||||
inlineSpan,
|
||||
child: RichText(
|
||||
text: inlineSpan,
|
||||
selectionRegistrar: SelectionContainer.maybeOf(context),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
@ -354,6 +361,7 @@ TextSpan buildTextSpan(
|
|||
TextStyle? linkStyle,
|
||||
TextStyle? codeStyle,
|
||||
LinkCallback? onOpen,
|
||||
required BuildContext context,
|
||||
bool useMouseRegion = false,
|
||||
}) {
|
||||
return TextSpan(
|
||||
|
@ -361,20 +369,18 @@ TextSpan buildTextSpan(
|
|||
(element) {
|
||||
if (element is LinkableElement) {
|
||||
if (useMouseRegion) {
|
||||
return TooltipSpan(
|
||||
message: element.url,
|
||||
inlineSpan: LinkableSpan(
|
||||
mouseCursor: SystemMouseCursors.click,
|
||||
inlineSpan: TextSpan(text: element.text, style: linkStyle, recognizer: onOpen != null ? (TapGestureRecognizer()..onTap = () => onOpen(element)) : null, semanticsLabel: element.text),
|
||||
));
|
||||
return TextSpan(
|
||||
text: element.text,
|
||||
style: linkStyle,
|
||||
mouseCursor: SystemMouseCursors.click,
|
||||
recognizer: onOpen != null ? (TapGestureRecognizer()..onTap = () => onOpen(element)) : null,
|
||||
semanticsLabel: element.text);
|
||||
} else {
|
||||
return TooltipSpan(
|
||||
message: element.url,
|
||||
inlineSpan: TextSpan(
|
||||
text: element.text,
|
||||
style: linkStyle,
|
||||
recognizer: onOpen != null ? (TapGestureRecognizer()..onTap = () => onOpen(element)) : null,
|
||||
));
|
||||
return TextSpan(
|
||||
text: element.text,
|
||||
style: linkStyle,
|
||||
recognizer: onOpen != null ? (TapGestureRecognizer()..onTap = () => onOpen(element)) : null,
|
||||
);
|
||||
}
|
||||
} else if (element is BoldElement) {
|
||||
return TextSpan(text: element.text.replaceAll("*", ""), style: style?.copyWith(fontWeight: FontWeight.bold), semanticsLabel: element.text);
|
||||
|
@ -428,11 +434,13 @@ class TooltipSpan extends WidgetSpan {
|
|||
TooltipSpan({
|
||||
required String message,
|
||||
required InlineSpan inlineSpan,
|
||||
required BuildContext context,
|
||||
}) : super(
|
||||
child: Tooltip(
|
||||
message: message,
|
||||
child: Text.rich(
|
||||
inlineSpan,
|
||||
child: RichText(
|
||||
text: inlineSpan,
|
||||
selectionRegistrar: SelectionContainer.maybeOf(context),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -114,9 +114,12 @@ class _AddContactViewState extends State<AddContactView> {
|
|||
/// The Add Peer Tab allows a peer to add a specific non-group peer to their contact lists
|
||||
/// We also provide a convenient way to copy their onion.
|
||||
Widget addPeerTab(bcontext) {
|
||||
ScrollController controller = ScrollController();
|
||||
return Scrollbar(
|
||||
controller: controller,
|
||||
child: SingleChildScrollView(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
controller: controller,
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(30),
|
||||
padding: EdgeInsets.all(20),
|
||||
|
@ -187,10 +190,12 @@ class _AddContactViewState extends State<AddContactView> {
|
|||
if (Provider.of<ProfileInfoState>(bcontext).serverList.servers.isEmpty) {
|
||||
return Text(AppLocalizations.of(bcontext)!.addServerFirst);
|
||||
}
|
||||
|
||||
ScrollController controller = ScrollController();
|
||||
return Scrollbar(
|
||||
controller: controller,
|
||||
child: SingleChildScrollView(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
controller: controller,
|
||||
child: Container(
|
||||
margin: EdgeInsets.all(30),
|
||||
padding: EdgeInsets.all(20),
|
||||
|
|
|
@ -38,6 +38,7 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
|
|||
final ctrlrPass = TextEditingController(text: "");
|
||||
final ctrlrPass2 = TextEditingController(text: "");
|
||||
final ctrlrOnion = TextEditingController(text: "");
|
||||
ScrollController controller = ScrollController();
|
||||
late bool usePassword;
|
||||
late bool deleted;
|
||||
|
||||
|
@ -75,8 +76,10 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
|
|||
return Consumer<Settings>(builder: (context, theme, child) {
|
||||
return LayoutBuilder(builder: (BuildContext context, BoxConstraints viewportConstraints) {
|
||||
return Scrollbar(
|
||||
isAlwaysShown: true,
|
||||
trackVisibility: true,
|
||||
controller: controller,
|
||||
child: SingleChildScrollView(
|
||||
controller: controller,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
|
|
|
@ -67,11 +67,14 @@ class _AddEditServerViewState extends State<AddEditServerView> {
|
|||
}
|
||||
|
||||
Widget _buildSettingsList() {
|
||||
ScrollController controller = ScrollController();
|
||||
return Consumer2<ServerInfoState, Settings>(builder: (context, serverInfoState, settings, child) {
|
||||
return LayoutBuilder(builder: (BuildContext context, BoxConstraints viewportConstraints) {
|
||||
return Scrollbar(
|
||||
isAlwaysShown: true,
|
||||
trackVisibility: true,
|
||||
controller: controller,
|
||||
child: SingleChildScrollView(
|
||||
controller: controller,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
|
|
|
@ -36,6 +36,8 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
|||
static const androidSettingsChangeChannel = const MethodChannel('androidSettingsChanged');
|
||||
bool powerExempt = false;
|
||||
|
||||
ScrollController settingsListScrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
super.dispose();
|
||||
|
@ -95,9 +97,11 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
|||
var appIcon = Icon(Icons.info, color: settings.current().mainTextColor);
|
||||
return Scrollbar(
|
||||
key: Key("SettingsView"),
|
||||
isAlwaysShown: true,
|
||||
trackVisibility: true,
|
||||
controller: settingsListScrollController,
|
||||
child: SingleChildScrollView(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
controller: settingsListScrollController,
|
||||
padding: EdgeInsets.all(20),
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
|
|
|
@ -27,6 +27,7 @@ class _GroupSettingsViewState extends State<GroupSettingsView> {
|
|||
|
||||
final ctrlrNick = TextEditingController(text: "");
|
||||
final ctrlrGroupAddr = TextEditingController(text: "");
|
||||
ScrollController groupSettingsScrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
@ -55,9 +56,11 @@ class _GroupSettingsViewState extends State<GroupSettingsView> {
|
|||
return Consumer<Settings>(builder: (context, settings, child) {
|
||||
return LayoutBuilder(builder: (BuildContext context, BoxConstraints viewportConstraints) {
|
||||
return Scrollbar(
|
||||
isAlwaysShown: true,
|
||||
trackVisibility: true,
|
||||
controller: groupSettingsScrollController,
|
||||
child: SingleChildScrollView(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
controller: groupSettingsScrollController,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: viewportConstraints.maxHeight,
|
||||
|
|
|
@ -149,6 +149,8 @@ class _MessageViewState extends State<MessageView> {
|
|||
backgroundColor: Provider.of<Settings>(context).theme.backgroundMainColor,
|
||||
floatingActionButton: showDown
|
||||
? 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),
|
||||
onPressed: () {
|
||||
Provider.of<AppState>(context, listen: false).initialScrollIndex = 0;
|
||||
|
|
|
@ -28,6 +28,7 @@ class _PeerSettingsViewState extends State<PeerSettingsView> {
|
|||
}
|
||||
|
||||
final ctrlrNick = TextEditingController(text: "");
|
||||
ScrollController peerSettingsScrollController = ScrollController();
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
@ -83,9 +84,11 @@ class _PeerSettingsViewState extends State<PeerSettingsView> {
|
|||
}
|
||||
|
||||
return Scrollbar(
|
||||
isAlwaysShown: true,
|
||||
trackVisibility: true,
|
||||
controller: peerSettingsScrollController,
|
||||
child: SingleChildScrollView(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
controller: peerSettingsScrollController,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: viewportConstraints.maxHeight,
|
||||
|
|
|
@ -76,10 +76,13 @@ class _ProfileServersView extends State<ProfileServersView> {
|
|||
)));
|
||||
|
||||
return LayoutBuilder(builder: (BuildContext context, BoxConstraints viewportConstraints) {
|
||||
ScrollController controller = ScrollController();
|
||||
return Scrollbar(
|
||||
isAlwaysShown: true,
|
||||
trackVisibility: true,
|
||||
controller: controller,
|
||||
child: SingleChildScrollView(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
controller: controller,
|
||||
child: Container(
|
||||
margin: EdgeInsets.fromLTRB(5, 0, 5, 10),
|
||||
padding: EdgeInsets.fromLTRB(5, 0, 5, 10),
|
||||
|
|
|
@ -21,6 +21,7 @@ class _TorStatusView extends State<TorStatusView> {
|
|||
TextEditingController torSocksPortController = TextEditingController();
|
||||
TextEditingController torControlPortController = TextEditingController();
|
||||
TextEditingController torConfigController = TextEditingController();
|
||||
ScrollController torScrollContoller = ScrollController();
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
|
@ -52,7 +53,8 @@ class _TorStatusView extends State<TorStatusView> {
|
|||
return Consumer<TorStatus>(builder: (context, torStatus, child) {
|
||||
return LayoutBuilder(builder: (BuildContext context, BoxConstraints viewportConstraints) {
|
||||
return Scrollbar(
|
||||
isAlwaysShown: true,
|
||||
trackVisibility: true,
|
||||
controller: torScrollContoller,
|
||||
child: SingleChildScrollView(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: ConstrainedBox(
|
||||
|
|
|
@ -2,6 +2,7 @@ import 'dart:io';
|
|||
import 'dart:math';
|
||||
|
||||
import 'package:cwtch/config.dart';
|
||||
import 'package:cwtch/cwtch_icons_icons.dart';
|
||||
import 'package:cwtch/models/contact.dart';
|
||||
import 'package:cwtch/models/filedownloadprogress.dart';
|
||||
import 'package:cwtch/models/message.dart';
|
||||
|
@ -131,6 +132,13 @@ class FileBubbleState extends State<FileBubble> {
|
|||
// we don't preview a non downloaded file...
|
||||
if (widget.isPreview && myFile != null) {
|
||||
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) {
|
||||
|
@ -329,7 +337,7 @@ class FileBubbleState extends State<FileBubble> {
|
|||
maxLines: 4,
|
||||
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
|
||||
|
@ -377,7 +385,7 @@ class FileBubbleState extends State<FileBubble> {
|
|||
maxLines: 4,
|
||||
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(
|
||||
visible: speed != "0 B/s",
|
||||
child: SelectableText(
|
||||
|
|
|
@ -215,14 +215,16 @@ class MessageRowState extends State<MessageRow> with SingleTickerProviderStateMi
|
|||
var mr = MouseRegion(
|
||||
// For desktop...
|
||||
onHover: (event) {
|
||||
setState(() {
|
||||
Provider.of<AppState>(context, listen: false).hoveredIndex = Provider.of<MessageMetadata>(context, listen: false).messageID;
|
||||
});
|
||||
if (Provider.of<AppState>(context, listen: false).hoveredIndex != Provider.of<MessageMetadata>(context, listen: false).messageID) {
|
||||
setState(() {
|
||||
Provider.of<AppState>(context, listen: false).hoveredIndex = Provider.of<MessageMetadata>(context, listen: false).messageID;
|
||||
});
|
||||
}
|
||||
},
|
||||
onExit: (event) {
|
||||
setState(() {
|
||||
Provider.of<AppState>(context, listen: false).hoveredIndex = -1;
|
||||
});
|
||||
// setState(() {
|
||||
// Provider.of<AppState>(context, listen: false).hoveredIndex = -1;
|
||||
//});
|
||||
},
|
||||
child: GestureDetector(
|
||||
onPanUpdate: (details) {
|
||||
|
@ -371,6 +373,7 @@ void modalShowReplies(
|
|||
context: ctx,
|
||||
builder: (BuildContext bcontext) {
|
||||
List<Message> replies = getReplies(cache, messageID);
|
||||
ScrollController controller = ScrollController();
|
||||
|
||||
return ChangeNotifierProvider.value(
|
||||
value: profile,
|
||||
|
@ -432,7 +435,8 @@ void modalShowReplies(
|
|||
}
|
||||
|
||||
return Scrollbar(
|
||||
isAlwaysShown: true,
|
||||
trackVisibility: true,
|
||||
controller: controller,
|
||||
child: SingleChildScrollView(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: ConstrainedBox(
|
||||
|
|
|
@ -125,16 +125,11 @@ class QuotedMessageBubbleState extends State<QuotedMessageBubble> {
|
|||
height: 75,
|
||||
child: Column(children: [
|
||||
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)),
|
||||
Flexible(
|
||||
child: DefaultTextStyle(
|
||||
textWidthBasis: TextWidthBasis.parent,
|
||||
child: qMessage.getPreviewWidget(context),
|
||||
style: TextStyle(color: qTextColor),
|
||||
overflow: TextOverflow.fade,
|
||||
))
|
||||
])
|
||||
Flexible(child: qMessage.getPreviewWidget(context)),
|
||||
]))
|
||||
]))));
|
||||
} catch (e) {
|
||||
return MalformedBubble();
|
||||
|
|
|
@ -40,9 +40,9 @@ class _RemoteServerRowState extends State<RemoteServerRow> {
|
|||
Visibility(
|
||||
visible: !running,
|
||||
child: Icon(
|
||||
CwtchIcons.negative_heart_24px,
|
||||
color: Provider.of<Settings>(context).theme.portraitOfflineBorderColor,
|
||||
)),
|
||||
CwtchIcons.negative_heart_24px,
|
||||
color: Provider.of<Settings>(context).theme.portraitOfflineBorderColor,
|
||||
)),
|
||||
])),
|
||||
Expanded(
|
||||
child: Column(
|
||||
|
|
Loading…
Reference in New Issue