Merge pull request #1763 from krille-chan/krille/fix-text-scaling-in-linkify
fix: Text scale factor in Linkify widgets
This commit is contained in:
commit
683d98e43e
14 changed files with 41 additions and 1 deletions
|
|
@ -37,6 +37,7 @@ class ChatAppBarListTile extends StatelessWidget {
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
padding: const EdgeInsets.symmetric(horizontal: 4.0),
|
||||||
child: Linkify(
|
child: Linkify(
|
||||||
text: title,
|
text: title,
|
||||||
|
textScaleFactor: MediaQuery.textScalerOf(context).scale(1),
|
||||||
options: const LinkifyOptions(humanize: false),
|
options: const LinkifyOptions(humanize: false),
|
||||||
maxLines: 1,
|
maxLines: 1,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
|
|
|
||||||
|
|
@ -397,6 +397,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
const SizedBox(height: 8),
|
const SizedBox(height: 8),
|
||||||
Linkify(
|
Linkify(
|
||||||
text: fileDescription,
|
text: fileDescription,
|
||||||
|
textScaleFactor: MediaQuery.textScalerOf(context).scale(1),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: widget.color,
|
color: widget.color,
|
||||||
fontSize: widget.fontSize,
|
fontSize: widget.fontSize,
|
||||||
|
|
@ -420,6 +421,7 @@ class AudioPlayerState extends State<AudioPlayerWidget> {
|
||||||
/// To use a MatrixFile as an AudioSource for the just_audio package
|
/// To use a MatrixFile as an AudioSource for the just_audio package
|
||||||
class MatrixFileAudioSource extends StreamAudioSource {
|
class MatrixFileAudioSource extends StreamAudioSource {
|
||||||
final MatrixFile file;
|
final MatrixFile file;
|
||||||
|
|
||||||
MatrixFileAudioSource(this.file);
|
MatrixFileAudioSource(this.file);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
||||||
|
|
@ -124,6 +124,7 @@ class ImageBubble extends StatelessWidget {
|
||||||
width: width,
|
width: width,
|
||||||
child: Linkify(
|
child: Linkify(
|
||||||
text: fileDescription,
|
text: fileDescription,
|
||||||
|
textScaleFactor: MediaQuery.textScalerOf(context).scale(1),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: textColor,
|
color: textColor,
|
||||||
fontSize: AppConfig.fontSizeFactor * AppConfig.messageFontSize,
|
fontSize: AppConfig.fontSizeFactor * AppConfig.messageFontSize,
|
||||||
|
|
|
||||||
|
|
@ -281,6 +281,7 @@ class MessageContent extends StatelessWidget {
|
||||||
MatrixLocals(L10n.of(context)),
|
MatrixLocals(L10n.of(context)),
|
||||||
hideReply: true,
|
hideReply: true,
|
||||||
),
|
),
|
||||||
|
textScaleFactor: MediaQuery.textScalerOf(context).scale(1),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: textColor,
|
color: textColor,
|
||||||
fontSize: bigEmotes ? fontSize * 5 : fontSize,
|
fontSize: bigEmotes ? fontSize * 5 : fontSize,
|
||||||
|
|
|
||||||
|
|
@ -94,6 +94,7 @@ class MessageDownloadContent extends StatelessWidget {
|
||||||
if (fileDescription != null)
|
if (fileDescription != null)
|
||||||
Linkify(
|
Linkify(
|
||||||
text: fileDescription,
|
text: fileDescription,
|
||||||
|
textScaleFactor: MediaQuery.textScalerOf(context).scale(1),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: textColor,
|
color: textColor,
|
||||||
fontSize: AppConfig.fontSizeFactor * AppConfig.messageFontSize,
|
fontSize: AppConfig.fontSizeFactor * AppConfig.messageFontSize,
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,7 @@ class EventVideoPlayer extends StatefulWidget {
|
||||||
final Event event;
|
final Event event;
|
||||||
final Color? textColor;
|
final Color? textColor;
|
||||||
final Color? linkColor;
|
final Color? linkColor;
|
||||||
|
|
||||||
const EventVideoPlayer(
|
const EventVideoPlayer(
|
||||||
this.event, {
|
this.event, {
|
||||||
this.textColor,
|
this.textColor,
|
||||||
|
|
@ -190,6 +191,7 @@ class EventVideoPlayerState extends State<EventVideoPlayer> {
|
||||||
width: width,
|
width: width,
|
||||||
child: Linkify(
|
child: Linkify(
|
||||||
text: fileDescription,
|
text: fileDescription,
|
||||||
|
textScaleFactor: MediaQuery.textScalerOf(context).scale(1),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: textColor,
|
color: textColor,
|
||||||
fontSize: AppConfig.fontSizeFactor * AppConfig.messageFontSize,
|
fontSize: AppConfig.fontSizeFactor * AppConfig.messageFontSize,
|
||||||
|
|
|
||||||
|
|
@ -243,6 +243,8 @@ class ChatDetailsView extends StatelessWidget {
|
||||||
text: room.topic.isEmpty
|
text: room.topic.isEmpty
|
||||||
? L10n.of(context).noChatDescriptionYet
|
? L10n.of(context).noChatDescriptionYet
|
||||||
: room.topic,
|
: room.topic,
|
||||||
|
textScaleFactor:
|
||||||
|
MediaQuery.textScalerOf(context).scale(1),
|
||||||
options: const LinkifyOptions(humanize: false),
|
options: const LinkifyOptions(humanize: false),
|
||||||
linkStyle: const TextStyle(
|
linkStyle: const TextStyle(
|
||||||
color: Colors.blueAccent,
|
color: Colors.blueAccent,
|
||||||
|
|
|
||||||
|
|
@ -152,6 +152,7 @@ class _MessageSearchResultListTile extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
subtitle: Linkify(
|
subtitle: Linkify(
|
||||||
|
textScaleFactor: MediaQuery.textScalerOf(context).scale(1),
|
||||||
options: const LinkifyOptions(humanize: false),
|
options: const LinkifyOptions(humanize: false),
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
color: theme.colorScheme.primary,
|
color: theme.colorScheme.primary,
|
||||||
|
|
|
||||||
|
|
@ -122,6 +122,8 @@ class HomeserverPickerView extends StatelessWidget {
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 32.0),
|
padding: const EdgeInsets.symmetric(horizontal: 32.0),
|
||||||
child: SelectableLinkify(
|
child: SelectableLinkify(
|
||||||
text: L10n.of(context).appIntroduction,
|
text: L10n.of(context).appIntroduction,
|
||||||
|
textScaleFactor:
|
||||||
|
MediaQuery.textScalerOf(context).scale(1),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
color: theme.colorScheme.secondary,
|
color: theme.colorScheme.secondary,
|
||||||
|
|
@ -169,6 +171,19 @@ class HomeserverPickerView extends StatelessWidget {
|
||||||
content: Linkify(
|
content: Linkify(
|
||||||
text: L10n.of(context)
|
text: L10n.of(context)
|
||||||
.homeserverDescription,
|
.homeserverDescription,
|
||||||
|
textScaleFactor:
|
||||||
|
MediaQuery.textScalerOf(context)
|
||||||
|
.scale(1),
|
||||||
|
options: const LinkifyOptions(
|
||||||
|
humanize: false,
|
||||||
|
),
|
||||||
|
linkStyle: TextStyle(
|
||||||
|
color: theme.colorScheme.primary,
|
||||||
|
decorationColor:
|
||||||
|
theme.colorScheme.primary,
|
||||||
|
),
|
||||||
|
onOpen: (link) =>
|
||||||
|
launchUrlString(link.url),
|
||||||
),
|
),
|
||||||
actions: [
|
actions: [
|
||||||
AdaptiveDialogAction(
|
AdaptiveDialogAction(
|
||||||
|
|
|
||||||
|
|
@ -169,6 +169,8 @@ class SettingsHomeserverView extends StatelessWidget {
|
||||||
title: const Text('Federation Base URL'),
|
title: const Text('Federation Base URL'),
|
||||||
subtitle: Linkify(
|
subtitle: Linkify(
|
||||||
text: data.federationBaseUrl.toString(),
|
text: data.federationBaseUrl.toString(),
|
||||||
|
textScaleFactor:
|
||||||
|
MediaQuery.textScalerOf(context).scale(1),
|
||||||
options: const LinkifyOptions(humanize: false),
|
options: const LinkifyOptions(humanize: false),
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
color: theme.colorScheme.primary,
|
color: theme.colorScheme.primary,
|
||||||
|
|
@ -231,6 +233,8 @@ class SettingsHomeserverView extends StatelessWidget {
|
||||||
title: const Text('Base URL'),
|
title: const Text('Base URL'),
|
||||||
subtitle: Linkify(
|
subtitle: Linkify(
|
||||||
text: wellKnown.mHomeserver.baseUrl.toString(),
|
text: wellKnown.mHomeserver.baseUrl.toString(),
|
||||||
|
textScaleFactor:
|
||||||
|
MediaQuery.textScalerOf(context).scale(1),
|
||||||
options: const LinkifyOptions(humanize: false),
|
options: const LinkifyOptions(humanize: false),
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
color: theme.colorScheme.primary,
|
color: theme.colorScheme.primary,
|
||||||
|
|
@ -244,6 +248,8 @@ class SettingsHomeserverView extends StatelessWidget {
|
||||||
title: const Text('Identity Server:'),
|
title: const Text('Identity Server:'),
|
||||||
subtitle: Linkify(
|
subtitle: Linkify(
|
||||||
text: identityServer.baseUrl.toString(),
|
text: identityServer.baseUrl.toString(),
|
||||||
|
textScaleFactor:
|
||||||
|
MediaQuery.textScalerOf(context).scale(1),
|
||||||
options: const LinkifyOptions(humanize: false),
|
options: const LinkifyOptions(humanize: false),
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
color: theme.colorScheme.primary,
|
color: theme.colorScheme.primary,
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,12 @@
|
||||||
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
|
|
||||||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||||
import 'package:flutter_linkify/flutter_linkify.dart';
|
import 'package:flutter_linkify/flutter_linkify.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:matrix/matrix.dart';
|
import 'package:matrix/matrix.dart';
|
||||||
|
|
||||||
|
import 'package:fluffychat/widgets/adaptive_dialogs/show_ok_cancel_alert_dialog.dart';
|
||||||
import '../../config/themes.dart';
|
import '../../config/themes.dart';
|
||||||
import '../../utils/url_launcher.dart';
|
import '../../utils/url_launcher.dart';
|
||||||
import '../avatar.dart';
|
import '../avatar.dart';
|
||||||
|
|
@ -188,6 +189,8 @@ class PublicRoomDialog extends StatelessWidget {
|
||||||
if (topic != null && topic.isNotEmpty)
|
if (topic != null && topic.isNotEmpty)
|
||||||
SelectableLinkify(
|
SelectableLinkify(
|
||||||
text: topic,
|
text: topic,
|
||||||
|
textScaleFactor:
|
||||||
|
MediaQuery.textScalerOf(context).scale(1),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
options: const LinkifyOptions(humanize: false),
|
options: const LinkifyOptions(humanize: false),
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ Future<OkCancelResult?> showOkCancelAlertDialog({
|
||||||
? null
|
? null
|
||||||
: SelectableLinkify(
|
: SelectableLinkify(
|
||||||
text: message,
|
text: message,
|
||||||
|
textScaleFactor: MediaQuery.textScalerOf(context).scale(1),
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
decorationColor: Theme.of(context).colorScheme.primary,
|
decorationColor: Theme.of(context).colorScheme.primary,
|
||||||
|
|
@ -81,6 +82,7 @@ Future<OkCancelResult?> showOkAlertDialog({
|
||||||
? null
|
? null
|
||||||
: SelectableLinkify(
|
: SelectableLinkify(
|
||||||
text: message,
|
text: message,
|
||||||
|
textScaleFactor: MediaQuery.textScalerOf(context).scale(1),
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
decorationColor: Theme.of(context).colorScheme.primary,
|
decorationColor: Theme.of(context).colorScheme.primary,
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,7 @@ Future<String?> showTextInputDialog({
|
||||||
if (message != null)
|
if (message != null)
|
||||||
SelectableLinkify(
|
SelectableLinkify(
|
||||||
text: message,
|
text: message,
|
||||||
|
textScaleFactor: MediaQuery.textScalerOf(context).scale(1),
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
color: Theme.of(context).colorScheme.primary,
|
color: Theme.of(context).colorScheme.primary,
|
||||||
decorationColor: Theme.of(context).colorScheme.primary,
|
decorationColor: Theme.of(context).colorScheme.primary,
|
||||||
|
|
|
||||||
|
|
@ -144,6 +144,8 @@ class UserDialog extends StatelessWidget {
|
||||||
if (statusMsg != null)
|
if (statusMsg != null)
|
||||||
SelectableLinkify(
|
SelectableLinkify(
|
||||||
text: statusMsg,
|
text: statusMsg,
|
||||||
|
textScaleFactor:
|
||||||
|
MediaQuery.textScalerOf(context).scale(1),
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
options: const LinkifyOptions(humanize: false),
|
options: const LinkifyOptions(humanize: false),
|
||||||
linkStyle: TextStyle(
|
linkStyle: TextStyle(
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue