Enable long-press and double-tap gestures on app icon in apps list (#2444, #2448)

This commit is contained in:
Imran Remtulla
2025-09-21 13:37:57 -04:00
parent 7bc818fbfa
commit 04633131e7
2 changed files with 62 additions and 35 deletions

View File

@@ -16,9 +16,14 @@ import 'package:provider/provider.dart';
import 'package:markdown/markdown.dart' as md;
class AppPage extends StatefulWidget {
const AppPage({super.key, required this.appId});
const AppPage({
super.key,
required this.appId,
this.showOppositeOfPreferredView = false,
});
final String appId;
final bool showOppositeOfPreferredView;
@override
State<AppPage> createState() => _AppPageState();
@@ -60,6 +65,11 @@ class _AppPageState extends State<AppPage> {
Widget build(BuildContext context) {
var appsProvider = context.watch<AppsProvider>();
var settingsProvider = context.watch<SettingsProvider>();
var showAppWebpageFinal =
(settingsProvider.showAppWebpage &&
!widget.showOppositeOfPreferredView) ||
(!settingsProvider.showAppWebpage &&
widget.showOppositeOfPreferredView);
getUpdate(String id, {bool resetVersion = false}) async {
try {
setState(() {
@@ -565,7 +575,7 @@ class _AppPageState extends State<AppPage> {
icon: const Icon(Icons.settings),
tooltip: tr('settings'),
),
if (app != null && settingsProvider.showAppWebpage)
if (app != null && showAppWebpageFinal)
IconButton(
onPressed: () {
showDialog(
@@ -661,10 +671,10 @@ class _AppPageState extends State<AppPage> {
);
return Scaffold(
appBar: settingsProvider.showAppWebpage ? AppBar() : appScreenAppBar(),
appBar: showAppWebpageFinal ? AppBar() : appScreenAppBar(),
backgroundColor: Theme.of(context).colorScheme.surface,
body: RefreshIndicator(
child: settingsProvider.showAppWebpage
child: showAppWebpageFinal
? getAppWebView()
: CustomScrollView(
slivers: [

View File

@@ -451,7 +451,8 @@ class AppsPageState extends State<AppsPage> {
}
getAppIcon(int appIndex) {
return FutureBuilder(
return GestureDetector(
child: FutureBuilder(
future: appsProvider.updateAppIcon(listedApps[appIndex].app.id),
builder: (ctx, val) {
return listedApps[appIndex].icon != null
@@ -475,7 +476,8 @@ class AppsPageState extends State<AppsPage> {
image: const AssetImage(
'assets/graphics/icon_small.png',
),
color: Theme.of(context).brightness == Brightness.dark
color:
Theme.of(context).brightness == Brightness.dark
? Colors.white.withOpacity(0.4)
: Colors.white.withOpacity(0.3),
colorBlendMode: BlendMode.modulate,
@@ -486,6 +488,21 @@ class AppsPageState extends State<AppsPage> {
],
);
},
),
onDoubleTap: () {
pm.openApp(listedApps[appIndex].app.id);
},
onLongPress: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AppPage(
appId: listedApps[appIndex].app.id,
showOppositeOfPreferredView: true,
),
),
);
},
);
}