fix formatting
This commit is contained in:
@@ -460,14 +460,17 @@ class TabRepository extends _$TabRepository {
|
||||
.read(tabDataRepositoryProvider.notifier)
|
||||
.getTabContainerData(tabState.id);
|
||||
|
||||
final contextChanging = containerData.metadata.contextualIdentity !=
|
||||
final contextChanging =
|
||||
containerData.metadata.contextualIdentity !=
|
||||
currentContainerData?.metadata.contextualIdentity;
|
||||
|
||||
await addTab(
|
||||
url: uri,
|
||||
private: tabState.isPrivate,
|
||||
container: Value(containerData),
|
||||
parentId: contextChanging ? null : tabState.id, // Break parent chain if context changes
|
||||
parentId: contextChanging
|
||||
? null
|
||||
: tabState.id, // Break parent chain if context changes
|
||||
selectTab: true,
|
||||
);
|
||||
|
||||
|
||||
@@ -31,7 +31,9 @@ part 'bookmarks.g.dart';
|
||||
bool _isEmptyRootFolder(BookmarkFolder folder) {
|
||||
if (folder.children == null) return true;
|
||||
// A root folder is empty if it has no children, or only contains other root folders
|
||||
return folder.children!.every((child) => bookmarkRootIds.contains(child.guid));
|
||||
return folder.children!.every(
|
||||
(child) => bookmarkRootIds.contains(child.guid),
|
||||
);
|
||||
}
|
||||
|
||||
T? _selectChildRecursive<T extends BookmarkItem>(
|
||||
@@ -152,10 +154,12 @@ AsyncValue<T?> bookmarks<T extends BookmarkItem>(
|
||||
entryGuid == BookmarkRoot.root.id &&
|
||||
result is BookmarkFolder) {
|
||||
final filteredChildren = result.children
|
||||
?.where((child) =>
|
||||
child is! BookmarkFolder ||
|
||||
child.guid == BookmarkRoot.mobile.id ||
|
||||
!_isEmptyRootFolder(child))
|
||||
?.where(
|
||||
(child) =>
|
||||
child is! BookmarkFolder ||
|
||||
child.guid == BookmarkRoot.mobile.id ||
|
||||
!_isEmptyRootFolder(child),
|
||||
)
|
||||
.toList();
|
||||
result = result.copyWith.children(filteredChildren) as T;
|
||||
}
|
||||
@@ -187,8 +191,16 @@ class SeamlessBookmarks extends _$SeamlessBookmarks {
|
||||
}
|
||||
|
||||
@override
|
||||
AsyncValue<BookmarkItem?> build(String entryGuid, {bool hideEmptyRoots = false}) {
|
||||
final bookmarks = ref.watch(bookmarksProvider<BookmarkItem>(entryGuid, hideEmptyRoots: hideEmptyRoots));
|
||||
AsyncValue<BookmarkItem?> build(
|
||||
String entryGuid, {
|
||||
bool hideEmptyRoots = false,
|
||||
}) {
|
||||
final bookmarks = ref.watch(
|
||||
bookmarksProvider<BookmarkItem>(
|
||||
entryGuid,
|
||||
hideEmptyRoots: hideEmptyRoots,
|
||||
),
|
||||
);
|
||||
|
||||
if (_hasSearch) {
|
||||
final filterGuids = ref.watch(bookmarksSearchProvider);
|
||||
|
||||
+26
-9
@@ -49,15 +49,30 @@ class BookmarkListScreen extends HookConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final treeKey = useMemoized(() => GlobalKey<TreeViewState>());
|
||||
final hideEmptyRoots = useState(true);
|
||||
final bookmarkList = ref.watch(seamlessBookmarksProvider(entryGuid, hideEmptyRoots: hideEmptyRoots.value));
|
||||
final bookmarkList = ref.watch(
|
||||
seamlessBookmarksProvider(
|
||||
entryGuid,
|
||||
hideEmptyRoots: hideEmptyRoots.value,
|
||||
),
|
||||
);
|
||||
|
||||
final textFilterEnabled = useState(false);
|
||||
final textFilterController = useTextEditingController();
|
||||
|
||||
useOnListenableChange(textFilterController, () {
|
||||
if (ref.exists(seamlessBookmarksProvider(entryGuid, hideEmptyRoots: hideEmptyRoots.value))) {
|
||||
if (ref.exists(
|
||||
seamlessBookmarksProvider(
|
||||
entryGuid,
|
||||
hideEmptyRoots: hideEmptyRoots.value,
|
||||
),
|
||||
)) {
|
||||
ref
|
||||
.read(seamlessBookmarksProvider(entryGuid, hideEmptyRoots: hideEmptyRoots.value).notifier)
|
||||
.read(
|
||||
seamlessBookmarksProvider(
|
||||
entryGuid,
|
||||
hideEmptyRoots: hideEmptyRoots.value,
|
||||
).notifier,
|
||||
)
|
||||
.search(textFilterController.text);
|
||||
}
|
||||
});
|
||||
@@ -109,12 +124,14 @@ class BookmarkListScreen extends HookConsumerWidget {
|
||||
),
|
||||
if (entryGuid == BookmarkRoot.root.id)
|
||||
MenuItemButton(
|
||||
leadingIcon: Icon(hideEmptyRoots.value
|
||||
? MdiIcons.eyeOff
|
||||
: MdiIcons.eye),
|
||||
child: Text(hideEmptyRoots.value
|
||||
? 'Show Empty Root Folders'
|
||||
: 'Hide Empty Root Folders'),
|
||||
leadingIcon: Icon(
|
||||
hideEmptyRoots.value ? MdiIcons.eyeOff : MdiIcons.eye,
|
||||
),
|
||||
child: Text(
|
||||
hideEmptyRoots.value
|
||||
? 'Show Empty Root Folders'
|
||||
: 'Hide Empty Root Folders',
|
||||
),
|
||||
onPressed: () {
|
||||
hideEmptyRoots.value = !hideEmptyRoots.value;
|
||||
},
|
||||
|
||||
+1
-4
@@ -128,10 +128,7 @@ class BrowserBottomAppBar extends HookConsumerWidget {
|
||||
color: Theme.of(context).colorScheme.surfaceContainer,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(bottom: bottomPadding),
|
||||
child: SizedBox(
|
||||
height: _size.height,
|
||||
child: _tabBar,
|
||||
),
|
||||
child: SizedBox(height: _size.height, child: _tabBar),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
+3
-1
@@ -319,7 +319,9 @@ class ListTabPreview extends HookConsumerWidget {
|
||||
child: UriBreadcrumb(
|
||||
uri: tabState.url,
|
||||
style: Theme.of(context).textTheme.bodySmall?.copyWith(
|
||||
color: tabState.isPrivate ? colorScheme.onSurface : null,
|
||||
color: tabState.isPrivate
|
||||
? colorScheme.onSurface
|
||||
: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
+3
-1
@@ -184,7 +184,9 @@ class ViewTabTreesWidget extends HookConsumerWidget {
|
||||
searchPartition: TabSearchPartition.preview,
|
||||
// ignore: document_ignores using fast equatable
|
||||
// ignore: provider_parameters
|
||||
containerFilter: ContainerFilterById(containerId: containerId),
|
||||
containerFilter: ContainerFilterById(
|
||||
containerId: containerId,
|
||||
),
|
||||
groupTrees: true,
|
||||
),
|
||||
);
|
||||
|
||||
@@ -260,7 +260,8 @@ class TabDao extends DatabaseAccessor<TabDatabase> with $TabDaoMixin {
|
||||
for (final state in next.values) {
|
||||
final previousState = previous?[state.id];
|
||||
|
||||
if (previousState?.parentId != state.parentId && state.parentId != null) {
|
||||
if (previousState?.parentId != state.parentId &&
|
||||
state.parentId != null) {
|
||||
if (next.containsKey(state.parentId)) {
|
||||
// Parent exists in current state
|
||||
validatedParentIds[state.id] = state.parentId;
|
||||
@@ -272,8 +273,9 @@ class TabDao extends DatabaseAccessor<TabDatabase> with $TabDaoMixin {
|
||||
}
|
||||
|
||||
// Batch validate parent IDs that aren't in the current state
|
||||
final existingParentIds =
|
||||
await getExistingTabIds(parentIdsToValidate).get().then((ids) => ids.toSet());
|
||||
final existingParentIds = await getExistingTabIds(
|
||||
parentIdsToValidate,
|
||||
).get().then((ids) => ids.toSet());
|
||||
|
||||
// Complete validation map
|
||||
for (final state in next.values) {
|
||||
@@ -282,7 +284,8 @@ class TabDao extends DatabaseAccessor<TabDatabase> with $TabDaoMixin {
|
||||
if (previousState?.parentId != state.parentId) {
|
||||
if (!validatedParentIds.containsKey(state.id)) {
|
||||
// This parent ID needed database validation
|
||||
if (state.parentId != null && existingParentIds.contains(state.parentId)) {
|
||||
if (state.parentId != null &&
|
||||
existingParentIds.contains(state.parentId)) {
|
||||
validatedParentIds[state.id] = state.parentId;
|
||||
} else {
|
||||
validatedParentIds[state.id] = null;
|
||||
|
||||
Reference in New Issue
Block a user