Compare commits

..

1 Commits

Author SHA1 Message Date
3413b1686d fix: double tap instead of long press to open url. (#478) 2024-09-20 00:45:35 -07:00
5 changed files with 55 additions and 19 deletions

View File

@ -110,11 +110,11 @@ final class SwipeGesturePreference extends BooleanPreference {
String get key => 'swipeGestureMode';
@override
String get title => 'Swipe Gesture';
String get title => 'Swipe Gesture for Switching Tabs';
@override
String get subtitle =>
'''enable swipe gesture for switching between tabs. If enabled, long press on Story tile to trigger the action menu.''';
'''enable swipe gesture for switching between tabs. If enabled, long press on Story tile to trigger the action menu and double tap to open the url (if complex tile is disabled).''';
}
final class NotificationModePreference extends BooleanPreference {

View File

@ -82,6 +82,13 @@ class ItemsListView<T extends Item> extends StatelessWidget {
FadeIn(
child: InkWell(
onTap: () => onTap(e),
/// If swipe gesture is enabled on home screen, use
/// long press instead of slide action to trigger
/// the action menu.
onLongPress: swipeGestureEnabled
? () => onMoreTapped?.call(e, context.rect)
: null,
child: Padding(
padding: const EdgeInsets.only(
top: Dimens.pt8,

View File

@ -123,9 +123,12 @@ class LinkView extends StatelessWidget {
),
),
)
: CachedNetworkImage(
imageUrl: imageUri ?? Constants.favicon(url),
fit: isIcon ? BoxFit.scaleDown : BoxFit.fitWidth,
: () {
if (imageUri?.isNotEmpty ?? false) {
return CachedNetworkImage(
imageUrl: imageUri!,
fit:
isIcon ? BoxFit.scaleDown : BoxFit.fitWidth,
cacheKey: imageUri,
errorWidget: (_, __, ___) {
if (url.isEmpty) {
@ -153,7 +156,33 @@ class LinkView extends StatelessWidget {
),
);
},
);
} else if (url.isNotEmpty) {
return Center(
child: CachedNetworkImage(
imageUrl: Constants.favicon(url),
fit: BoxFit.scaleDown,
cacheKey: iconUri,
errorWidget: (_, __, ___) {
return const FadeIn(
child: Icon(
Icons.public,
size: Dimens.pt20,
),
);
},
),
);
} else {
return FadeIn(
child: Center(
child: _HackerNewsImage(
height: layoutHeight,
),
),
);
}
}(),
),
),
)

View File

@ -128,7 +128,7 @@ class StoryTile extends StatelessWidget {
excludeSemantics: true,
child: InkWell(
onTap: onTap,
onLongPress: () {
onDoubleTap: () {
if (story.url.isNotEmpty) {
LinkUtil.launch(
story.url,

View File

@ -1,6 +1,6 @@
name: hacki
description: A Hacker News reader.
version: 2.9.2+150
version: 2.9.3+151
publish_to: none
environment: