From 71efc3cfa539923946111a03f9edbec720e2464d Mon Sep 17 00:00:00 2001 From: Tommy Chow Date: Tue, 6 Jan 2026 20:22:14 -0500 Subject: [PATCH] format --- lib/main.dart | 15 ++-- .../channel/chat/stores/chat_store.dart | 22 +++--- .../channel/chat/widgets/chat_bottom_bar.dart | 73 ++++++++++--------- lib/screens/channel/video/video_store.dart | 4 +- 4 files changed, 63 insertions(+), 51 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 46a6e08b..9696c3d4 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -61,9 +61,11 @@ void main() async { // Don't block - run in background after app starts. // This is safe because first run means no active session depends on this data. - unawaited(storage.deleteAll().catchError((e) { - debugPrint('Error clearing secure storage: $e'); - })); + unawaited( + storage.deleteAll().catchError((e) { + debugPrint('Error clearing secure storage: $e'); + }), + ); } await initUtils(); @@ -190,9 +192,10 @@ class _MyAppState extends State { // Handle the initial link if app was opened from a link. // Add timeout to prevent indefinite blocking on certain Android lifecycle states. - final initialLink = await _appLinks - .getInitialLink() - .timeout(const Duration(seconds: 3), onTimeout: () => null); + final initialLink = await _appLinks.getInitialLink().timeout( + const Duration(seconds: 3), + onTimeout: () => null, + ); if (initialLink != null) { handleDeepLink(initialLink); } diff --git a/lib/screens/channel/chat/stores/chat_store.dart b/lib/screens/channel/chat/stores/chat_store.dart index d4b1e02a..b75422c1 100644 --- a/lib/screens/channel/chat/stores/chat_store.dart +++ b/lib/screens/channel/chat/stores/chat_store.dart @@ -279,8 +279,11 @@ abstract class ChatStoreBase with Store { @computed List get matchingChatters { if (!_showMentionAutocomplete) return const []; - final searchTerm = - _inputText.split(' ').last.replaceFirst('@', '').toLowerCase(); + final searchTerm = _inputText + .split(' ') + .last + .replaceFirst('@', '') + .toLowerCase(); return chatDetailsStore.chatUsers .where((chatter) => chatter.contains(searchTerm)) .toList(); @@ -623,8 +626,9 @@ abstract class ChatStoreBase with Store { // Transform reconnect message to summary on successful connection if (_reconnectMessage != null && _reconnectStartTime != null) { - final elapsed = - DateTime.now().difference(_reconnectStartTime!).inSeconds; + final elapsed = DateTime.now() + .difference(_reconnectStartTime!) + .inSeconds; final attempts = _retries; final index = _messages.indexOf(_reconnectMessage!); if (index != -1) { @@ -896,7 +900,8 @@ abstract class ChatStoreBase with Store { void updateReconnectMessage(String text) { final msg = IRCMessage.createNotice(message: text); if (_reconnectMessage == null) { - _reconnectStartTime ??= DateTime.now(); // Record when reconnection started + _reconnectStartTime ??= + DateTime.now(); // Record when reconnection started _reconnectMessage = msg; _messages.add(_reconnectMessage!); } else { @@ -1108,9 +1113,7 @@ abstract class ChatStoreBase with Store { if (_isWaitingForAck) { _isWaitingForAck = false; toSend = null; - updateNotification( - 'Message may not have been sent. Please try again.', - ); + updateNotification('Message may not have been sent. Please try again.'); } }); @@ -1131,8 +1134,7 @@ abstract class ChatStoreBase with Store { userChatMessage.tags['user-id'] = auth.user.details!.id; } - if (replyingToMessage != null && - replyingToMessage!.tags['id'] != null) { + if (replyingToMessage != null && replyingToMessage!.tags['id'] != null) { userChatMessage.tags['reply-parent-msg-id'] = replyingToMessage!.tags['id']!; userChatMessage.tags['reply-parent-display-name'] = diff --git a/lib/screens/channel/chat/widgets/chat_bottom_bar.dart b/lib/screens/channel/chat/widgets/chat_bottom_bar.dart index b36883fa..5061aa47 100644 --- a/lib/screens/channel/chat/widgets/chat_bottom_bar.dart +++ b/lib/screens/channel/chat/widgets/chat_bottom_bar.dart @@ -96,17 +96,17 @@ class ChatBottomBar extends StatelessWidget { preferBelow: false, child: Text.rich( TextSpan( - children: - chatStore.replyingToMessage!.generateSpan( - context, - assetsStore: chatStore.assetsStore, - emoteScale: chatStore.settings.emoteScale, - badgeScale: chatStore.settings.badgeScale, - launchExternal: - chatStore.settings.launchUrlExternal, - timestamp: chatStore.settings.timestampType, - currentChannelId: chatStore.channelId, - ), + children: chatStore.replyingToMessage! + .generateSpan( + context, + assetsStore: chatStore.assetsStore, + emoteScale: chatStore.settings.emoteScale, + badgeScale: chatStore.settings.badgeScale, + launchExternal: + chatStore.settings.launchUrlExternal, + timestamp: chatStore.settings.timestampType, + currentChannelId: chatStore.channelId, + ), ), maxLines: 1, overflow: TextOverflow.ellipsis, @@ -265,11 +265,13 @@ class ChatBottomBar extends StatelessWidget { maxLines: 3, enabled: isEnabled, specialTextSpanBuilder: EmoteTextSpanBuilder( - emoteToObject: chatStore.assetsStore.emoteToObject, + emoteToObject: + chatStore.assetsStore.emoteToObject, userEmoteToObject: chatStore.assetsStore.userEmoteToObject, emoteSize: - chatStore.settings.emoteScale * defaultEmoteSize, + chatStore.settings.emoteScale * + defaultEmoteSize, ), decoration: InputDecoration( prefixIcon: @@ -291,16 +293,16 @@ class ChatBottomBar extends StatelessWidget { hintText: !isLoggedIn ? loginTooltipMessage : !isConnected - ? (hasConnected - ? 'Chat disconnected' - : 'Connecting...') - : isWaitingForAck - ? 'Sending...' - : chatStore.replyingToMessage != null - ? 'Reply' - : hasChatDelay - ? 'Chat (${chatStore.settings.chatDelay.toInt()}s delay)' - : 'Chat', + ? (hasConnected + ? 'Chat disconnected' + : 'Connecting...') + : isWaitingForAck + ? 'Sending...' + : chatStore.replyingToMessage != null + ? 'Reply' + : hasChatDelay + ? 'Chat (${chatStore.settings.chatDelay.toInt()}s delay)' + : 'Chat', ), controller: chatStore.textController, onSubmitted: chatStore.sendMessage, @@ -313,7 +315,8 @@ class ChatBottomBar extends StatelessWidget { ), ), TextFieldTapRegion( - child: chatStore.showSendButton && + child: + chatStore.showSendButton && (chatStore.settings.chatWidth >= 0.3 || chatStore.expandChat || context.isPortrait) @@ -344,16 +347,18 @@ class ChatBottomBar extends StatelessWidget { : IconButton( icon: Icon(Icons.adaptive.more_rounded), tooltip: 'More', - onPressed: () => showModalBottomSheetWithProperFocus( - isScrollControlled: true, - context: context, - builder: (_) => ChatDetails( - chatDetailsStore: chatStore.chatDetailsStore, - chatStore: chatStore, - userLogin: chatStore.channelName, - onAddChat: onAddChat, - ), - ), + onPressed: () => + showModalBottomSheetWithProperFocus( + isScrollControlled: true, + context: context, + builder: (_) => ChatDetails( + chatDetailsStore: + chatStore.chatDetailsStore, + chatStore: chatStore, + userLogin: chatStore.channelName, + onAddChat: onAddChat, + ), + ), ), ), ], diff --git a/lib/screens/channel/video/video_store.dart b/lib/screens/channel/video/video_store.dart index f707123e..2d2573b8 100644 --- a/lib/screens/channel/video/video_store.dart +++ b/lib/screens/channel/video/video_store.dart @@ -305,7 +305,9 @@ abstract class VideoStoreBase with Store { } else { // Stop tracker if both settings are now disabled try { - videoWebViewController.runJavaScript('window._latencyTracker?.stop()'); + videoWebViewController.runJavaScript( + 'window._latencyTracker?.stop()', + ); } catch (e) { debugPrint(e.toString()); }