feat: open browser when clicking on changelog link

This commit is contained in:
Aunali321 2024-04-16 20:00:46 +05:30
parent 5e6cc86c7e
commit bc300d81d9
2 changed files with 31 additions and 23 deletions

View file

@ -26,7 +26,8 @@
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher" android:icon="@mipmap/ic_launcher"
android:largeHeap="true" android:largeHeap="true"
android:requestLegacyExternalStorage="true"> android:requestLegacyExternalStorage="true"
android:enableOnBackInvokedCallback="true">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"
android:exported="true" android:exported="true"

View file

@ -3,6 +3,7 @@ import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:revanced_manager/app/app.locator.dart'; import 'package:revanced_manager/app/app.locator.dart';
import 'package:revanced_manager/gen/strings.g.dart'; import 'package:revanced_manager/gen/strings.g.dart';
import 'package:revanced_manager/ui/views/home/home_viewmodel.dart'; import 'package:revanced_manager/ui/views/home/home_viewmodel.dart';
import 'package:url_launcher/url_launcher.dart';
class UpdateConfirmationSheet extends StatelessWidget { class UpdateConfirmationSheet extends StatelessWidget {
const UpdateConfirmationSheet({ const UpdateConfirmationSheet({
@ -55,15 +56,15 @@ class UpdateConfirmationSheet extends StatelessWidget {
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
isPatches isPatches
? t.homeView.updatePatchesSheetTitle ? t.homeView.updatePatchesSheetTitle
: t.homeView.updateSheetTitle, : t.homeView.updateSheetTitle,
style: const TextStyle( style: const TextStyle(
fontSize: 24, fontSize: 24,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
),
), ),
),
const SizedBox(height: 4.0), const SizedBox(height: 4.0),
Row( Row(
children: [ children: [
@ -96,7 +97,7 @@ class UpdateConfirmationSheet extends StatelessWidget {
? model.updatePatches(context) ? model.updatePatches(context)
: model.updateManager(context); : model.updateManager(context);
}, },
child: Text(t.updateButton), child: Text(t.updateButton),
), ),
], ],
), ),
@ -110,31 +111,37 @@ class UpdateConfirmationSheet extends StatelessWidget {
child: Text( child: Text(
t.homeView.updateChangelogTitle, t.homeView.updateChangelogTitle,
style: TextStyle( style: TextStyle(
fontSize: changelog ? 24 : 20, fontSize: changelog ? 24 : 20,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: color:
Theme.of(context).colorScheme.onSecondaryContainer, Theme.of(context).colorScheme.onSecondaryContainer,
),
), ),
), ),
Container( ),
margin: const EdgeInsets.symmetric(horizontal: 24.0), Container(
decoration: BoxDecoration( margin: const EdgeInsets.symmetric(horizontal: 24.0),
color: Theme.of(context).colorScheme.secondaryContainer, decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12.0), color: Theme.of(context).colorScheme.secondaryContainer,
), borderRadius: BorderRadius.circular(12.0),
child: Markdown( ),
child: Markdown(
styleSheet: MarkdownStyleSheet( styleSheet: MarkdownStyleSheet(
a: TextStyle( a: TextStyle(
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
), ),
shrinkWrap: true, onTapLink: (text, href, title) => href != null
physics: const NeverScrollableScrollPhysics(), ? launchUrl(
padding: const EdgeInsets.all(20.0), Uri.parse(href),
data: snapshot.data!['body'] ?? '', mode: LaunchMode.externalApplication,
), )
: null,
shrinkWrap: true,
physics: const NeverScrollableScrollPhysics(),
padding: const EdgeInsets.all(20.0),
data: snapshot.data!['body'] ?? '',
), ),
),
], ],
); );
}, },