Skip to content
This repository has been archived by the owner on Sep 9, 2024. It is now read-only.

Commit

Permalink
refactor: remove helper methods from kaiteki_ui.dart
Browse files Browse the repository at this point in the history
  • Loading branch information
Craftplacer committed Dec 31, 2023
1 parent d8928b9 commit b266e93
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
7 changes: 5 additions & 2 deletions src/kaiteki/lib/ui/shared/posts/interaction_event_bar.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import "package:flutter/material.dart";
import "package:kaiteki/di.dart";
import "package:kaiteki/ui/shared/common.dart";
import "package:kaiteki/ui/shared/posts/avatar_widget.dart";
import "package:kaiteki/utils/extensions.dart";
import "package:kaiteki_core/model.dart";
import "package:kaiteki_core/utils.dart";

/// A row that details an interaction for use in timelines
class InteractionEventBar extends ConsumerWidget {
Expand Down Expand Up @@ -43,7 +43,10 @@ class InteractionEventBar extends ConsumerWidget {
WidgetSpan(
child: Icon(
icon,
size: getLocalFontSize(context) * 1.25,
size: DefaultTextStyle.of(context)
.style
.fontSize
.nullTransform((size) => size * 1.25),
color: color,
),
),
Expand Down
7 changes: 5 additions & 2 deletions src/kaiteki/lib/ui/shared/posts/reply_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import "package:flutter/material.dart";
import "package:kaiteki/di.dart";
import "package:kaiteki/fediverse/user_resolver.dart";
import "package:kaiteki/theming/text_theme.dart";
import "package:kaiteki/ui/shared/common.dart";
import "package:kaiteki/ui/shared/posts/post_widget.dart";
import "package:kaiteki/utils/extensions.dart";
import "package:kaiteki_core/model.dart";
import "package:kaiteki_core/utils.dart";

class ReplyBar extends ConsumerWidget {
const ReplyBar({
Expand Down Expand Up @@ -56,7 +56,10 @@ class ReplyBar extends ConsumerWidget {
textDirection: Directionality.of(context).inverted,
child: Icon(
Icons.reply_rounded,
size: getLocalFontSize(context) * 1.25,
size: DefaultTextStyle.of(context)
.style
.fontSize
.nullTransform((size) => size * 1.25),
color: disabledColor,
),
),
Expand Down
8 changes: 0 additions & 8 deletions src/kaiteki_ui/lib/kaiteki_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,6 @@ export 'src/utils/margined_rounded_rectangle_border.dart';
export 'src/utils/margined_stadium_border.dart';
export 'src/utils/text_inherited_icon_theme.dart';

double getLocalFontSize(BuildContext context) {
return DefaultTextStyle.of(context).style.fontSize!;
}

Color getLocalTextColor(BuildContext context) {
return DefaultTextStyle.of(context).style.color!;
}

TextStyle getSubheaderTextStyle(ThemeData theme) {
final labelLarge = theme.textTheme.labelLarge;
final primary = theme.colorScheme.primary;
Expand Down

0 comments on commit b266e93

Please sign in to comment.