diff --git a/lib/pages/app.dart b/lib/pages/app.dart index f67884e..a50ba70 100644 --- a/lib/pages/app.dart +++ b/lib/pages/app.dart @@ -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 createState() => _AppPageState(); @@ -60,6 +65,11 @@ class _AppPageState extends State { Widget build(BuildContext context) { var appsProvider = context.watch(); var settingsProvider = context.watch(); + 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 { 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 { ); 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: [ diff --git a/lib/pages/apps.dart b/lib/pages/apps.dart index 3cbf7e6..71e9a73 100644 --- a/lib/pages/apps.dart +++ b/lib/pages/apps.dart @@ -451,40 +451,57 @@ class AppsPageState extends State { } getAppIcon(int appIndex) { - return FutureBuilder( - future: appsProvider.updateAppIcon(listedApps[appIndex].app.id), - builder: (ctx, val) { - return listedApps[appIndex].icon != null - ? Image.memory( - listedApps[appIndex].icon!, - gaplessPlayback: true, - opacity: AlwaysStoppedAnimation( - listedApps[appIndex].installedInfo == null ? 0.6 : 1, - ), - ) - : Row( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Transform( - alignment: Alignment.center, - transform: Matrix4.rotationZ(0.31), - child: Padding( - padding: const EdgeInsets.all(15), - child: Image( - image: const AssetImage( - 'assets/graphics/icon_small.png', + return GestureDetector( + child: FutureBuilder( + future: appsProvider.updateAppIcon(listedApps[appIndex].app.id), + builder: (ctx, val) { + return listedApps[appIndex].icon != null + ? Image.memory( + listedApps[appIndex].icon!, + gaplessPlayback: true, + opacity: AlwaysStoppedAnimation( + listedApps[appIndex].installedInfo == null ? 0.6 : 1, + ), + ) + : Row( + mainAxisSize: MainAxisSize.min, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Transform( + alignment: Alignment.center, + transform: Matrix4.rotationZ(0.31), + child: Padding( + padding: const EdgeInsets.all(15), + child: Image( + image: const AssetImage( + 'assets/graphics/icon_small.png', + ), + color: + Theme.of(context).brightness == Brightness.dark + ? Colors.white.withOpacity(0.4) + : Colors.white.withOpacity(0.3), + colorBlendMode: BlendMode.modulate, + gaplessPlayback: true, ), - color: Theme.of(context).brightness == Brightness.dark - ? Colors.white.withOpacity(0.4) - : Colors.white.withOpacity(0.3), - colorBlendMode: BlendMode.modulate, - gaplessPlayback: true, ), ), - ), - ], - ); + ], + ); + }, + ), + onDoubleTap: () { + pm.openApp(listedApps[appIndex].app.id); + }, + onLongPress: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => AppPage( + appId: listedApps[appIndex].app.id, + showOppositeOfPreferredView: true, + ), + ), + ); }, ); }