feat: add browser extension link (#433)

This commit is contained in:
Levi authored and GitHub committed 2024-03-30 09:12:24 +08:00
1 parent 56ef25065e
commit 207c287c97
10 files changed
+157 -95

No files matched your search

@@ -15,6 +15,7 @@ import '../../../../util/package_info.dart';
import '../../../../util/util.dart';
import '../../../views/check_list_view.dart';
import '../../../views/directory_selector.dart';
import '../../../views/open_in_new.dart';
import '../../../views/outlined_button_loading.dart';
import '../../app/controllers/app_controller.dart';
import '../controllers/setting_controller.dart';
@@ -93,6 +94,15 @@ class SettingView extends GetView<SettingController> {
],
);
});
buildBrowserExtension() {
return ListTile(
title: Text('browserExtension'.tr),
subtitle: const OpenInNew(
text: "Chrome",
url:
"https://chromewebstore.google.com/detail/gopeed/mijpgljlfcapndmchhjffkpckknofcnd",
));
}
// http config items start
final httpConfig = downloaderCfg.value.protocolConfig.http;
@@ -687,8 +697,11 @@ class SettingView extends GetView<SettingController> {
Text('general'.tr),
Card(
child: Column(
children: _addDivider(
[buildDownloadDir(), buildMaxRunning()]),
children: _addDivider([
buildDownloadDir(),
buildMaxRunning(),
buildBrowserExtension()
]),
)),
const Text('HTTP'),
Card(
+39
View File
@@ -0,0 +1,39 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:url_launcher/url_launcher.dart';
class OpenInNew extends StatelessWidget {
final String text;
final String url;
const OpenInNew({super.key, required this.text, required this.url});
@override
Widget build(BuildContext context) {
return Stack(
children: [
ElevatedButton(
onPressed: () {
launchUrl(Uri.parse(url), mode: LaunchMode.externalApplication);
},
style: ElevatedButton.styleFrom(
backgroundColor: Get.theme.colorScheme.background,
),
child: Row(
mainAxisSize: MainAxisSize
.min, // Set the row's size to be as small as possible
children: <Widget>[
Text(text),
const SizedBox(
width: 4), // Add some space between the text and the icon
const Icon(
Icons.open_in_new,
size: 14,
), // The icon is after the text
],
),
)
],
);
}
}