Add QoL feed, download and quality improvements
This commit is contained in:
@@ -27,6 +27,19 @@ class AppShell extends StatelessWidget {
|
||||
LogicalKeySet(LogicalKeyboardKey.control, LogicalKeyboardKey.keyF):
|
||||
const _NavigateIntent('/search'),
|
||||
LogicalKeySet(LogicalKeyboardKey.escape): const _BackIntent(),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit1): const _NavigateIntent('/'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit2):
|
||||
const _NavigateIntent('/search'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit3):
|
||||
const _NavigateIntent('/favorites'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit4):
|
||||
const _NavigateIntent('/viewed'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit5):
|
||||
const _NavigateIntent('/collections'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit6):
|
||||
const _NavigateIntent('/providers'),
|
||||
LogicalKeySet(LogicalKeyboardKey.digit7):
|
||||
const _NavigateIntent('/settings'),
|
||||
},
|
||||
child: Actions(
|
||||
actions: {
|
||||
|
||||
@@ -16,6 +16,10 @@ class PostCard extends StatefulWidget {
|
||||
required this.onOpen,
|
||||
required this.onFavorite,
|
||||
this.onAddToCollection,
|
||||
this.onPreview,
|
||||
this.onToggleSelected,
|
||||
this.selectionMode = false,
|
||||
this.selected = false,
|
||||
super.key,
|
||||
});
|
||||
|
||||
@@ -27,6 +31,10 @@ class PostCard extends StatefulWidget {
|
||||
final VoidCallback onOpen;
|
||||
final VoidCallback onFavorite;
|
||||
final VoidCallback? onAddToCollection;
|
||||
final VoidCallback? onPreview;
|
||||
final VoidCallback? onToggleSelected;
|
||||
final bool selectionMode;
|
||||
final bool selected;
|
||||
|
||||
@override
|
||||
State<PostCard> createState() => _PostCardState();
|
||||
@@ -46,7 +54,24 @@ class _PostCardState extends State<PostCard> {
|
||||
onEnter: (_) => setState(() => _hovered = true),
|
||||
onExit: (_) => setState(() => _hovered = false),
|
||||
child: GestureDetector(
|
||||
onTap: widget.onOpen,
|
||||
onTap: () {
|
||||
if (widget.selectionMode) {
|
||||
widget.onToggleSelected?.call();
|
||||
return;
|
||||
}
|
||||
widget.onOpen();
|
||||
},
|
||||
onLongPress: () {
|
||||
if (widget.selectionMode && widget.onToggleSelected != null) {
|
||||
widget.onToggleSelected!();
|
||||
return;
|
||||
}
|
||||
if (widget.onPreview != null) {
|
||||
widget.onPreview!();
|
||||
return;
|
||||
}
|
||||
widget.onToggleSelected?.call();
|
||||
},
|
||||
onSecondaryTapDown: (details) {
|
||||
showMenu<void>(
|
||||
context: context,
|
||||
@@ -119,6 +144,29 @@ class _PostCardState extends State<PostCard> {
|
||||
child: _SeenBadge(),
|
||||
),
|
||||
],
|
||||
if (widget.selected)
|
||||
Positioned.fill(
|
||||
child: DecoratedBox(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.primary
|
||||
.withValues(alpha: 0.24),
|
||||
border: Border.all(
|
||||
color: Theme.of(context).colorScheme.primary,
|
||||
width: 3,
|
||||
),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: const Align(
|
||||
alignment: Alignment.topRight,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(8),
|
||||
child: Icon(Icons.check_circle_rounded),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (mobile)
|
||||
Positioned(
|
||||
right: 8,
|
||||
|
||||
@@ -16,6 +16,10 @@ class PostMasonryGrid extends StatelessWidget {
|
||||
required this.onOpen,
|
||||
required this.onFavorite,
|
||||
this.onAddToCollection,
|
||||
this.onPreview,
|
||||
this.onToggleSelected,
|
||||
this.selectionMode = false,
|
||||
this.selectedKeys = const {},
|
||||
this.favoriteKeys = const {},
|
||||
this.viewedKeys = const {},
|
||||
this.loading = false,
|
||||
@@ -31,6 +35,10 @@ class PostMasonryGrid extends StatelessWidget {
|
||||
final ValueChanged<Post> onOpen;
|
||||
final ValueChanged<Post> onFavorite;
|
||||
final ValueChanged<Post>? onAddToCollection;
|
||||
final ValueChanged<Post>? onPreview;
|
||||
final ValueChanged<Post>? onToggleSelected;
|
||||
final bool selectionMode;
|
||||
final Set<String> selectedKeys;
|
||||
final Set<String> favoriteKeys;
|
||||
final Set<String> viewedKeys;
|
||||
final bool loading;
|
||||
@@ -57,6 +65,11 @@ class PostMasonryGrid extends StatelessWidget {
|
||||
isViewed: viewedKeys.contains(post.cacheKey),
|
||||
onOpen: () => onOpen(post),
|
||||
onFavorite: () => onFavorite(post),
|
||||
onPreview: onPreview == null ? null : () => onPreview!(post),
|
||||
selectionMode: selectionMode,
|
||||
selected: selectedKeys.contains(post.cacheKey),
|
||||
onToggleSelected:
|
||||
onToggleSelected == null ? null : () => onToggleSelected!(post),
|
||||
onAddToCollection:
|
||||
onAddToCollection == null ? null : () => onAddToCollection!(post),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user