这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions lib/view/widget/mention_widget.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:hooks_riverpod/hooks_riverpod.dart';

import '../../model/account.dart';
import '../../provider/cache_manager_provider.dart';
import '../../provider/data_saver_provider.dart';
import '../../provider/general_settings_notifier_provider.dart';
import '../../provider/misskey_colors_provider.dart';
import '../../provider/static_image_url_provider.dart';
import '../../util/punycode.dart';
import 'image_widget.dart';

class MentionWidget extends ConsumerWidget {
const MentionWidget({
Expand All @@ -17,13 +18,15 @@ class MentionWidget extends ConsumerWidget {
required this.host,
this.onTap,
this.onDeleted,
this.textScaler,
});

final Account account;
final String username;
final String host;
final void Function()? onTap;
final void Function()? onDeleted;
final TextScaler? textScaler;

@override
Widget build(BuildContext context, WidgetRef ref) {
Expand All @@ -47,14 +50,13 @@ class MentionWidget extends ConsumerWidget {
),
child: InputChip(
avatar: CircleAvatar(
child: ClipOval(
child: ImageWidget(
url: disableShowingAnimatedImages
? ref
.watch(staticImageUrlProvider(account.host, url))
.toString()
: url,
),
foregroundImage: CachedNetworkImageProvider(
disableShowingAnimatedImages
? ref
.watch(staticImageUrlProvider(account.host, url))
.toString()
: url,
cacheManager: ref.watch(cacheManagerProvider),
),
),
label: Text.rich(
Expand All @@ -69,6 +71,7 @@ class MentionWidget extends ConsumerWidget {
],
),
textDirection: TextDirection.ltr,
textScaler: textScaler,
),
onPressed: onTap,
onDeleted: onDeleted,
Expand Down
1 change: 1 addition & 0 deletions lib/view/widget/mfm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ List<InlineSpan> buildMfm(
account.host.toLowerCase() == absoluteHost.toLowerCase()
? ref.context.push('/$account/@$username')
: ref.context.push('/$account/@$username@$absoluteHost'),
textScaler: TextScaler.noScaling,
),
),
);
Expand Down
58 changes: 51 additions & 7 deletions lib/view/widget/mfm/mfm_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ class MfmBuilder {
textAlign: TextAlign.center,
overflow: overflow,
maxLines: maxLines,
textScaler: TextScaler.noScaling,
),
),
),
Expand All @@ -171,6 +172,7 @@ class MfmBuilder {
align: align,
overflow: overflow,
maxLines: maxLines,
textScaler: TextScaler.noScaling,
),
),
MfmLink(:final url, :final children?) => WidgetSpan(
Expand All @@ -195,6 +197,7 @@ class MfmBuilder {
],
),
textAlign: align,
textScaler: TextScaler.noScaling,
),
),
),
Expand All @@ -214,6 +217,7 @@ class MfmBuilder {
color: colors.hashtag.withOpacity(opacity),
),
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand Down Expand Up @@ -258,6 +262,7 @@ class MfmBuilder {
),
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand Down Expand Up @@ -309,6 +314,7 @@ class MfmBuilder {
opacity,
),
),
textScaler: TextScaler.noScaling,
),
),
),
Expand All @@ -319,6 +325,10 @@ class MfmBuilder {
child: Math.tex(
formula,
mathStyle: MathStyle.text,
textStyle: style.apply(
color: style.color?.withOpacity(opacity),
),
textScaleFactor: scale,
onErrorFallback: (_) => Text(
formula,
style: style.apply(
Expand All @@ -329,12 +339,18 @@ class MfmBuilder {
opacity,
),
),
textScaler: TextScaler.noScaling,
),
),
),
),
),
MfmSearch(:final query) => WidgetSpan(child: Search(query: query)),
MfmSearch(:final query) => WidgetSpan(
child: Search(
query: query,
textScaler: TextScaler.noScaling,
),
),
MfmPlain(:final text) => TextSpan(
text: text,
style: style.apply(
Expand Down Expand Up @@ -375,6 +391,7 @@ class MfmBuilder {
span,
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand All @@ -392,6 +409,7 @@ class MfmBuilder {
TextSpan(children: build(children)),
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand All @@ -409,6 +427,7 @@ class MfmBuilder {
TextSpan(children: build(children)),
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand All @@ -426,6 +445,7 @@ class MfmBuilder {
TextSpan(children: build(children)),
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand All @@ -443,6 +463,7 @@ class MfmBuilder {
TextSpan(children: build(children)),
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand All @@ -460,6 +481,7 @@ class MfmBuilder {
TextSpan(children: build(children)),
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand All @@ -477,6 +499,7 @@ class MfmBuilder {
TextSpan(children: build(children)),
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand All @@ -495,6 +518,7 @@ class MfmBuilder {
span,
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand Down Expand Up @@ -540,6 +564,7 @@ class MfmBuilder {
span,
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand All @@ -558,6 +583,7 @@ class MfmBuilder {
span,
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
)
Expand All @@ -581,7 +607,10 @@ class MfmBuilder {
),
),
blendMode: BlendMode.srcIn,
child: Text.rich(span),
child: Text.rich(
span,
textScaler: TextScaler.noScaling,
),
),
);
case 'sparkle':
Expand All @@ -598,6 +627,7 @@ class MfmBuilder {
span,
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand All @@ -615,6 +645,7 @@ class MfmBuilder {
span,
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand All @@ -636,6 +667,7 @@ class MfmBuilder {
span,
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand All @@ -655,6 +687,7 @@ class MfmBuilder {
span,
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand All @@ -681,6 +714,7 @@ class MfmBuilder {
span,
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand All @@ -698,6 +732,7 @@ class MfmBuilder {
span,
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand Down Expand Up @@ -732,6 +767,7 @@ class MfmBuilder {
span,
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand Down Expand Up @@ -762,6 +798,7 @@ class MfmBuilder {
span,
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand Down Expand Up @@ -795,12 +832,18 @@ class MfmBuilder {
size: style.lineHeight * scale * 0.9,
),
SizedBox(width: 2.0 * scale),
DefaultTextStyle(
style: style.apply(
fontSizeFactor: scale * 0.9,
color: style.color?.withOpacity(opacity),
Expanded(
child: DefaultTextStyle(
style: style.apply(
fontSizeFactor: scale * 0.9,
color: style.color?.withOpacity(opacity),
),
child: TimeWidget(
time: time,
detailed: true,
textScaler: TextScaler.noScaling,
),
),
child: TimeWidget(time: time, detailed: true),
),
],
),
Expand All @@ -823,6 +866,7 @@ class MfmBuilder {
span,
textAlign: align,
overflow: overflow,
textScaler: TextScaler.noScaling,
maxLines: maxLines,
),
),
Expand Down
17 changes: 14 additions & 3 deletions lib/view/widget/mfm/search.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,14 @@ import '../../../i18n/strings.g.dart';
import '../url_sheet.dart';

class Search extends HookWidget {
const Search({super.key, required this.query});
const Search({
super.key,
required this.query,
this.textScaler,
});

final String query;
final TextScaler? textScaler;

@override
Widget build(BuildContext context) {
Expand All @@ -25,7 +30,10 @@ class Search extends HookWidget {
padding: const EdgeInsets.all(8.0),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: SelectableText(query),
child: SelectableText(
query,
textScaler: textScaler,
),
),
),
),
Expand All @@ -52,7 +60,10 @@ class Search extends HookWidget {
child: Row(
children: [
const Icon(Icons.search),
Text(t.misskey.searchByGoogle),
Text(
t.misskey.searchByGoogle,
textScaler: textScaler,
),
],
),
),
Expand Down
3 changes: 3 additions & 0 deletions lib/view/widget/time_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ class TimeWidget extends StatelessWidget {
this.onTap,
this.detailed = false,
this.absolute = false,
this.textScaler,
});

final DateTime? time;
final void Function()? onTap;
final bool detailed;
final bool absolute;
final TextScaler? textScaler;

@override
Widget build(BuildContext context) {
Expand All @@ -35,6 +37,7 @@ class TimeWidget extends StatelessWidget {
: this.absolute
? absolute
: relative,
textScaler: textScaler,
),
)
: Text(t.misskey.ago_.invalid),
Expand Down
Loading