fuard for enabled extensions
This commit is contained in:
@@ -45,7 +45,7 @@ class PinnedAddonBar extends ConsumerWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
final pinned = extensions
|
final pinned = extensions
|
||||||
.where((e) => pinnedIds.contains(e.extensionId))
|
.where((e) => e.enabled && pinnedIds.contains(e.extensionId))
|
||||||
.toList();
|
.toList();
|
||||||
if (pinned.isEmpty) return const SizedBox.shrink();
|
if (pinned.isEmpty) return const SizedBox.shrink();
|
||||||
|
|
||||||
|
|||||||
+5
-7
@@ -534,13 +534,11 @@ final List<ToolbarButtonDefinition> toolbarButtonRegistry = [
|
|||||||
label: 'Extensions',
|
label: 'Extensions',
|
||||||
icon: MdiIcons.puzzle,
|
icon: MdiIcons.puzzle,
|
||||||
longPressActions: ['Extensions Menu'],
|
longPressActions: ['Extensions Menu'],
|
||||||
isPrimaryAvailable: (scope, ref) => ref
|
isPrimaryAvailable: (scope, ref) => ref.read(
|
||||||
.read(
|
webExtensionsStateProvider(
|
||||||
webExtensionsStateProvider(
|
WebExtensionActionType.browser,
|
||||||
WebExtensionActionType.browser,
|
).select((value) => value.values.any((extension) => extension.enabled)),
|
||||||
).select((value) => value.values),
|
),
|
||||||
)
|
|
||||||
.isNotEmpty,
|
|
||||||
builder: (scope, context, ref) {
|
builder: (scope, context, ref) {
|
||||||
if (scope.isPreview) {
|
if (scope.isPreview) {
|
||||||
return IconButton(onPressed: () {}, icon: const Icon(MdiIcons.puzzle));
|
return IconButton(onPressed: () {}, icon: const Icon(MdiIcons.puzzle));
|
||||||
|
|||||||
+8
-2
@@ -46,7 +46,10 @@ class ExtensionShortcutMenu extends HookConsumerWidget {
|
|||||||
).select((value) => value.values.toList()),
|
).select((value) => value.values.toList()),
|
||||||
);
|
);
|
||||||
final unpinnedBrowserExtensions = browserExtensions
|
final unpinnedBrowserExtensions = browserExtensions
|
||||||
.where((extension) => !pinnedIds.contains(extension.extensionId))
|
.where(
|
||||||
|
(extension) =>
|
||||||
|
extension.enabled && !pinnedIds.contains(extension.extensionId),
|
||||||
|
)
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
return MenuAnchor(
|
return MenuAnchor(
|
||||||
@@ -82,7 +85,10 @@ class ExtensionShortcutMenu extends HookConsumerWidget {
|
|||||||
child: const Text('Manage extensions'),
|
child: const Text('Manage extensions'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
child: Visibility(visible: browserExtensions.isNotEmpty, child: child),
|
child: Visibility(
|
||||||
|
visible: browserExtensions.any((extension) => extension.enabled),
|
||||||
|
child: child,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user