forked from Nexus/nexus
tweak PMP support
This commit is contained in:
parent
3b7a4c0cd4
commit
4800123044
2 changed files with 69 additions and 61 deletions
|
|
@ -3,7 +3,7 @@ import "dart:io";
|
|||
import "package:fast_immutable_collections/fast_immutable_collections.dart";
|
||||
import "package:collection/collection.dart";
|
||||
import "package:material_adaptive_sheets/material_adaptive_sheets.dart";
|
||||
import "package:nexus/widgets/composer/persona_button.dart";
|
||||
import "package:nexus/widgets/composer/subprofile_button.dart";
|
||||
import "package:nexus/controllers/bot_argument_suggestions.dart";
|
||||
import "package:nexus/controllers/bot_command_draft.dart";
|
||||
import "package:nexus/controllers/bot_commands.dart";
|
||||
|
|
@ -566,7 +566,7 @@ class const Composer(
|
|||
),
|
||||
)
|
||||
? [
|
||||
PersonaButton(roomId),
|
||||
SubprofileButton(roomId),
|
||||
IconButton(
|
||||
onPressed: hasReplacement
|
||||
? null
|
||||
|
|
|
|||
|
|
@ -2,23 +2,23 @@ import "package:flutter_riverpod/flutter_riverpod.dart";
|
|||
import "package:material_adaptive_sheets/material_adaptive_sheets.dart";
|
||||
import "package:material_ui/material_ui.dart";
|
||||
import "package:nexus/controllers/account_data.dart";
|
||||
import "package:nexus/controllers/personas.dart";
|
||||
import "package:nexus/controllers/subprofiles.dart";
|
||||
import "package:nexus/controllers/settings.dart";
|
||||
import "package:nexus/main.dart";
|
||||
import "package:nexus/widgets/avatars/avatar_or_hash.dart";
|
||||
|
||||
/// Chooses the persona messages are sent as in [roomId], if personas are on.
|
||||
class const PersonaButton(final String roomId, {super.key})
|
||||
/// Chooses the subprofile messages are sent as in [roomId], if subprofiles are on.
|
||||
class const SubprofileButton(final String roomId, {super.key})
|
||||
extends ConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final enabled = ref.watch(
|
||||
SettingsController.provider.select(
|
||||
(settings) => settings.value?.personas ?? false,
|
||||
(settings) => settings.value?.subprofiles ?? false,
|
||||
),
|
||||
);
|
||||
final (:profiles, :current) = ref.watch(
|
||||
PersonasController.provider(roomId),
|
||||
SubprofilesController.provider(roomId),
|
||||
);
|
||||
if (!enabled || profiles.isEmpty) return const SizedBox.shrink();
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ class const PersonaButton(final String roomId, {super.key})
|
|||
return AdaptiveMenuButton<void>(
|
||||
tooltip: switch (current) {
|
||||
final current? => "Sending as ${current.displayName ?? current.id}",
|
||||
null => "Choose persona",
|
||||
null => "Choose subprofile",
|
||||
},
|
||||
icon: switch (current) {
|
||||
final current? => AvatarOrHash(
|
||||
|
|
@ -57,7 +57,7 @@ class const PersonaButton(final String roomId, {super.key})
|
|||
null => Icon(Icons.person),
|
||||
},
|
||||
itemBuilder: (_) => [
|
||||
item(id: "", leading: Icon(Icons.person), title: "Yourself"),
|
||||
item(id: "", leading: Icon(Icons.person), title: "Account Profile"),
|
||||
...profiles.map(
|
||||
(profile) => item(
|
||||
id: profile.id,
|
||||
Loading…
Reference in a new issue