Skip to content

Commit

Permalink
tag_browse: make the route more responsible over the appbar actions a…
Browse files Browse the repository at this point in the history
…nd change the icon for collections
  • Loading branch information
resucutie committed Oct 13, 2024
1 parent 9ab0956 commit 56d8575
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
16 changes: 14 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,13 @@ final router = GoRouter(
desktopDisplay: orientation == Orientation.landscape,
initialText: tags,
),
onAddPressed: () => context.push("/manage_image"),
actions: [
IconButton(
icon: const Icon(Icons.add),
tooltip: "Add image",
onPressed: () => context.push("/manage_image"),
),
],
);
}
),
Expand Down Expand Up @@ -278,7 +284,13 @@ final router = GoRouter(
)
],
forceOrientation: Orientation.portrait,
onAddPressed: () => context.push("/settings/booru/collections?id=$id"),
actions: [
IconButton(
icon: const Icon(Icons.add_photo_alternate_outlined),
tooltip: "Add image",
onPressed: () => context.push("/settings/booru/collections?id=$id"),
),
],
);
}
),
Expand Down
12 changes: 4 additions & 8 deletions lib/views/navigation/tag_browse.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import 'package:shared_preferences/shared_preferences.dart';
import 'package:sliver_tools/sliver_tools.dart';

class GalleryViewer extends StatefulWidget {
const GalleryViewer({super.key, required this.searcher, this.headerDisplay, this.index = 0, this.selectionMode = false, this.onSelect, this.onNextPage, this.selectedImages, this.displayBackButton = true, this.forceOrientation, this.onAddPressed, this.additionalMenuOptions});
const GalleryViewer({super.key, required this.searcher, this.headerDisplay, this.index = 0, this.selectionMode = false, this.onSelect, this.onNextPage, this.selectedImages, this.displayBackButton = true, this.forceOrientation, this.actions, this.additionalMenuOptions});

final int index;
final FutureOr<SearchableInformation> Function(int index) searcher;
Expand All @@ -28,7 +28,7 @@ class GalleryViewer extends StatefulWidget {
final Orientation? forceOrientation;
final void Function(List<ImageID>)? onSelect;
final void Function(int newIndex)? onNextPage;
final void Function()? onAddPressed;
final List<Widget>? actions;
final List<ImageID>? selectedImages;
final List<PopupMenuEntry<dynamic>>? additionalMenuOptions;

Expand Down Expand Up @@ -127,12 +127,8 @@ class _GalleryViewerState extends State<GalleryViewer> {

@override
Widget build(BuildContext context) {
final actions = [
IconButton(
icon: const Icon(Icons.add),
tooltip: "Add image",
onPressed: widget.onAddPressed,
),
final List<Widget> actions = [
...(widget.actions ?? []),
PopupMenuButton(
itemBuilder: (context) {
return [
Expand Down

0 comments on commit 56d8575

Please sign in to comment.