Skip to content

Commit

Permalink
apply dart format
Browse files Browse the repository at this point in the history
  • Loading branch information
shiosyakeyakini-info committed Jul 13, 2024
1 parent 2b61b2b commit 690f997
Show file tree
Hide file tree
Showing 20 changed files with 127 additions and 114 deletions.
4 changes: 3 additions & 1 deletion lib/repository/account_settings_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ class AccountSettingsRepository extends ChangeNotifier {
} else {
if (defaultTargetPlatform == TargetPlatform.iOS) {
await SharedPreferenceAppGroup.setString(
"account_settings", storedData);
"account_settings",
storedData,
);
}
}
try {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import "package:flutter/foundation.dart";
import "package:flutter_gen/gen_l10n/app_localizations.dart";
import "package:miria/extensions/user_extension.dart";
import "package:miria/model/account.dart";
import "package:miria/providers.dart";
import "package:miria/router/app_router.dart";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,13 @@ class NoteCreateChannel with _$NoteCreateChannel {
}) = _NoteCreateChannel;
}

@Riverpod(dependencies: [
misskeyPostContext,
notesWith,
accountContext,
])
@Riverpod(
dependencies: [
misskeyPostContext,
notesWith,
accountContext,
],
)
class NoteCreateNotifier extends _$NoteCreateNotifier {
late final _fileSystem = ref.read(fileSystemProvider);
late final _dio = ref.read(dioProvider);
Expand Down
13 changes: 8 additions & 5 deletions lib/view/clip_modal_sheet/clip_modal_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,14 @@ class _NotesClipsNotifier extends _$NotesClipsNotifier {
}
}

@Riverpod(keepAlive: false, dependencies: [
ClipsNotifier,
_NotesClipsNotifier,
misskeyPostContext,
])
@Riverpod(
keepAlive: false,
dependencies: [
ClipsNotifier,
_NotesClipsNotifier,
misskeyPostContext,
],
)
class _ClipModalSheetNotifier extends _$ClipModalSheetNotifier {
@override
Future<List<(Clip, bool)>> build(String noteId) async {
Expand Down
17 changes: 12 additions & 5 deletions lib/view/common/interactive_viewer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import "package:vector_math/vector_math_64.dart" show Matrix4, Quad, Vector3;
/// * [InteractiveViewer.builder], whose builder is of this type.
/// * [WidgetBuilder], which is similar, but takes no viewport.
typedef InteractiveViewerWidgetBuilder = Widget Function(
BuildContext context, Quad viewport);
BuildContext context,
Quad viewport,
);

/// A widget that enables pan and zoom interactions with its child.
///
Expand Down Expand Up @@ -974,8 +976,10 @@ class _InteractiveViewerState extends State<InteractiveViewer>
details.scaleVelocity / 10,
);
final tFinal = _getFinalTime(
details.scaleVelocity.abs(), widget.interactionEndFrictionCoefficient,
effectivelyMotionless: 0.1);
details.scaleVelocity.abs(),
widget.interactionEndFrictionCoefficient,
effectivelyMotionless: 0.1,
);
_scaleAnimation = Tween<double>(
begin: scale,
end: frictionSimulation.x(tFinal),
Expand Down Expand Up @@ -1342,8 +1346,11 @@ enum _GestureType {

// Given a velocity and drag, calculate the time at which motion will come to
// a stop, within the margin of effectivelyMotionless.
double _getFinalTime(double velocity, double drag,
{double effectivelyMotionless = 10}) {
double _getFinalTime(
double velocity,
double drag, {
double effectivelyMotionless = 10,
}) {
return math.log(effectivelyMotionless / velocity) / math.log(drag / 100);
}

Expand Down
5 changes: 3 additions & 2 deletions lib/view/common/misskey_notes/misskey_note.dart
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,9 @@ class MisskeyNote extends HookConsumerWidget {
);

final reactionControl =
useCallback<Future<void> Function({MisskeyEmojiData? requestEmoji})>((
{requestEmoji}) async {
useCallback<Future<void> Function({MisskeyEmojiData? requestEmoji})>(({
requestEmoji,
}) async {
// 他のサーバーからログインしている場合は不可
if (!ref.read(accountContextProvider).isSame) return;

Expand Down
1 change: 0 additions & 1 deletion lib/view/common/misskey_notes/reaction_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import "package:miria/providers.dart";
import "package:miria/router/app_router.dart";
import "package:miria/view/common/dialog/dialog_state.dart";
import "package:miria/view/common/misskey_notes/custom_emoji.dart";
import "package:miria/view/dialogs/simple_confirm_dialog.dart";
import "package:miria/view/themes/app_theme.dart";
import "package:misskey_dart/misskey_dart.dart";

Expand Down
3 changes: 1 addition & 2 deletions lib/view/federation_page/federation_announcements.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import "package:miria/view/common/dialog/dialog_state.dart";
import "package:miria/view/common/misskey_notes/mfm_text.dart";
import "package:miria/view/common/misskey_notes/network_image.dart";
import "package:miria/view/common/pushable_listview.dart";
import "package:miria/view/common/sending_elevated_button.dart";
import "package:misskey_dart/misskey_dart.dart";

class FederationAnnouncements extends HookConsumerWidget {
Expand Down Expand Up @@ -113,7 +112,7 @@ class Announcement extends HookConsumerWidget {
S.of(context).confirmAnnouncementsRead(data.value.title),
actions: (context) => [
S.of(context).readAnnouncement,
S.of(context).didNotReadAnnouncement
S.of(context).didNotReadAnnouncement,
],
);
if (isConfirmed != 0) return;
Expand Down
1 change: 0 additions & 1 deletion lib/view/federation_page/federation_custom_emojis.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import "package:collection/collection.dart";
import "package:flutter/material.dart";
import "package:flutter_gen/gen_l10n/app_localizations.dart";
import "package:flutter_hooks/flutter_hooks.dart";
import "package:hooks_riverpod/hooks_riverpod.dart";
import "package:miria/model/misskey_emoji_data.dart";
import "package:miria/providers.dart";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ class AccountListItem extends ConsumerWidget {
icon: const Icon(Icons.settings),
onPressed: () {
context.pushRoute(
SeveralAccountGeneralSettingsRoute(account: account));
SeveralAccountGeneralSettingsRoute(account: account),
);
},
),
IconButton(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import "package:auto_route/annotations.dart";
import "package:auto_route/auto_route.dart";
import "package:flutter/material.dart";
import "package:flutter_gen/gen_l10n/app_localizations.dart";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import "package:auto_route/annotations.dart";
import "package:auto_route/auto_route.dart";
import "package:flutter/material.dart";
import "package:flutter_gen/gen_l10n/app_localizations.dart";
Expand Down Expand Up @@ -61,7 +60,7 @@ class RoleSelectDialog extends ConsumerWidget implements AutoRouteWrapper {
);
},
),
}
},
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ class TabSettingsPage extends HookConsumerWidget {
AsyncData() => Row(
children: [
Expanded(
child: Text(selectedChannel.value?.name ?? "")),
child: Text(selectedChannel.value?.name ?? ""),
),
IconButton(
onPressed: () async {
final selected = selectedAccount.value;
Expand All @@ -247,7 +248,8 @@ class TabSettingsPage extends HookConsumerWidget {
AsyncData() => Row(
children: [
Expanded(
child: Text(selectedUserList.value?.name ?? "")),
child: Text(selectedUserList.value?.name ?? ""),
),
IconButton(
onPressed: () async {
final selected = selectedAccount.value;
Expand Down Expand Up @@ -279,7 +281,8 @@ class TabSettingsPage extends HookConsumerWidget {
if (selected == null) return;

selectedAntenna.value = await context.pushRoute(
AntennaSelectRoute(account: selected));
AntennaSelectRoute(account: selected),
);
nameController.text = selectedAntenna.value?.name ??
nameController.text;
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,33 +35,34 @@ class UserListSelectDialog extends ConsumerWidget implements AutoRouteWrapper {
width: MediaQuery.of(context).size.width * 0.8,
height: MediaQuery.of(context).size.height * 0.8,
child: SingleChildScrollView(
child: switch (usersList) {
AsyncLoading() => const Center(child: CircularProgressIndicator()),
AsyncError(:final error, :final stackTrace) =>
ErrorDetail(error: error, stackTrace: stackTrace),
AsyncData(:final value) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).list,
style: Theme.of(context).textTheme.titleMedium,
),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: value.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () {
Navigator.of(context).pop(value[index]);
},
title: Text(value[index].name ?? ""),
);
},
),
],
),
}),
child: switch (usersList) {
AsyncLoading() => const Center(child: CircularProgressIndicator()),
AsyncError(:final error, :final stackTrace) =>
ErrorDetail(error: error, stackTrace: stackTrace),
AsyncData(:final value) => Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
S.of(context).list,
style: Theme.of(context).textTheme.titleMedium,
),
ListView.builder(
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
itemCount: value.length,
itemBuilder: (context, index) {
return ListTile(
onTap: () {
Navigator.of(context).pop(value[index]);
},
title: Text(value[index].name ?? ""),
);
},
),
],
),
},
),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,49 +65,49 @@ class InstanceMutePage extends HookConsumerWidget {
appBar: AppBar(title: Text(S.of(context).instanceMute)),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(10),
child: switch (state) {
AsyncLoading() =>
const Center(child: CircularProgressIndicator()),
AsyncError(:final error, :final stackTrace) =>
ErrorDetail(error: error, stackTrace: stackTrace),
AsyncValue() => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Card(
child: Padding(
padding: const EdgeInsets.all(10),
child: Align(
alignment: Alignment.topLeft,
child: Text(S.of(context).instanceMuteDescription1),
),
padding: const EdgeInsets.all(10),
child: switch (state) {
AsyncLoading() => const Center(child: CircularProgressIndicator()),
AsyncError(:final error, :final stackTrace) =>
ErrorDetail(error: error, stackTrace: stackTrace),
AsyncValue() => Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.max,
children: [
Card(
child: Padding(
padding: const EdgeInsets.all(10),
child: Align(
alignment: Alignment.topLeft,
child: Text(S.of(context).instanceMuteDescription1),
),
),
const Padding(
padding: EdgeInsets.only(top: 10),
),
TextField(
maxLines: null,
minLines: 5,
controller: controller,
autofocus: true,
textCapitalization: TextCapitalization.none,
),
Text(
S.of(context).instanceMuteDescription2,
style: Theme.of(context).textTheme.bodySmall,
),
ElevatedButton.icon(
onPressed: () async => ref
.read(instanceMutePageNotifierProvider.notifier)
.save(controller.text),
icon: const Icon(Icons.save),
label: Text(S.of(context).save),
),
],
),
}),
),
const Padding(
padding: EdgeInsets.only(top: 10),
),
TextField(
maxLines: null,
minLines: 5,
controller: controller,
autofocus: true,
textCapitalization: TextCapitalization.none,
),
Text(
S.of(context).instanceMuteDescription2,
style: Theme.of(context).textTheme.bodySmall,
),
ElevatedButton.icon(
onPressed: () async => ref
.read(instanceMutePageNotifierProvider.notifier)
.save(controller.text),
icon: const Icon(Icons.save),
label: Text(S.of(context).save),
),
],
),
},
),
),
);
}
Expand Down
22 changes: 12 additions & 10 deletions lib/view/time_line_page/timeline_tablet_ui.dart
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class Timeline extends HookConsumerWidget {
tabSetting: tabSetting,
controller: scrollController,
),
)
),
],
),
);
Expand Down Expand Up @@ -267,15 +267,17 @@ class EmojiInputComplement extends HookWidget {
Widget build(BuildContext context) {
final overlayEntry = useState<OverlayEntry?>(null);
final layerLink = useMemoized(() => LayerLink());
final options = useMemoized(() => [
"apple",
"banana",
"grape",
"orange",
"pineapple",
"strawberry",
"watermelon"
]);
final options = useMemoized(
() => [
"apple",
"banana",
"grape",
"orange",
"pineapple",
"strawberry",
"watermelon",
],
);

final hideOverlay = useCallback(
() {
Expand Down
2 changes: 1 addition & 1 deletion lib/view/user_page/update_memo_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class UpdateMemoDialog extends HookConsumerWidget implements AutoRouteWrapper {
onPressed: () async => updateMemo.execute(),
child: Text(S.of(context).save),
),
}
},
],
);
}
Expand Down
Loading

0 comments on commit 690f997

Please sign in to comment.