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

Commit

Permalink
refactor: dart fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Craftplacer committed Dec 31, 2023
1 parent ee860a9 commit a7d208e
Show file tree
Hide file tree
Showing 27 changed files with 48 additions and 55 deletions.
2 changes: 1 addition & 1 deletion src/kaiteki/lib/app.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ final class KaitekiApp extends ConsumerWidget {
routerConfig: ref.watch(routerProvider),
supportedLocales: KaitekiLocalizations.supportedLocales,
// FIXME(Craftplacer): `kab` results in no MaterialLocalizations
locale: locale != const Locale('kab') ? locale : null,
locale: locale != const Locale("kab") ? locale : null,
theme: lightTheme,
themeMode: themeMode,
title: consts.kAppName,
Expand Down
2 changes: 1 addition & 1 deletion src/kaiteki/lib/text/parsers/social_text_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SocialTextParser implements TextParser {
LinkElement(
Uri.parse(url!),
children: [TextElement(url)],
)
),
];
});

Expand Down
4 changes: 2 additions & 2 deletions src/kaiteki/lib/text/text_renderer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import "package:kaiteki/di.dart";
import "package:kaiteki/preferences/app_preferences.dart";
import "package:kaiteki/text/elements.dart";
import "package:kaiteki/text/parsers.dart";
import "package:kaiteki/ui/text/unblur_on_hover.dart";
import "package:kaiteki/theming/text_theme.dart";
import "package:kaiteki/ui/text/unblur_on_hover.dart";
import "package:kaiteki/utils/extensions.dart";
import "package:kaiteki/utils/helpers.dart";
import "package:kaiteki_core/kaiteki_core.dart";
Expand Down Expand Up @@ -183,7 +183,7 @@ class TextRenderer {
}

InlineSpan _overrideGestureDetector(
InlineSpan span, TapGestureRecognizer recognizer) {
InlineSpan span, TapGestureRecognizer recognizer,) {
if (span is TextSpan) {
return TextSpan(
recognizer: recognizer,
Expand Down
4 changes: 2 additions & 2 deletions src/kaiteki/lib/ui/account/settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@ class _AccountSettingsScreenState extends ConsumerState<AccountSettingsScreen> {
: null,
),
ListTile(
leading: Icon(
leading: const Icon(
Icons.arrow_forward_rounded,
// color: Theme.of(context).colorScheme.secondary,
),
title: Text("Move Account"),
title: const Text("Move Account"),
onTap: ref.watch(developerMode).value
? () => _onMigrate(ref)
: null,
Expand Down
1 change: 0 additions & 1 deletion src/kaiteki/lib/ui/explore/news_list_tile.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "package:flutter/material.dart";
import "package:kaiteki_core/kaiteki_core.dart";
import "package:kaiteki_core/model.dart";
import "package:url_launcher/url_launcher.dart";

class NewsListTile extends StatelessWidget {
Expand Down
4 changes: 2 additions & 2 deletions src/kaiteki/lib/ui/main/pages/explore.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ class _ExplorePageState extends ConsumerState<ExplorePage> {
child: TextButton(
onPressed: () => setState(() => _expandPosts = !_expandPosts),
child: _expandPosts
? Text("Show fewer posts")
? const Text("Show fewer posts")
: Text("Show ${postCount - _kPostLimit} more"),
),
),
Expand All @@ -204,7 +204,7 @@ class _ExplorePageState extends ConsumerState<ExplorePage> {
}

class _HashtagChip extends ConsumerWidget {
const _HashtagChip(this.hashtag, {super.key});
const _HashtagChip(this.hashtag);

final String hashtag;

Expand Down
8 changes: 4 additions & 4 deletions src/kaiteki/lib/ui/main/pages/notifications.dart
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ class _AnnouncementsButton extends ConsumerWidget {
children: [
const Icon(Icons.campaign_rounded),
const SizedBox(width: 8),
Expanded(
child: const Text("Announcements"),
const Expanded(
child: Text("Announcements"),
),
if (unreadCount != null && unreadCount > 0) ...[
const SizedBox(width: 8),
Expand Down Expand Up @@ -302,8 +302,8 @@ class _FollowRequestsButton extends ConsumerWidget {
children: [
const Icon(Icons.person_add_rounded),
const SizedBox(width: 8),
Expanded(
child: const Text("Follow Requests"),
const Expanded(
child: Text("Follow Requests"),
),
if (count != null && count > 0) ...[
const SizedBox(width: 8),
Expand Down
3 changes: 1 addition & 2 deletions src/kaiteki/lib/ui/media_inspection/screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class _MediaInspectionScreenState extends State<MediaInspectionScreen> {
onInvoke: (_) => _onPreviousPage(),
),
NextPageIntent: CallbackAction<NextPageIntent>(
onInvoke: (_) => _onNextPage()),
onInvoke: (_) => _onNextPage(),),
},
child: Consumer(
child: Focus(
Expand Down Expand Up @@ -302,7 +302,6 @@ class _PaginationFab extends StatelessWidget {
final Widget child;

const _PaginationFab({
super.key,
this.onPressed,
this.tooltip,
required this.child,
Expand Down
14 changes: 7 additions & 7 deletions src/kaiteki/lib/ui/migration/dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ class _MigrationDialogState extends ConsumerState<MigrationDialog> {
final accounts = ref.watch(accountManagerProvider).accounts;

return AlertDialog(
title: const Text('Migrate accounts'),
title: const Text("Migrate accounts"),
content: ConstrainedBox(
constraints: kDialogConstraints,
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
Text(
const Text(
"Select the accounts you want to migrate below and click the Migrate button. Keep the following things in mind:"
"\n\n"
"• Your old account will display a migration message pointing to your new account.\n"
Expand All @@ -42,8 +42,8 @@ class _MigrationDialogState extends ConsumerState<MigrationDialog> {
user: accounts.first.user,
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
const Padding(
padding: EdgeInsets.symmetric(horizontal: 16.0),
child: Icon(
Icons.keyboard_double_arrow_right_rounded,
size: 48,
Expand All @@ -63,7 +63,7 @@ class _MigrationDialogState extends ConsumerState<MigrationDialog> {
const SizedBox(height: 16),
CheckboxListTile(
contentPadding: EdgeInsets.zero,
title: Text("I have read and understood the above"),
title: const Text("I have read and understood the above"),
value: false,
onChanged: (value) => setState(() => _hasRead = value ?? false),
controlAffinity: ListTileControlAffinity.leading,
Expand All @@ -78,7 +78,7 @@ class _MigrationDialogState extends ConsumerState<MigrationDialog> {
),
TextButton(
onPressed: _hasRead ? () => Navigator.of(context).pop(true) : null,
child: Text('Migrate'),
child: const Text("Migrate"),
),
],
);
Expand All @@ -88,7 +88,7 @@ class _MigrationDialogState extends ConsumerState<MigrationDialog> {
class _AccountPreview extends StatelessWidget {
final User user;

const _AccountPreview({super.key, required this.user});
const _AccountPreview({required this.user});

@override
Widget build(BuildContext context) {
Expand Down
14 changes: 7 additions & 7 deletions src/kaiteki/lib/ui/onboarding/pages/account_setup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ class AccountSetupPage extends ConsumerWidget {
child: Center(
child: ListTile(
leading: Image.asset("assets/icons/fediverse.png"),
title: Text("Fediverse"),
subtitle: Text("Mastodon, Pleroma, Misskey, etc."),
title: const Text("Fediverse"),
subtitle: const Text("Mastodon, Pleroma, Misskey, etc."),
),
),
),
Expand All @@ -62,17 +62,17 @@ class AccountSetupPage extends ConsumerWidget {
Brightness.dark =>
Image.asset("assets/icons/tumblr_white.png"),
},
title: Text("Tumblr"),
subtitle: Text("Coming soon™"),
title: const Text("Tumblr"),
subtitle: const Text("Coming soon™"),
enabled: false,
),
),
const SizedBox(height: 8),
Card.outlined(
child: ListTile(
leading: Image.asset("assets/icons/bluesky.png"),
title: Text("Bluesky"),
subtitle: Text("Coming soon™"),
title: const Text("Bluesky"),
subtitle: const Text("Coming soon™"),
enabled: false,
),
),
Expand Down Expand Up @@ -100,7 +100,7 @@ class AccountSetupPage extends ConsumerWidget {
),
],
),
)
),
],
),
);
Expand Down
6 changes: 3 additions & 3 deletions src/kaiteki/lib/ui/onboarding/pages/preferences_presets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class _PreferencesSetupPageState extends State<PreferencesSetupPage> {
Card.outlined(
clipBehavior: Clip.antiAlias,
child: CheckboxListTile(
title: Text("Settings useful for wellbeing"),
subtitle: Text(
title: const Text("Settings useful for wellbeing"),
subtitle: const Text(
"Use less attention-grabbing colors, hide numbers",
),
value: _wellbeingPreset,
Expand Down Expand Up @@ -100,7 +100,7 @@ class _PreferencesSetupPageState extends State<PreferencesSetupPage> {
),
),
],
)
),
],
),
);
Expand Down
2 changes: 1 addition & 1 deletion src/kaiteki/lib/ui/onboarding/pages/theme.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class ThemePage extends ConsumerWidget {
child: Text(context.l10n.finishButtonLabel),
),
],
)
),
],
),
);
Expand Down
2 changes: 1 addition & 1 deletion src/kaiteki/lib/ui/onboarding/screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class _OnboardingContainer extends StatelessWidget {
alignment: Alignment.bottomLeft,
child: AlphaDisclaimer(),
),
)
),
],
),
),
Expand Down
2 changes: 1 addition & 1 deletion src/kaiteki/lib/ui/settings/a11y/screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class AccessibilityScreen extends StatelessWidget {
leading: const Icon(Icons.text_fields_rounded),
min: 1.0,
max: 3.0,
title: Text("Post text size"),
title: const Text("Post text size"),
provider: postTextSize,
divisions: 8,
),
Expand Down
4 changes: 2 additions & 2 deletions src/kaiteki/lib/ui/settings/customization/density_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ class _DensityDialogState extends State<DensityDialog> {
];

return AlertDialog(
title: Text("Density"),
title: const Text("Density"),
contentPadding: const EdgeInsets.only(top: 16.0, bottom: 24.0),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
RadioListTile(
title: Text("System"),
title: const Text("System"),
subtitle: Text(
getNameForDensity(VisualDensity.adaptivePlatformDensity) ??
VisualDensity.adaptivePlatformDensity.toString(),
Expand Down
2 changes: 1 addition & 1 deletion src/kaiteki/lib/ui/settings/settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SettingsScreen extends StatelessWidget {
),
ListTile(
leading: const Icon(Icons.auto_awesome_rounded),
title: Text("Smart features"),
title: const Text("Smart features"),
onTap: () => context.push("/settings/smart-features"),
),
ListTile(
Expand Down
4 changes: 2 additions & 2 deletions src/kaiteki/lib/ui/settings/tweaks_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class TweaksScreen extends StatelessWidget {
PreferenceSwitchListTile(
provider: squareEmojis,
title: const Text("Square emojis"),
subtitle: Text(
"Forces emojis to be square. Might make long emojis appear squished."),
subtitle: const Text(
"Forces emojis to be square. Might make long emojis appear squished.",),
),
],
),
Expand Down
2 changes: 0 additions & 2 deletions src/kaiteki/lib/ui/share_sheet/sheet.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "dart:io";

import "package:flutter/cupertino.dart";
import "package:flutter/foundation.dart";
import "package:flutter/material.dart";
import "package:flutter/services.dart";
Expand Down Expand Up @@ -222,7 +221,6 @@ class _ShareTile extends StatelessWidget {
final VoidCallback? onTap;

const _ShareTile({
super.key,
required this.icon,
required this.text,
this.onTap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class ImageAttachment extends StatelessWidget {
final Attachment attachment;
final BoxFit? boxFit;

const ImageAttachment({
const ImageAttachment({super.key,
required this.attachment,
this.boxFit,
});
Expand Down
2 changes: 1 addition & 1 deletion src/kaiteki/lib/ui/shared/posts/avatar_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ class AvatarWidget extends StatelessWidget {
child: IgnorePointer(
child: _buildDecoration(decoration),
),
)
),
],
);
}
Expand Down
1 change: 0 additions & 1 deletion src/kaiteki/lib/ui/shared/posts/interaction_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import "package:kaiteki/ui/shared/common.dart";
import "package:kaiteki/ui/shared/posts/count_button.dart";
import "package:kaiteki/ui/shared/posts/layouts/layout.dart";
import "package:kaiteki_core/kaiteki_core.dart";
import "package:kaiteki_core/model.dart";

class InteractionBar extends StatefulWidget {
const InteractionBar({
Expand Down
5 changes: 2 additions & 3 deletions src/kaiteki/lib/ui/shared/posts/meta_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class MetaBar extends ConsumerWidget {

final showLanguage = this.showLanguage ?? postTheme?.showLanguage ?? true;
final showTime = this.showTime ?? postTheme?.showTime ?? true;
final showScope = this.showVisibility ?? postTheme?.showVisibility ?? true;
final showScope = showVisibility ?? postTheme?.showVisibility ?? true;

return ContentColor(
color: Theme.of(context).getEmphasisColor(EmphasisColor.medium),
Expand Down Expand Up @@ -156,7 +156,7 @@ class MetaBar extends ConsumerWidget {
}

class _Timestamp extends StatelessWidget {
const _Timestamp(this.dateTime, {super.key});
const _Timestamp(this.dateTime);

final DateTime dateTime;

Expand All @@ -176,7 +176,6 @@ class _Timestamp extends StatelessWidget {

class _Language extends ConsumerWidget {
const _Language({
super.key,
required this.language,
});

Expand Down
4 changes: 2 additions & 2 deletions src/kaiteki/lib/ui/shared/posts/post_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,8 @@ class _PostWidgetState extends ConsumerState<PostWidget> {
CustomSemanticsAction(label: context.l10n.bookmarkButtonLabel);
final reactAction =
CustomSemanticsAction(label: context.l10n.reactButtonLabel);
final showOriginalAuthor =
const CustomSemanticsAction(label: "Open author's profile");
const showOriginalAuthor =
CustomSemanticsAction(label: "Open author's profile");

return {
replyAction: _onReply,
Expand Down
4 changes: 2 additions & 2 deletions src/kaiteki/lib/ui/shared/users/user_display_name_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ class UserDisplayNameWidget extends ConsumerWidget {
this.secondaryTextStyle?.copyWith(color: secondaryColor) ??
secondaryColor.textStyle;

Widget widget = switch (orientation) {
final Widget widget = switch (orientation) {
Axis.horizontal => RepaintBoundary(
child: Text.rich(
TextSpan(
children: [
user.renderText(context, ref, content.primary),
if (secondaryText != null) ...[
TextSpan(text: " "),
const TextSpan(text: " "),
TextSpan(
text: secondaryText,
style: secondaryTextStyle,
Expand Down
1 change: 0 additions & 1 deletion src/kaiteki/lib/ui/text/emoji_span.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import "package:flutter/material.dart";
import "package:flutter/widgets.dart";
import "package:kaiteki/di.dart";
import "package:kaiteki/preferences/theme_preferences.dart";
import "package:kaiteki/ui/shared/emoji/emoji_theme.dart";
Expand Down
Loading

0 comments on commit a7d208e

Please sign in to comment.