Refactor project in get-cli standard (#80)

* refactor project in get-cli standard

* use local trackers when github is not connectable
upgrade stylish_bottom_bar to 1.0.0
responsive view for home_view
treeview for file_list_vie
fluent ui integrating

* improve responsive view.
treeView add light theme.fix overflow bugs

* responsive view,treeView,file select
downloaded and downloading pages
file extension icons
fix some minor bugs

* use local trackers when github is not connectable
upgrade stylish_bottom_bar to 1.0.0
responsive view for home_view
treeview for file_list_vie
fluent ui integrating

* improve responsive view.
treeView add light theme.fix overflow bugs

* bottom bar index fix

* refactor project in get-cli standard

---------

Co-authored-by: wuke2022 <[email protected]>
This commit is contained in:
Neginegiandwuke2022 authored and GitHub committed 2023-02-19 20:06:28 +08:00
1 parent 9b1ed15fea
commit 74c24ad860
44 files changed
+1025 -360

No files matched your search

+1
View File
@@ -0,0 +1 @@
C:/Users/huget/fvm/versions/3.7.0
+4
View File
@@ -0,0 +1,4 @@
{
"flutterSdkVersion": "3.7.0",
"flavors": {}
}
-5
View File
@@ -1,5 +0,0 @@
Don't forget to run`dart format .`before you commit to keep your code in standard dart format
+53
View File
@@ -0,0 +1,53 @@
{
"label": "English",
"error": "Error",
"tip": "Tip",
"confirm": "Confirm",
"cancel": "Cancel",
"selectAll": "Select All",
"task": "Task",
"downloading": "downloading",
"downloaded": "downloaded",
"setting": "Setting",
"create": "Create Task",
"downloadLink": "Download Link",
"downloadLinkValid": "Please enter the download link",
"downloadLinkHit": "Please enter the download link, HTTP/HTTPS/MAGNET supported@append",
"downloadLinkHitDesktop": ", or drag the torrent file here directly",
"download": "Download",
"noStoragePermission": "Storage permission required",
"selectFile": "Select File",
"basic": "Basic",
"advanced": "Advanced",
"general": "General",
"downloadDir": "Download Directory",
"downloadDirValid": "Please select the download directory",
"connections": "Connections",
"items": "@count items",
"subscribeTracker": "Subscribe Tracker",
"subscribeFail": "Subscribe failed, please check network or try again later",
"update": "Update",
"updateDaily": "Update daily",
"lastUpdate": "Last update: @time",
"addTracker": "Add Tracker",
"addTrackerHit": "Please enter the tracker server url, one per line",
"ui": "UI",
"theme": "Theme",
"themeSystem": "System",
"themeLight": "Light",
"themeDark": "Dark",
"locale": "Language",
"about": "About",
"homepage": "Homepage",
"version": "Version",
"protocol": "Protocol",
"port": "Port",
"apiToken": "API Token",
"notSet": "NS",
"set": "SET",
"effectAfterRestart": "Effect after restart",
"deleteTask": "Delete Task",
"deleteTaskTip": "Keep downloaded files",
"delete": "Delete"
}
+53
View File
@@ -0,0 +1,53 @@
{
"label": "فارسی",
"error": "اررور",
"tip": "Tip",
"confirm": "تایید",
"cancel": "انصراف",
"selectAll": "انتخاب همه",
"task": "کار",
"downloading": "downloading",
"downloaded": "downloaded",
"setting": "تنظیمات",
"title": "ایجاد کار",
"downloadLink": "لینک دانلود",
"downloadLinkValid": "لطفا لینک دانلود را وارد کنید",
"downloadLinkHit": "Please enter the download link, HTTP/HTTPS/MAGNET supported@append",
"downloadLinkHitDesktop": ", or drag the torrent file here directly",
"download": "دانلود",
"noStoragePermission": "مجوز ذخیره سازی مورد نیاز است",
"selectFile": "انتخاب فایل",
"basic": "پایه",
"advanced": "پیشرفته",
"general": "عمومی",
"downloadDir": "دایرکتوری دانلود",
"downloadDirValid": "لطفا دایرکتوری دانلود را انتخاب کنید",
"connections": "اتصالات",
"items": "@count آیتم ها",
"subscribeTracker": "Subscribe Tracker",
"subscribeFail": "Subscribe failed, please check network or try again later",
"update": "بروزرسانی",
"updateDaily": "بروزرسانی روزانه",
"lastUpdate": "Last update: @time",
"addTracker": "Add Tracker",
"addTrackerHit": "Please enter the tracker server url, one per line",
"ui": "رابط کاربری",
"theme": "پوسته",
"themeSystem": "سیستم",
"themeLight": "روشن",
"themeDark": "تاریک",
"locale": "Language",
"about": "درباره ی",
"homepage": "صفحه اصلی",
"version": "نسخه",
"protocol": "پروتکل",
"port": "پورت",
"apiToken": "API توکن",
"notSet": "NS",
"set": "SET",
"effectAfterRestart": "Effect after restart",
"deleteTask": "پاک کردن کار",
"deleteTaskTip": "فایل های دانلود شده را نگه دارد",
"delete": "پاک کردن"
}
+52
View File
@@ -0,0 +1,52 @@
{
"label": "Русский(Россия)",
"error": "Ошибка",
"tip": "Подсказка",
"confirm": "Подтвердить",
"cancel": "Отмена",
"selectAll": "Выбрать все",
"task": "Задачи",
"downloading": "downloading",
"downloaded": "downloaded",
"setting": "Настройки",
"title": "Создать задачу",
"downloadLink": "Ссылка для скачивание",
"downloadLinkValid": "Пожалуйста, введите ссылку для скачивания",
"downloadLinkHit": "Пожалуйста, введите ссылку для скачивания, HTTP/HTTPS/MAGNET supported@append",
"downloadLinkHitDesktop": ", или перетащите сюда торрент-файл",
"download": "Скачать",
"noStoragePermission": "Требуется доступ к хранилищу",
"selectFile": "Выберать файл",
"basic": "Основные параметры",
"advanced": "Расширенные",
"general": "Общие",
"downloadDir": "Папка загрузки",
"downloadDirValid": "Пожалуйста, выберите папку для загрузки",
"connections": "Соединений",
"items": "@подсчет элементов",
"subscribeTracker": "Подпись трекера",
"subscribeFail": "Подписка не удалась, пожалуйста, проверьте сеть или повторите попытку позже",
"update": "Обновить",
"updateDaily": "Обновлять ежедневно",
"lastUpdate": "Последнее обновление: @время",
"addTracker": "Добавить трекер",
"addTrackerHit": "Пожалуйста, введите url трекера, по одному в строке",
"ui": "UI",
"theme": "Тема",
"themeSystem": "Системная",
"themeLight": "Светлая",
"themeDark": "Темная",
"locale": "Язык",
"about": "О приложении",
"homepage": "Домашняя страница",
"version": "Версия",
"protocol": "Протокол",
"port": "Порт",
"apiToken": "API Токен",
"notSet": "Не установлено",
"set": "Установлено",
"effectAfterRestart": "Эффект после перезагрузки",
"deleteTask": "Удалить задачу",
"deleteTaskTip": "Сохранить загруженные файлы",
"delete": "Удалить"
}
+52
View File
@@ -0,0 +1,52 @@
{
"label": "中文(简体)",
"error": "错误",
"tip": "提示",
"confirm": "确认",
"cancel": "取消",
"selectAll": "全选",
"task": "任务",
"downloading": "下载中",
"downloaded": "已完成",
"setting": "设置",
"title": "创建任务",
"downloadLink": "下载链接",
"downloadLinkValid": "请输入下载链接",
"downloadLinkHit": "请输入下载链接,支持 HTTP/HTTPS/MAGNET@append",
"downloadLinkHitDesktop": ",也可以直接拖拽种子文件到此处",
"download": "下载",
"noStoragePermission": "需要开启存储权限",
"selectFile": "选择文件",
"basic": "基础",
"advanced": "高级",
"general": "通用",
"downloadDir": "下载目录",
"downloadDirValid": "请选择下载目录",
"connections": "连接数",
"items": "@count 条",
"subscribeTracker": "订阅 Tracker",
"subscribeFail": "订阅失败,请检查网络或稍后重试",
"update": "更新",
"updateDaily": "每天自动更新",
"lastUpdate": "上次更新:@time",
"addTracker": "添加 Tracker",
"addTrackerHit": "请输入 tracker 服务器地址,每行一条",
"ui": "界面",
"theme": "主题",
"themeSystem": "跟随系统",
"themeLight": "明亮主题",
"themeDark": "暗黑主题",
"locale": "语言",
"about": "关于",
"homepage": "主页",
"version": "版本",
"protocol": "通讯协议",
"port": "端口",
"apiToken": "接口令牌",
"notSet": "未设置",
"set": "已设置",
"effectAfterRestart": "此配置项将在重启应用后生效",
"deleteTask": "删除任务",
"deleteTaskTip": "保留已下载的文件",
"delete": "删除"
}
@@ -0,0 +1,8 @@
import 'package:get/get.dart';
class ApiProvider extends GetConnect {
@override
void onInit() {
httpClient.baseUrl = 'YOUR-API-URL';
}
}
@@ -0,0 +1,12 @@
import 'package:get/get.dart';
import '../controllers/app_controller.dart';
class AppBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut<AppController>(
() => AppController(),
);
}
}
@@ -6,12 +6,12 @@ import 'package:get/get.dart';
import 'package:path_provider/path_provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../api/api.dart';
import '../../api/model/downloader_config.dart';
import '../../core/common/start_config.dart';
import '../../i18n/messages.dart';
import '../../util/log_util.dart';
import '../../util/util.dart';
import '../../../../api/api.dart';
import '../../../../api/model/downloader_config.dart';
import '../../../../core/common/start_config.dart';
import '../../../../i18n/messages.dart';
import '../../../../util/log_util.dart';
import '../../../../util/util.dart';
const _startConfigNetwork = "start.network";
const _startConfigAddress = "start.address";
@@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get/get.dart';
import '../../i18n/messages.dart';
import '../../routes/router.dart';
import '../../theme/theme.dart';
import '../home/home_controller.dart';
import 'app_controller.dart';
import '../../../../generated/locales.g.dart';
import '../../../../i18n/messages.dart';
import '../../../../theme/theme.dart';
import '../../../routes/app_pages.dart';
import '../controllers/app_controller.dart';
class AppView extends GetView<AppController> {
const AppView({Key? key}) : super(key: key);
@@ -15,15 +15,13 @@ class AppView extends GetView<AppController> {
Widget build(BuildContext context) {
final config = controller.downloaderConfig.value;
return GetMaterialApp.router(
initialBinding: BindingsBuilder(() {
Get.lazyPut<HomeController>(() => HomeController(), fenix: true);
}),
useInheritedMediaQuery: true,
debugShowCheckedModeBanner: false,
theme: GopeedTheme.light,
darkTheme: GopeedTheme.dark,
themeMode: ThemeMode.values.byName(config.extra.themeMode),
translations: messages,
// translations: messages,
translationsKeys: AppTranslation.translations,
locale: toLocale(config.extra.locale),
fallbackLocale: fallbackLocale,
localizationsDelegates: const [
@@ -32,7 +30,7 @@ class AppView extends GetView<AppController> {
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: messages.keys.keys.map((e) => toLocale(e)).toList(),
getPages: Routes.routes,
getPages: AppPages.routes,
);
}
}
@@ -0,0 +1,12 @@
import 'package:get/get.dart';
import '../controllers/create_controller.dart';
class CreateBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut<CreateController>(
() => CreateController(),
);
}
}
@@ -4,16 +4,16 @@ import 'package:get/get.dart';
import 'package:gopeed/api/model/resolve_result.dart';
import 'package:rounded_loading_button/rounded_loading_button.dart';
import '../../api/api.dart';
import '../../api/model/create_task.dart';
import '../../api/model/options.dart';
import '../../api/model/request.dart';
import '../../routes/router.dart';
import '../../util/util.dart';
import '../../widget/directory_selector.dart';
import '../../widget/file_list_view.dart';
import '../app/app_controller.dart';
import 'create_controller.dart';
import '../../../../api/api.dart';
import '../../../../api/model/create_task.dart';
import '../../../../api/model/options.dart';
import '../../../../api/model/request.dart';
import '../../../../util/util.dart';
import '../../../routes/app_pages.dart';
import '../../../views/views/directory_selector.dart';
import '../../../views/views/file_list_view.dart';
import '../../app/controllers/app_controller.dart';
import '../controllers/create_controller.dart';
class CreateView extends GetView<CreateController> {
final _resolveFormKey = GlobalKey<FormState>();
@@ -29,7 +29,7 @@ class CreateView extends GetView<CreateController> {
appBar: AppBar(
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () => Get.rootDelegate.offNamed(Routes.downloading)),
onPressed: () => Get.rootDelegate.offNamed(Routes.DOWNLOADING)),
// actions: [],
title: Text('create.title'.tr),
),
@@ -185,7 +185,7 @@ class CreateView extends GetView<CreateController> {
selectFiles:
controller.selectedIndexs.cast<int>())));
Get.back();
Get.rootDelegate.offNamed(Routes.downloading);
Get.rootDelegate.offNamed(Routes.DOWNLOADING);
}
} catch (e) {
Get.snackbar('error'.tr, e.toString());
@@ -0,0 +1,12 @@
import 'package:get/get.dart';
import '../controllers/downloaded_controller.dart';
class DownloadedBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut<DownloadedController>(
() => DownloadedController(),
);
}
}
@@ -2,8 +2,8 @@ import 'dart:async';
import 'package:get/get.dart';
import '../../api/api.dart';
import '../../api/model/task.dart';
import '../../../../api/api.dart';
import '../../../../api/model/task.dart';
class DownloadedController extends GetxController {
final tasks = <Task>[].obs;
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:gopeed/widget/buid_task_list_view.dart';
import 'package:gopeed/app/views/views/buid_task_list_view.dart';
import 'downloaded_controller.dart';
import '../controllers/downloaded_controller.dart';
class DownloadedView extends GetView<DownloadedController> {
const DownloadedView({Key? key}) : super(key: key);
@@ -0,0 +1,12 @@
import 'package:get/get.dart';
import '../controllers/downloading_controller.dart';
class DownloadingBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut<DownloadingController>(
() => DownloadingController(),
);
}
}
@@ -2,8 +2,8 @@ import 'dart:async';
import 'package:get/get.dart';
import '../../api/api.dart';
import '../../api/model/task.dart';
import '../../../../api/api.dart';
import '../../../../api/model/task.dart';
class DownloadingController extends GetxController {
final tasks = <Task>[].obs;
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../widget/buid_task_list_view.dart';
import 'downloading_controller.dart';
import '../../../views/views/buid_task_list_view.dart';
import '../controllers/downloading_controller.dart';
class DownloadingView extends GetView<DownloadingController> {
const DownloadingView({Key? key}) : super(key: key);
@@ -0,0 +1,13 @@
import 'package:get/get.dart';
import '../controllers/home_controller.dart';
class HomeBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut<HomeController>(
() => HomeController(),
fenix: true,
);
}
}
@@ -0,0 +1,124 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:stylish_bottom_bar/model/bar_items.dart';
import 'package:stylish_bottom_bar/stylish_bottom_bar.dart';
import '../../../routes/app_pages.dart';
import '../../../views/views/responsive_builder.dart';
import '../controllers/home_controller.dart';
class HomeView extends GetView<HomeController> {
const HomeView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return GetRouterOutlet.builder(builder: (context, delegate, currentRoute) {
return Scaffold(
extendBody: true,
body: Row(
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
!ResponsiveBuilder.isNarrow(context)
? NavigationRail(
extended: true,
labelType: NavigationRailLabelType.none,
minExtendedWidth: 140,
groupAlignment: 0,
// useIndicator: false,
onDestinationSelected: (int index) {
switch (index) {
case 0:
delegate.toNamed(Routes.DOWNLOADING);
controller.currentIndex.value = 0;
break;
case 1:
delegate.toNamed(Routes.DOWNLOADED);
controller.currentIndex.value = 1;
break;
case 2:
delegate.toNamed(Routes.SETTING);
controller.currentIndex.value = 2;
break;
}
},
destinations: [
NavigationRailDestination(
icon: const Icon(Icons.format_align_left_outlined),
selectedIcon:
const Icon(Icons.format_align_left_outlined),
label: Text('downloading'.tr),
),
NavigationRailDestination(
icon: const Icon(Icons.format_align_justify_outlined),
selectedIcon:
const Icon(Icons.format_align_justify_outlined),
label: Text('downloaded'.tr),
),
NavigationRailDestination(
icon: const Icon(Icons.settings),
selectedIcon: const Icon(Icons.settings),
label: Text('setting'.tr),
),
],
selectedIndex: controller.currentIndex.value,
leading: const Icon(Icons.logo_dev),
// trailing: const Icon(Icons.info_outline),
)
: const SizedBox.shrink(),
Expanded(
child: GetRouterOutlet(
initialRoute: Routes.DOWNLOADING,
// anchorRoute: '/',
// filterPages: (afterAnchor) {
// logger.w(afterAnchor);
// logger.w(afterAnchor.take(1));
// return afterAnchor.take(1);
// },
))
]),
bottomNavigationBar: ResponsiveBuilder.isNarrow(context)
? StylishBottomBar(
option: AnimatedBarOptions(
iconSize: 32,
barAnimation: BarAnimation.blink,
iconStyle: IconStyle.Default,
opacity: 0.3,
),
items: [
BottomBarItem(
icon: const Icon(Icons.format_align_left_outlined),
selectedColor: Get.theme.primaryColor,
title: Text('downloading'.tr)),
BottomBarItem(
icon: const Icon(Icons.format_align_justify_outlined),
selectedColor: Get.theme.primaryColor,
title: Text('downloaded'.tr)),
BottomBarItem(
icon: const Icon(Icons.settings),
selectedColor: Get.theme.primaryColor,
title: Text('setting'.tr)),
],
// hasNotch: true,
currentIndex: controller.currentIndex.value,
onTap: (index) {
switch (index) {
case 0:
delegate.toNamed(Routes.DOWNLOADING);
controller.currentIndex.value = 0;
break;
case 1:
delegate.toNamed(Routes.DOWNLOADED);
controller.currentIndex.value = 1;
break;
case 2:
delegate.toNamed(Routes.SETTING);
controller.currentIndex.value = 2;
break;
}
},
)
: const SizedBox.shrink(),
);
});
}
}
@@ -0,0 +1,10 @@
import 'package:get/get.dart';
import '../controllers/root_controller.dart';
class RootBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut<RootController>(() => RootController(), fenix: true);
}
}
@@ -1,4 +1,3 @@
import 'package:get/get.dart';
import '../../api/api.dart';
class RootController extends GetxController {}
@@ -1,8 +1,8 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../routes/router.dart';
import 'root_controller.dart';
import '../../../routes/app_pages.dart';
import '../controllers/root_controller.dart';
class RootView extends GetView<RootController> {
const RootView({Key? key}) : super(key: key);
@@ -12,7 +12,7 @@ class RootView extends GetView<RootController> {
return GetRouterOutlet.builder(
builder: (context, delegate, current) {
return GetRouterOutlet(
initialRoute: Routes.home,
initialRoute: Routes.HOME,
// anchorRoute: '/',
// filterPages: (afterAnchor) {
// return afterAnchor.take(1);
@@ -0,0 +1,12 @@
import 'package:get/get.dart';
import '../controllers/setting_controller.dart';
class SettingBinding extends Bindings {
@override
void dependencies() {
Get.lazyPut<SettingController>(
() => SettingController(),
);
}
}
@@ -7,14 +7,14 @@ import 'package:get/get.dart';
import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../i18n/messages.dart';
import '../../util/package_info.dart';
import '../../util/util.dart';
import '../../widget/check_list_view.dart';
import '../../widget/directory_selector.dart';
import '../../widget/outlined_button_loading.dart';
import '../app/app_controller.dart';
import 'setting_controller.dart';
import '../../../../i18n/messages.dart';
import '../../../../util/package_info.dart';
import '../../../../util/util.dart';
import '../../../views/views/check_list_view.dart';
import '../../../views/views/directory_selector.dart';
import '../../../views/views/outlined_button_loading.dart';
import '../../app/controllers/app_controller.dart';
import '../controllers/setting_controller.dart';
const _padding = SizedBox(height: 10);
final _divider = const Divider().paddingOnly(left: 10, right: 10);
@@ -38,7 +38,7 @@ class SettingView extends GetView<SettingController> {
.then(completer.complete)
.onError(completer.completeError);
if (needRestart) {
Get.snackbar('tip'.tr, 'setting.effectAfterRestart'.tr);
Get.snackbar('tip'.tr, 'effectAfterRestart'.tr);
}
});
return completer.future;
@@ -46,8 +46,7 @@ class SettingView extends GetView<SettingController> {
// download basic config items start
final buildDownloadDir = _buildConfigItem(
'setting.downloadDir', () => downloaderCfg.value.downloadDir,
(Key key) {
'downloadDir', () => downloaderCfg.value.downloadDir, (Key key) {
final downloadDirController =
TextEditingController(text: downloaderCfg.value.downloadDir);
downloadDirController.addListener(() async {
@@ -69,8 +68,7 @@ class SettingView extends GetView<SettingController> {
// http config items start
final httpConfig = downloaderCfg.value.protocolConfig.http;
final buildHttpConnections = _buildConfigItem(
'setting.connections'.tr, () => httpConfig.connections.toString(),
(Key key) {
'connections'.tr, () => httpConfig.connections.toString(), (Key key) {
final connectionsController =
TextEditingController(text: httpConfig.connections.toString());
connectionsController.addListener(() async {
@@ -98,8 +96,8 @@ class SettingView extends GetView<SettingController> {
final btExtConfig = downloaderCfg.value.extra.bt;
final buildBtTrackerSubscribeUrls = _buildConfigItem(
'setting.subscribeTracker'.tr,
() => 'setting.items'.trParams(
'subscribeTracker'.tr,
() => 'items'.trParams(
{'count': btExtConfig.trackerSubscribeUrls.length.toString()}),
(Key key) {
final trackerUpdateController = OutlinedButtonLoadingController();
@@ -127,24 +125,24 @@ class SettingView extends GetView<SettingController> {
try {
await appController.trackerUpdate();
} catch (e) {
Get.snackbar('error'.tr, 'setting.subscribeFail'.tr);
Get.snackbar('error'.tr, 'subscribeFail'.tr);
} finally {
trackerUpdateController.stop();
}
},
controller: trackerUpdateController,
child: Text('setting.update'.tr),
child: Text('update'.tr),
),
Expanded(
child: SwitchListTile(
controlAffinity: ListTileControlAffinity.leading,
value: true,
onChanged: (bool value) {},
title: Text('setting.updateDaily'.tr)),
title: Text('updateDaily'.tr)),
),
],
),
Text('setting.lastUpdate'.trParams({
Text('lastUpdate'.trParams({
'time': btExtConfig.lastTrackerUpdateTime != null
? DateFormat('yyyy-MM-dd HH:mm:ss')
.format(btExtConfig.lastTrackerUpdateTime!)
@@ -154,8 +152,8 @@ class SettingView extends GetView<SettingController> {
);
});
final buildBtTrackers = _buildConfigItem(
'setting.addTracker'.tr,
() => 'setting.items'
'addTracker'.tr,
() => 'items'
.trParams({'count': btExtConfig.customTrackers.length.toString()}),
(Key key) {
final trackersController = TextEditingController(
@@ -168,7 +166,7 @@ class SettingView extends GetView<SettingController> {
keyboardType: TextInputType.multiline,
maxLines: 5,
decoration: InputDecoration(
hintText: 'setting.addTrackerHit'.tr,
hintText: 'addTrackerHit'.tr,
),
onChanged: (value) async {
btExtConfig.customTrackers = ls.convert(value);
@@ -181,7 +179,7 @@ class SettingView extends GetView<SettingController> {
// ui config items start
final buildTheme = _buildConfigItem(
'setting.theme',
'theme',
() => _getThemeName(downloaderCfg.value.extra.themeMode),
(Key key) => DropdownButton<String>(
key: key,
@@ -203,7 +201,7 @@ class SettingView extends GetView<SettingController> {
.toList(),
));
final buildLocale = _buildConfigItem(
'setting.locale',
'locale',
() => messages.keys[downloaderCfg.value.extra.locale]!['label']!,
(Key key) => DropdownButton<String>(
key: key,
@@ -228,7 +226,7 @@ class SettingView extends GetView<SettingController> {
// about config items start
buildHomepage() => ListTile(
title: Text('setting.homepage'.tr),
title: Text('homepage'.tr),
subtitle: const Text('https://github.com/GopeedLab/gopeed'),
onTap: () {
launchUrl(Uri.parse('https://github.com/GopeedLab/gopeed'),
@@ -236,13 +234,13 @@ class SettingView extends GetView<SettingController> {
},
);
buildVersion() => ListTile(
title: Text('setting.version'.tr),
title: Text('version'.tr),
subtitle: Text(packageInfo.version),
);
// advanced config items start
final buildApiProtocol = _buildConfigItem(
'setting.protocol'.tr,
'protocol'.tr,
() => startCfg.value.network == 'tcp'
? 'TCP ${startCfg.value.address}'
: 'Unix',
@@ -320,7 +318,7 @@ class SettingView extends GetView<SettingController> {
child: TextFormField(
controller: portController,
decoration: InputDecoration(
labelText: 'setting.port'.tr,
labelText: 'port'.tr,
contentPadding: const EdgeInsets.all(0.0),
),
keyboardType: TextInputType.number,
@@ -340,11 +338,9 @@ class SettingView extends GetView<SettingController> {
);
},
);
final buildApiToken = _buildConfigItem(
'setting.apiToken'.tr,
() => startCfg.value.apiToken.isEmpty
? 'setting.notSet'.tr
: 'setting.seted'.tr, (Key key) {
final buildApiToken = _buildConfigItem('apiToken'.tr,
() => startCfg.value.apiToken.isEmpty ? 'notSet'.tr : 'seted'.tr,
(Key key) {
final apiTokenController =
TextEditingController(text: startCfg.value.apiToken);
apiTokenController.addListener(() async {
@@ -377,10 +373,10 @@ class SettingView extends GetView<SettingController> {
bottom: TabBar(
tabs: [
Tab(
text: 'setting.basic'.tr,
text: 'basic'.tr,
),
Tab(
text: 'setting.advanced'.tr,
text: 'advanced'.tr,
),
],
),
@@ -391,7 +387,7 @@ class SettingView extends GetView<SettingController> {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: _addPadding([
Text('setting.general'.tr),
Text('general'.tr),
Card(
child: Column(
children: _addDivider([
@@ -413,7 +409,7 @@ class SettingView extends GetView<SettingController> {
buildBtTrackers(),
]),
)),
Text('setting.ui'.tr),
Text('ui'.tr),
Card(
child: Column(
children: _addDivider([
@@ -421,7 +417,7 @@ class SettingView extends GetView<SettingController> {
buildLocale(),
]),
)),
Text('setting.about'.tr),
Text('about'.tr),
Card(
child: Column(
children: _addDivider([
@@ -519,22 +515,22 @@ class SettingView extends GetView<SettingController> {
String _getThemeName(String? themeMode) {
switch (ThemeMode.values.byName(themeMode ?? ThemeMode.system.name)) {
case ThemeMode.light:
return 'setting.themeLight'.tr;
return 'themeLight'.tr;
case ThemeMode.dark:
return 'setting.themeDark'.tr;
return 'themeDark'.tr;
default:
return 'setting.themeSystem'.tr;
return 'themeSystem'.tr;
}
}
}
class _ConfigItem {
late String label;
late String Function() text;
late Widget Function(Key key) inputItem;
_ConfigItem(this.label, this.text, this.inputItem);
}
// class _ConfigItem {
// late String label;
// late String Function() text;
// late Widget Function(Key key) inputItem;
//
// _ConfigItem(this.label, this.text, this.inputItem);
// }
class _NumericalRangeFormatter extends TextInputFormatter {
final int min;
+68
View File
@@ -0,0 +1,68 @@
import 'package:get/get.dart';
import '../modules/create/bindings/create_binding.dart';
import '../modules/create/views/create_view.dart';
import '../modules/downloaded/bindings/downloaded_binding.dart';
import '../modules/downloaded/views/downloaded_view.dart';
import '../modules/downloading/bindings/downloading_binding.dart';
import '../modules/downloading/views/downloading_view.dart';
import '../modules/home/bindings/home_binding.dart';
import '../modules/home/views/home_view.dart';
import '../modules/root/bindings/root_binding.dart';
import '../modules/root/views/root_view.dart';
import '../modules/setting/bindings/setting_binding.dart';
import '../modules/setting/views/setting_view.dart';
part 'app_routes.dart';
class AppPages {
AppPages._();
static const INITIAL = Routes.ROOT;
static final routes = [
GetPage(
name: _Paths.ROOT,
participatesInRootNavigator: true,
transition: Transition.topLevel,
// preventDuplicates: true,
page: () => const RootView(),
binding: RootBinding(),
children: [
GetPage(
name: _Paths.HOME,
// participatesInRootNavigator: true,
// transition: Transition.topLevel,
// preventDuplicates: true,
page: () => const HomeView(),
binding: HomeBinding(),
children: [
GetPage(
name: _Paths.DOWNLOADED,
transition: Transition.noTransition,
page: () => const DownloadedView(),
binding: DownloadedBinding(),
),
GetPage(
name: _Paths.DOWNLOADING,
transition: Transition.noTransition,
page: () => const DownloadingView(),
binding: DownloadingBinding(),
),
GetPage(
name: _Paths.SETTING,
transition: Transition.noTransition,
page: () => const SettingView(),
binding: SettingBinding(),
),
]),
GetPage(
name: _Paths.CREATE,
transition: Transition.downToUp,
// preventDuplicates: true,
page: () => CreateView(),
binding: CreateBinding(),
),
]),
];
}
+22
View File
@@ -0,0 +1,22 @@
part of 'app_pages.dart';
// DO NOT EDIT. This is code generated via package:get_cli/get_cli.dart
abstract class Routes {
Routes._();
static const DOWNLOADED = _Paths.HOME + _Paths.DOWNLOADED;
static const DOWNLOADING = _Paths.HOME + _Paths.DOWNLOADING;
static const CREATE = _Paths.CREATE;
static const ROOT = _Paths.ROOT;
static const SETTING = _Paths.HOME + _Paths.SETTING;
static const HOME = _Paths.HOME;
}
abstract class _Paths {
_Paths._();
static const DOWNLOADED = '/downloaded';
static const DOWNLOADING = '/downloading';
static const CREATE = '/create';
static const ROOT = '/';
static const SETTING = '/setting';
static const HOME = '/home';
}
@@ -4,10 +4,10 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../api/api.dart';
import '../../api/model/task.dart';
import '../../routes/router.dart';
import '../../util/util.dart';
import '../../../api/api.dart';
import '../../../api/model/task.dart';
import '../../../util/util.dart';
import '../../routes/app_pages.dart';
class BuildTaskListView extends GetView {
final List<Task> tasks;
@@ -26,7 +26,7 @@ class BuildTaskListView extends GetView {
icon: const Icon(Icons.add),
tooltip: 'create.title'.tr,
onPressed: () {
Get.rootDelegate.toNamed(Routes.create);
Get.rootDelegate.toNamed(Routes.CREATE);
},
),
//TODO appBar toggleALl/start selected/delete selected/
@@ -2,8 +2,8 @@ import 'package:file_selector/file_selector.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../util/mac_secure_util.dart';
import '../util/util.dart';
import '../../../util/mac_secure_util.dart';
import '../../../util/util.dart';
class DirectorySelector extends StatefulWidget {
final TextEditingController controller;
@@ -28,11 +28,11 @@ class _DirectorySelectorState extends State<DirectorySelector> {
controller: widget.controller,
decoration: widget.showLabel
? InputDecoration(
labelText: 'setting.downloadDir'.tr,
labelText: 'downloadDir'.tr,
)
: null,
validator: (v) {
return v!.trim().isNotEmpty ? null : 'setting.downloadDirValid'.tr;
return v!.trim().isNotEmpty ? null : 'downloadDirValid'.tr;
},
)),
!Util.isDesktop()
@@ -3,10 +3,10 @@ import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:path/path.dart' as path;
import '../pages/app/app_controller.dart';
import '../pages/create/create_controller.dart';
import '../util/file_icon.dart';
import '../util/util.dart';
import '../../../util/file_icon.dart';
import '../../../util/util.dart';
import '../../modules/app/controllers/app_controller.dart';
import '../../modules/create/controllers/create_controller.dart';
class FileListView extends GetView {
FileListView({
@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';
class ResponsiveBuilder extends StatelessWidget {
const ResponsiveBuilder({
required this.narrowBuilder,
required this.mediumBuilder,
required this.wideBuilder,
Key? key,
}) : super(key: key);
final Widget Function(
BuildContext context,
BoxConstraints constraints,
) narrowBuilder;
final Widget Function(
BuildContext context,
BoxConstraints constraints,
) mediumBuilder;
final Widget Function(
BuildContext context,
BoxConstraints constraints,
) wideBuilder;
static bool isNarrow(BuildContext context) =>
MediaQuery.of(context).size.width < 768;
static bool isMedium(BuildContext context) =>
MediaQuery.of(context).size.width < 992 &&
MediaQuery.of(context).size.width >= 768;
static bool isWide(BuildContext context) =>
MediaQuery.of(context).size.width >= 992;
@override
Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
if (constraints.maxWidth >= 992) {
return wideBuilder(context, constraints);
} else if (constraints.maxWidth >= 768) {
return mediumBuilder(context, constraints);
} else {
return narrowBuilder(context, constraints);
}
},
);
}
}
+284
View File
@@ -0,0 +1,284 @@
// DO NOT EDIT. This is code generated via package:get_cli/get_cli.dart
// ignore_for_file: lines_longer_than_80_chars
// ignore: avoid_classes_with_only_static_members
class AppTranslation {
static Map<String, Map<String, String>> translations = {
'en_US': Locales.en_US,
'fa_IR': Locales.fa_IR,
'ru_RU': Locales.ru_RU,
'zh_CN': Locales.zh_CN,
};
}
class LocaleKeys {
LocaleKeys._();
static const label = 'label';
static const error = 'error';
static const tip = 'tip';
static const confirm = 'confirm';
static const cancel = 'cancel';
static const selectAll = 'selectAll';
static const task = 'task';
static const downloading = 'downloading';
static const downloaded = 'downloaded';
static const setting = 'setting';
static const create = 'create';
static const downloadLink = 'downloadLink';
static const downloadLinkValid = 'downloadLinkValid';
static const downloadLinkHit = 'downloadLinkHit';
static const downloadLinkHitDesktop = 'downloadLinkHitDesktop';
static const download = 'download';
static const noStoragePermission = 'noStoragePermission';
static const selectFile = 'selectFile';
static const basic = 'basic';
static const advanced = 'advanced';
static const general = 'general';
static const downloadDir = 'downloadDir';
static const downloadDirValid = 'downloadDirValid';
static const connections = 'connections';
static const items = 'items';
static const subscribeTracker = 'subscribeTracker';
static const subscribeFail = 'subscribeFail';
static const update = 'update';
static const updateDaily = 'updateDaily';
static const lastUpdate = 'lastUpdate';
static const addTracker = 'addTracker';
static const addTrackerHit = 'addTrackerHit';
static const ui = 'ui';
static const theme = 'theme';
static const themeSystem = 'themeSystem';
static const themeLight = 'themeLight';
static const themeDark = 'themeDark';
static const locale = 'locale';
static const about = 'about';
static const homepage = 'homepage';
static const version = 'version';
static const protocol = 'protocol';
static const port = 'port';
static const apiToken = 'apiToken';
static const notSet = 'notSet';
static const set = 'set';
static const effectAfterRestart = 'effectAfterRestart';
static const deleteTask = 'deleteTask';
static const deleteTaskTip = 'deleteTaskTip';
static const delete = 'delete';
static const title = 'title';
}
class Locales {
static const en_US = {
'label': 'English',
'error': 'Error',
'tip': 'Tip',
'confirm': 'Confirm',
'cancel': 'Cancel',
'selectAll': 'Select All',
'task': 'Task',
'downloading': 'downloading',
'downloaded': 'downloaded',
'setting': 'Setting',
'create': 'Create Task',
'downloadLink': 'Download Link',
'downloadLinkValid': 'Please enter the download link',
'downloadLinkHit':
'Please enter the download link, HTTP/HTTPS/MAGNET supported@append',
'downloadLinkHitDesktop': ', or drag the torrent file here directly',
'download': 'Download',
'noStoragePermission': 'Storage permission required',
'selectFile': 'Select File',
'basic': 'Basic',
'advanced': 'Advanced',
'general': 'General',
'downloadDir': 'Download Directory',
'downloadDirValid': 'Please select the download directory',
'connections': 'Connections',
'items': '@count items',
'subscribeTracker': 'Subscribe Tracker',
'subscribeFail':
'Subscribe failed, please check network or try again later',
'update': 'Update',
'updateDaily': 'Update daily',
'lastUpdate': 'Last update: @time',
'addTracker': 'Add Tracker',
'addTrackerHit': 'Please enter the tracker server url, one per line',
'ui': 'UI',
'theme': 'Theme',
'themeSystem': 'System',
'themeLight': 'Light',
'themeDark': 'Dark',
'locale': 'Language',
'about': 'About',
'homepage': 'Homepage',
'version': 'Version',
'protocol': 'Protocol',
'port': 'Port',
'apiToken': 'API Token',
'notSet': 'NS',
'set': 'SET',
'effectAfterRestart': 'Effect after restart',
'deleteTask': 'Delete Task',
'deleteTaskTip': 'Keep downloaded files',
'delete': 'Delete',
};
static const fa_IR = {
'label': 'فارسی',
'error': 'اررور',
'tip': 'Tip',
'confirm': 'تایید',
'cancel': 'انصراف',
'selectAll': 'انتخاب همه',
'task': 'کار',
'downloading': 'downloading',
'downloaded': 'downloaded',
'setting': 'تنظیمات',
'title': 'ایجاد کار',
'downloadLink': 'لینک دانلود',
'downloadLinkValid': 'لطفا لینک دانلود را وارد کنید',
'downloadLinkHit':
'Please enter the download link, HTTP/HTTPS/MAGNET supported@append',
'downloadLinkHitDesktop': ', or drag the torrent file here directly',
'download': 'دانلود',
'noStoragePermission': 'مجوز ذخیره سازی مورد نیاز است',
'selectFile': 'انتخاب فایل',
'basic': 'پایه',
'advanced': 'پیشرفته',
'general': 'عمومی',
'downloadDir': 'دایرکتوری دانلود',
'downloadDirValid': 'لطفا دایرکتوری دانلود را انتخاب کنید',
'connections': 'اتصالات',
'items': '@count آیتم ها',
'subscribeTracker': 'Subscribe Tracker',
'subscribeFail':
'Subscribe failed, please check network or try again later',
'update': 'بروزرسانی',
'updateDaily': 'بروزرسانی روزانه',
'lastUpdate': 'Last update: @time',
'addTracker': 'Add Tracker',
'addTrackerHit': 'Please enter the tracker server url, one per line',
'ui': 'رابط کاربری',
'theme': 'پوسته',
'themeSystem': 'سیستم',
'themeLight': 'روشن',
'themeDark': 'تاریک',
'locale': 'Language',
'about': 'درباره ی',
'homepage': 'صفحه اصلی',
'version': 'نسخه',
'protocol': 'پروتکل',
'port': 'پورت',
'apiToken': 'API توکن',
'notSet': 'NS',
'set': 'SET',
'effectAfterRestart': 'Effect after restart',
'deleteTask': 'پاک کردن کار',
'deleteTaskTip': 'فایل های دانلود شده را نگه دارد',
'delete': 'پاک کردن',
};
static const ru_RU = {
'label': 'Русский(Россия)',
'error': 'Ошибка',
'tip': 'Подсказка',
'confirm': 'Подтвердить',
'cancel': 'Отмена',
'selectAll': 'Выбрать все',
'task': 'Задачи',
'downloading': 'downloading',
'downloaded': 'downloaded',
'setting': 'Настройки',
'title': 'Создать задачу',
'downloadLink': 'Ссылка для скачивание',
'downloadLinkValid': 'Пожалуйста, введите ссылку для скачивания',
'downloadLinkHit':
'Пожалуйста, введите ссылку для скачивания, HTTP/HTTPS/MAGNET supported@append',
'downloadLinkHitDesktop': ', или перетащите сюда торрент-файл',
'download': 'Скачать',
'noStoragePermission': 'Требуется доступ к хранилищу',
'selectFile': 'Выберать файл',
'basic': 'Основные параметры',
'advanced': 'Расширенные',
'general': 'Общие',
'downloadDir': 'Папка загрузки',
'downloadDirValid': 'Пожалуйста, выберите папку для загрузки',
'connections': 'Соединений',
'items': '@подсчет элементов',
'subscribeTracker': 'Подпись трекера',
'subscribeFail':
'Подписка не удалась, пожалуйста, проверьте сеть или повторите попытку позже',
'update': 'Обновить',
'updateDaily': 'Обновлять ежедневно',
'lastUpdate': 'Последнее обновление: @время',
'addTracker': 'Добавить трекер',
'addTrackerHit': 'Пожалуйста, введите url трекера, по одному в строке',
'ui': 'UI',
'theme': 'Тема',
'themeSystem': 'Системная',
'themeLight': 'Светлая',
'themeDark': 'Темная',
'locale': 'Язык',
'about': 'О приложении',
'homepage': 'Домашняя страница',
'version': 'Версия',
'protocol': 'Протокол',
'port': 'Порт',
'apiToken': 'API Токен',
'notSet': 'Не установлено',
'set': 'Установлено',
'effectAfterRestart': 'Эффект после перезагрузки',
'deleteTask': 'Удалить задачу',
'deleteTaskTip': 'Сохранить загруженные файлы',
'delete': 'Удалить',
};
static const zh_CN = {
'label': '中文(简体)',
'error': '错误',
'tip': '提示',
'confirm': '确认',
'cancel': '取消',
'selectAll': '全选',
'task': '任务',
'downloading': '下载中',
'downloaded': '已完成',
'setting': '设置',
'title': '创建任务',
'downloadLink': '下载链接',
'downloadLinkValid': '请输入下载链接',
'downloadLinkHit': '请输入下载链接,支持 HTTP/HTTPS/MAGNET@append',
'downloadLinkHitDesktop': ',也可以直接拖拽种子文件到此处',
'download': '下载',
'noStoragePermission': '需要开启存储权限',
'selectFile': '选择文件',
'basic': '基础',
'advanced': '高级',
'general': '通用',
'downloadDir': '下载目录',
'downloadDirValid': '请选择下载目录',
'connections': '连接数',
'items': '@count 条',
'subscribeTracker': '订阅 Tracker',
'subscribeFail': '订阅失败,请检查网络或稍后重试',
'update': '更新',
'updateDaily': '每天自动更新',
'lastUpdate': '上次更新:@time',
'addTracker': '添加 Tracker',
'addTrackerHit': '请输入 tracker 服务器地址,每行一条',
'ui': '界面',
'theme': '主题',
'themeSystem': '跟随系统',
'themeLight': '明亮主题',
'themeDark': '暗黑主题',
'locale': '语言',
'about': '关于',
'homepage': '主页',
'version': '版本',
'protocol': '通讯协议',
'port': '端口',
'apiToken': '接口令牌',
'notSet': '未设置',
'set': '已设置',
'effectAfterRestart': '此配置项将在重启应用后生效',
'deleteTask': '删除任务',
'deleteTaskTip': '保留已下载的文件',
'delete': '删除',
};
}
+2 -2
View File
@@ -4,9 +4,9 @@ import 'package:get/get.dart';
import 'package:gopeed/api/api.dart' as api;
import 'package:gopeed/i18n/messages.dart';
import 'app/modules/app/controllers/app_controller.dart';
import 'app/modules/app/views/app_view.dart';
import 'core/libgopeed_boot.dart';
import 'pages/app/app_controller.dart';
import 'pages/app/app_view.dart';
import 'util/log_util.dart';
import 'util/mac_secure_util.dart';
import 'util/package_info.dart';
-143
View File
@@ -1,143 +0,0 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:stylish_bottom_bar/model/bar_items.dart';
import 'package:stylish_bottom_bar/stylish_bottom_bar.dart';
import '../../routes/router.dart';
import '../../util/responsive_builder.dart';
import 'home_controller.dart';
class HomeView extends GetView<HomeController> {
const HomeView({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return GetRouterOutlet.builder(
builder: (context, delegate, currentRoute) {
//This router outlet handles the appbar and the bottom navigation bar
return Scaffold(
extendBody: true,
body: Row(
// crossAxisAlignment: CrossAxisAlignment.start,
children: [
!ResponsiveBuilder.isNarrow(context)
? NavigationRail(
extended: true,
labelType: NavigationRailLabelType.none,
minExtendedWidth: 140,
groupAlignment: 0,
// useIndicator: false,
onDestinationSelected: (int index) {
switch (index) {
case 0:
delegate.toNamed(Routes.downloading);
controller.currentIndex.value = 0;
break;
case 1:
delegate.toNamed(Routes.downloaded);
controller.currentIndex.value = 1;
break;
case 2:
delegate.toNamed(Routes.setting);
controller.currentIndex.value = 2;
break;
}
},
destinations: [
NavigationRailDestination(
icon: const Icon(Icons.format_align_left_outlined),
selectedIcon:
const Icon(Icons.format_align_left_outlined),
label: Text('home.downloading'.tr),
),
NavigationRailDestination(
icon:
const Icon(Icons.format_align_justify_outlined),
selectedIcon:
const Icon(Icons.format_align_justify_outlined),
label: Text('home.downloaded'.tr),
),
NavigationRailDestination(
icon: const Icon(Icons.settings),
selectedIcon: const Icon(Icons.settings),
label: Text('home.setting'.tr),
),
],
selectedIndex: controller.currentIndex.value,
leading: const Icon(Icons.logo_dev),
// trailing: const Icon(Icons.info_outline),
)
: const SizedBox.shrink(),
Expanded(
child: GetRouterOutlet(
initialRoute: Routes.downloading,
))
]),
bottomNavigationBar: ResponsiveBuilder.isNarrow(context)
? StylishBottomBar(
option: AnimatedBarOptions(
iconSize: 32,
barAnimation: BarAnimation.blink,
iconStyle: IconStyle.Default,
opacity: 0.3,
),
items: [
BottomBarItem(
icon: const Icon(Icons.format_align_left_outlined),
selectedColor: Get.theme.primaryColor,
title: Text('home.downloading'.tr)),
BottomBarItem(
icon: const Icon(Icons.format_align_justify_outlined),
selectedColor: Get.theme.primaryColor,
title: Text('home.downloaded'.tr)),
BottomBarItem(
icon: const Icon(Icons.settings),
selectedColor: Get.theme.primaryColor,
title: Text('home.setting'.tr)),
],
// hasNotch: true,
currentIndex: controller.currentIndex.value,
onTap: (index) {
switch (index) {
case 0:
delegate.toNamed(Routes.downloading);
controller.currentIndex.value = 0;
break;
case 1:
delegate.toNamed(Routes.downloaded);
controller.currentIndex.value = 1;
break;
case 2:
delegate.toNamed(Routes.setting);
controller.currentIndex.value = 2;
break;
}
},
)
: const SizedBox.shrink(),
// floatingActionButtonAnimator: FloatingActionButtonAnimator.scaling,
// floatingActionButton: ResponsiveBuilder.isNarrow(context)
// ? FloatingActionButton(
// onPressed: () {
// /* Get.isDarkMode
// ? {
// Get.changeTheme(GopeedTheme.light),
// Get.changeThemeMode(ThemeMode.light)
// }
// : {
// Get.changeTheme(GopeedTheme.dark),
// Get.changeThemeMode(ThemeMode.dark)
// }; */
// Get.rootDelegate.toNamed(Routes.create);
// },
// child: const Icon(
// Icons.add,
// ))
// : null,
// floatingActionButtonLocation:
// FloatingActionButtonLocation.centerDocked,
);
},
);
}
}
-100
View File
@@ -1,100 +0,0 @@
import 'package:get/get.dart';
import '../pages/create/create_controller.dart';
import '../pages/create/create_view.dart';
import '../pages/downloaded/downloaded_controller.dart';
import '../pages/downloaded/downloaded_view.dart';
import '../pages/downloading/downloading_controller.dart';
import '../pages/downloading/downloading_view.dart';
import '../pages/home/home_controller.dart';
import '../pages/home/home_view.dart';
import '../pages/root/root_controller.dart';
import '../pages/root/root_view.dart';
import '../pages/setting/setting_controller.dart';
import '../pages/setting/setting_view.dart';
abstract class _Paths {
static const root = '/';
static const create = '/create';
static const home = '/home';
static const downloading = '/downloading';
static const downloaded = '/downloaded';
static const setting = '/setting';
}
class Routes {
static const root = _Paths.root;
static const create = _Paths.create;
static const home = _Paths.home;
static const downloading = _Paths.home + _Paths.downloading;
static const downloaded = _Paths.home + _Paths.downloaded;
static const setting = _Paths.home + _Paths.setting;
static final routes = [
GetPage(
name: _Paths.root,
participatesInRootNavigator: true,
transition: Transition.topLevel,
// preventDuplicates: true,
page: () => const RootView(),
binding: BindingsBuilder(() {
Get.lazyPut<RootController>(() => RootController(), fenix: true);
}),
children: [
GetPage(
name: _Paths.create,
transition: Transition.downToUp,
// preventDuplicates: true,
page: () => CreateView(),
binding: BindingsBuilder(() {
Get.lazyPut<CreateController>(() => CreateController(),
fenix: true);
}),
),
GetPage(
name: _Paths.home,
// transition: Transition.upToDown,
// preventDuplicates: true,
page: () => const HomeView(),
binding: BindingsBuilder(() {
Get.lazyPut<HomeController>(() => HomeController(),
fenix: true);
}),
children: [
GetPage(
name: _Paths.downloading,
transition: Transition.noTransition,
page: () => const DownloadingView(),
binding: BindingsBuilder(() {
Get.lazyPut<DownloadingController>(
() => DownloadingController(),
);
}),
),
GetPage(
name: _Paths.downloaded,
transition: Transition.noTransition,
page: () => const DownloadedView(),
binding: BindingsBuilder(() {
Get.lazyPut<DownloadedController>(
() => DownloadedController(),
);
}),
),
GetPage(
name: _Paths.setting,
transition: Transition.noTransition,
page: () => const SettingView(),
binding: BindingsBuilder(() {
Get.lazyPut<SettingController>(() => SettingController());
}),
)
]),
]),
];
}