Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Pull Request] Normal updates #4

Merged
merged 3 commits into from
Aug 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,37 +18,30 @@ void downloadFile(String url) {
void beginDownload(BuildContext context, String id) {
Get.back();

var latestVersion = 'v3.23.04.6488';

var baseUrl = 'https://source.catrol.cn/download/apps/kitx';

if (id.contains('.pubxml')) id = id.replaceAll('.pubxml', '');

var url = '$baseUrl/desktop/$latestVersion/kitx-$id.7z';

var canDownload = false;
var fileName = 'kitx-$id.7z';

if (id.startsWith('win')) {
url = url.replaceAll('desktop', 'win');
canDownload = true;
if (id.endsWith('apk')) {
fileName = id;
}

if (id.startsWith('osx')) {
url = url.replaceAll('desktop', 'osx');
canDownload = true;
}
var url = '';

if (id.startsWith('linux')) {
url = url.replaceAll('desktop', 'linux');
canDownload = true;
switch (downloadSource.value) {
case 'GitHub':
url = 'https://github.com/Crequency/KitX/releases/latest/download/$fileName';
break;
case 'Gitee':
// ToDo: Add Gitee download source
break;
case 'Crequency':
var source = 'https://dl.catrol.cn/kitx';
url = '$source/latest/$fileName';
break;
}

if (id.endsWith('apk')) {
url = '$baseUrl/android/$latestVersion/$id';
canDownload = true;
}

if (canDownload) downloadFile(url);
downloadFile(url);
}

void showItemsDialog(BuildContext context, List<Widget> items) {
Expand Down Expand Up @@ -280,10 +273,12 @@ Widget getDownloadList(BuildContext context) {
child: const Text('GitHub'),
value: 'GitHub',
),
const DropdownMenuItem(
child: const Text('Gitee'),
value: 'Gitee',
),
// ToDo: Add Gitee download source

// const DropdownMenuItem(
// child: const Text('Gitee'),
// value: 'Gitee',
// ),
const DropdownMenuItem(
child: const Text('Crequency'),
value: 'Crequency',
Expand Down
13 changes: 9 additions & 4 deletions KitX Website Flutter/kitx_website/lib/pages/controls/drawer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ import 'package:kitx_website/utils/open_link.dart';
class AppDrawer extends StatelessWidget {
final pageOpenDelay = 200;

void navigateTo(int pageNumber) {
Get.back();
app.navPageTo(pageNumber);
}

@override
Widget build(BuildContext context) {
return Drawer(
Expand All @@ -17,12 +22,12 @@ class AppDrawer extends StatelessWidget {
ListTile(
leading: const Icon(Icons.home),
title: Text('Home_Page'.tr),
onTap: () => app.navPageTo(0),
onTap: () => navigateTo(0),
),
ListTile(
leading: const Icon(CommunityMaterialIcons.cube),
title: Text('Plugins_Page'.tr),
onTap: () => app.navPageTo(1),
onTap: () => navigateTo(1),
),
// ListTile(
// leading: const Icon(CommunityMaterialIcons.file_document),
Expand All @@ -32,12 +37,12 @@ class AppDrawer extends StatelessWidget {
ListTile(
leading: const Icon(Icons.timeline),
title: Text('Milestones_Page'.tr),
onTap: () => app.navPageTo(2),
onTap: () => navigateTo(2),
),
ListTile(
leading: const Icon(Icons.settings),
title: Text('Settings_Page'.tr),
onTap: () => app.navPageTo(3),
onTap: () => navigateTo(3),
),
Divider(),
ListTile(
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@

Current repo is codes for KitX Website, main KitX repo is [KitX Main Repo](https://github.com/Crequency/KitX)

Visit KitX Website at https://kitx.apps.catrol.cn
Visit KitX Website at https://kitx.apps.crequency.com

> Note: If you live in China mainland, you may need to visit https://kitx.apps.catrol.cn instead

## Develop

We use flutter for website frontend.

You can visit https://kitx-website.pages.dev to preview the developing website
Loading