slight cleanups

This commit is contained in:
Henry Hiles 2026-10-16 10:56:55 -04:00
commit 00f22d46b7
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
11 changed files with 24 additions and 33 deletions

View file

@ -191,10 +191,9 @@ class ClientController extends AsyncNotifier<int> {
} }
} }
Future<RecoveryKey> generateRecoveryKey({String passphrase = ""}) async => Future<RecoveryKey> generateRecoveryKey(String passphrase) async => .fromJson(
.fromJson( await _sendCommand("generate_recovery_key", {"passphrase": passphrase}),
await _sendCommand("generate_recovery_key", {"passphrase": passphrase}), );
);
Future<void> resetEncryption(RecoveryKey key) => Future<void> resetEncryption(RecoveryKey key) =>
_sendCommand("reset_encryption", key.toJson()); _sendCommand("reset_encryption", key.toJson());

View file

@ -67,7 +67,7 @@ final class ChatScroll({
await Scrollable.ensureVisible( await Scrollable.ensureVisible(
context!, context!,
alignment: 0.5, alignment: 0.5,
duration: const .new(milliseconds: 700), duration: Durations.extralong1,
curve: Curves.easeInOut, curve: Curves.easeInOut,
); );
} }
@ -179,7 +179,7 @@ final class ChatScroll({
await Scrollable.ensureVisible( await Scrollable.ensureVisible(
context, context,
alignment: 0.5, alignment: 0.5,
duration: const .new(milliseconds: 700), duration: Durations.extralong1,
curve: Curves.easeInOut, curve: Curves.easeInOut,
); );
return; return;
@ -203,7 +203,7 @@ final class ChatScroll({
await scrollController.animateTo( await scrollController.animateTo(
scrollController.position.minScrollExtent, scrollController.position.minScrollExtent,
duration: const .new(milliseconds: 700), duration: Durations.extralong1,
curve: Curves.easeInOut, curve: Curves.easeInOut,
); );
}, },

View file

@ -13,7 +13,7 @@ final class const HighlightWrapper(
color: isHighlighted color: isHighlighted
? Theme.of(context).colorScheme.onSurface.withAlpha(50) ? Theme.of(context).colorScheme.onSurface.withAlpha(50)
: Colors.transparent, : Colors.transparent,
duration: .new(milliseconds: 250), duration: Durations.medium1,
child: Material(color: Colors.transparent, child: child), child: Material(color: Colors.transparent, child: child),
), ),
); );

View file

@ -9,7 +9,7 @@ class const SpoilerText(final String text, {super.key}) extends HookWidget {
return InkWell( return InkWell(
onTap: () => revealed.value = !revealed.value, onTap: () => revealed.value = !revealed.value,
child: AnimatedContainer( child: AnimatedContainer(
duration: const .new(milliseconds: 100), duration: Durations.short2,
padding: const .symmetric(horizontal: 4, vertical: 2), padding: const .symmetric(horizontal: 4, vertical: 2),
decoration: BoxDecoration( decoration: BoxDecoration(
color: revealed.value ? Colors.transparent : Colors.blueGrey, color: revealed.value ? Colors.transparent : Colors.blueGrey,

View file

@ -98,10 +98,10 @@ class const NotificationsList({super.key})
index: index, index: index,
scrollController: scrollController, scrollController: scrollController,
alignment: 0.5, alignment: 0.5,
duration: (_) => .new(milliseconds: 700), duration: (_) => Durations.extralong1,
curve: (_) => Curves.easeInOut, curve: (_) => Curves.easeInOut,
); );
timer = Timer(.new(seconds: 1), () { timer = Timer(Durations.extralong4, () {
highlightedId.value = null; highlightedId.value = null;
}); });
}); });

View file

@ -81,11 +81,11 @@ class const SettingsPage({super.key}) extends ConsumerWidget {
index: match.$1.$2, index: match.$1.$2,
scrollController: scrollController, scrollController: scrollController,
alignment: 0.5, alignment: 0.5,
duration: (_) => .new(milliseconds: 700), duration: (_) => Durations.extralong1,
curve: (_) => Curves.easeInOut, curve: (_) => Curves.easeInOut,
); );
highlightedMatch.value = match.$1; highlightedMatch.value = match.$1;
await Future.delayed(.new(seconds: 1), () { await Future.delayed(Durations.extralong4, () {
if (highlightedMatch.value == match.$1) { if (highlightedMatch.value == match.$1) {
highlightedMatch.value = null; highlightedMatch.value = null;
} }

View file

@ -31,10 +31,10 @@ class const SettingsCategoryPage(
index: initialHighlight!, index: initialHighlight!,
scrollController: scrollController, scrollController: scrollController,
alignment: 0.5, alignment: 0.5,
duration: (_) => .new(milliseconds: 700), duration: (_) => Durations.extralong1,
curve: (_) => Curves.easeInOut, curve: (_) => Curves.easeInOut,
); );
timer = Timer(.new(seconds: 1), () { timer = Timer(Durations.extralong4, () {
highlight.value = null; highlight.value = null;
}); });
listController.value.removeListener(listener); listController.value.removeListener(listener);

View file

@ -53,7 +53,7 @@ class const ResetEncryptionSheet({
final recoveryKey = await ref final recoveryKey = await ref
.read(ClientController.provider.notifier) .read(ClientController.provider.notifier)
.generateRecoveryKey( .generateRecoveryKey(
passphrase: usePassphrase.value ? passphrase : "", usePassphrase.value ? passphrase : "",
); );
if (!context.mounted) return; if (!context.mounted) return;

View file

@ -143,7 +143,7 @@ final class const RoomChat({
highlightedEvent.value = rowId; highlightedEvent.value = rowId;
await scroll.jumpToEvent(rowId); await scroll.jumpToEvent(rowId);
await Future.delayed(.new(milliseconds: 700), () { await Future.delayed(Durations.extralong1, () {
if (highlightedEvent.value == rowId) { if (highlightedEvent.value == rowId) {
highlightedEvent.value = null; highlightedEvent.value = null;
} }
@ -240,7 +240,7 @@ final class const RoomChat({
ignoring: scroll.atBottom, ignoring: scroll.atBottom,
child: AnimatedOpacity( child: AnimatedOpacity(
opacity: scroll.atBottom ? 0 : 1, opacity: scroll.atBottom ? 0 : 1,
duration: const Duration(milliseconds: 200), duration: Durations.short4,
child: FloatingActionButton.small( child: FloatingActionButton.small(
onPressed: scroll.jumpToBottom, onPressed: scroll.jumpToBottom,
child: const Icon(Icons.keyboard_arrow_down), child: const Icon(Icons.keyboard_arrow_down),

View file

@ -42,7 +42,7 @@ class const SyncStatusBanner({super.key}) extends ConsumerWidget {
]; ];
return AnimatedSize( return AnimatedSize(
duration: const .new(milliseconds: 200), duration: Durations.short4,
alignment: .topCenter, alignment: .topCenter,
child: banner == null child: banner == null
? const SizedBox(width: double.infinity) ? const SizedBox(width: double.infinity)

View file

@ -233,13 +233,9 @@ final class const UserBottomSheet(
shape: .square, shape: .square,
icon: Icon(Icons.sports_martial_arts), icon: Icon(Icons.sports_martial_arts),
label: Text("Kick"), label: Text("Kick"),
decoration: .new( decoration: .styleFrom(
backgroundColor: WidgetStatePropertyAll( backgroundColor: theme.colorScheme.error,
theme.colorScheme.error, foregroundColor: theme.colorScheme.onError,
),
foregroundColor: WidgetStatePropertyAll(
theme.colorScheme.onError,
),
), ),
), ),
@ -248,13 +244,9 @@ final class const UserBottomSheet(
shape: .square, shape: .square,
icon: Icon(Icons.gavel), icon: Icon(Icons.gavel),
label: Text("Ban"), label: Text("Ban"),
decoration: .new( decoration: .styleFrom(
backgroundColor: WidgetStatePropertyAll( backgroundColor: theme.colorScheme.errorContainer,
theme.colorScheme.errorContainer, foregroundColor: theme.colorScheme.onErrorContainer,
),
foregroundColor: WidgetStatePropertyAll(
theme.colorScheme.onErrorContainer,
),
), ),
), ),
].map((e) => Expanded(child: e)).toList(), ].map((e) => Expanded(child: e)).toList(),