mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-08-14 08:55:26 -04:00
statenotifier
This commit is contained in:
parent
8f0b4aaba0
commit
7a49497620
15 changed files with 28 additions and 56 deletions
|
@ -207,7 +207,8 @@ class ChatComponentState extends ConsumerState<ChatComponent> {
|
|||
IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: () async {
|
||||
activeChatState.add(null);
|
||||
ref.read(activeChatStateProvider.notifier).state =
|
||||
null;
|
||||
}).paddingLTRB(16, 0, 16, 0)
|
||||
]),
|
||||
),
|
||||
|
|
|
@ -20,7 +20,7 @@ class ChatSingleContactItemWidget extends ConsumerWidget {
|
|||
//final textTheme = theme.textTheme;
|
||||
final scale = theme.extension<ScaleScheme>()!;
|
||||
|
||||
final activeChat = ref.watch(activeChatStateProvider).value;
|
||||
final activeChat = ref.watch(activeChatStateProvider);
|
||||
final remoteConversationRecordKey =
|
||||
proto.TypedKeyProto.fromProto(contact.remoteConversationRecordKey);
|
||||
final selected = activeChat == remoteConversationRecordKey;
|
||||
|
@ -69,7 +69,8 @@ class ChatSingleContactItemWidget extends ConsumerWidget {
|
|||
// component is not dragged.
|
||||
child: ListTile(
|
||||
onTap: () async {
|
||||
activeChatState.add(remoteConversationRecordKey);
|
||||
ref.read(activeChatStateProvider.notifier).state =
|
||||
remoteConversationRecordKey;
|
||||
ref.invalidate(fetchChatListProvider);
|
||||
},
|
||||
title: Text(contact.editedProfile.name),
|
||||
|
|
|
@ -15,10 +15,8 @@ class SignalStrengthMeterWidget extends ConsumerWidget {
|
|||
final scale = theme.extension<ScaleScheme>()!;
|
||||
|
||||
const iconSize = 16.0;
|
||||
final connState = ref.watch(globalConnectionStateProvider).value;
|
||||
if (connState == null) {
|
||||
return const Icon(Icons.signal_cellular_off, size: iconSize);
|
||||
}
|
||||
final connState = ref.watch(globalConnectionStateProvider);
|
||||
|
||||
late final double value;
|
||||
late final Color color;
|
||||
late final Color inactiveColor;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue