fix: style, performance ,loading bug (#90)

* 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

* fix:locale fix

* fix: task list stack progress style
fix: translation
fix: tree view
fix: confirm button loading
remove: stylish_bottom_bar(dark mode not supported)

* fix: task list stack progress style
fix: translation
fix: tree view
fix: confirm button loading
remove: stylish_bottom_bar(dark mode not supported)

---------

Co-authored-by: wuke2022 <[email protected]>
This commit is contained in:
Neginegiandwuke2022 authored and GitHub committed 2023-02-21 20:17:17 +08:00
1 parent dbc9c4c121
commit 5b69472ac8
20 files changed
+4390 -217

No files matched your search

@@ -10,7 +10,7 @@ import '../../../../api/api.dart';
import '../../../../api/model/downloader_config.dart';
import '../../../../core/common/start_config.dart';
import '../../../../generated/locales.g.dart';
import '../../../../i18n/localeManager.dart';
import '../../../../util/localeManager.dart';
import '../../../../util/log_util.dart';
import '../../../../util/util.dart';
@@ -3,8 +3,8 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:get/get.dart';
import '../../../../generated/locales.g.dart';
import '../../../../i18n/localeManager.dart';
import '../../../../theme/theme.dart';
import '../../../../util/localeManager.dart';
import '../../../routes/app_pages.dart';
import '../controllers/app_controller.dart';
@@ -2,5 +2,5 @@ import 'package:get/get.dart';
class CreateController extends GetxController {
final files = [].obs;
final RxList selectedIndexs = [].obs;
final RxList selectedIndexes = [].obs;
}
@@ -70,18 +70,18 @@ class CreateView extends GetView<CreateController> {
child: RoundedLoadingButton(
color: Get.theme.colorScheme.secondary,
onPressed: () async {
if (_resolveFormKey.currentState!.validate()) {
try {
_confirmController.start();
try {
if (_resolveFormKey.currentState!.validate()) {
final rr = await resolve(Request(
url: _urlController.text,
));
await _showResolveDialog(rr);
} catch (e) {
Get.snackbar('error'.tr, e.toString());
} finally {
_confirmController.reset();
}
} catch (e) {
Get.snackbar('error'.tr, e.toString());
} finally {
_confirmController.reset();
}
},
controller: _confirmController,
@@ -106,12 +106,11 @@ class CreateView extends GetView<CreateController> {
Future<void> _showResolveDialog(ResolveResult rr) async {
controller.files.value = rr.res.files;
final appController = Get.find<AppController>();
final setting = appController.downloaderConfig.value;
final createFormKey = GlobalKey<FormState>();
final pathController = TextEditingController(text: setting.downloadDir);
final pathController = TextEditingController(
text: appController.downloaderConfig.value.downloadDir);
final downloadController = RoundedLoadingButtonController();
return showDialog<void>(
context: Get.context!,
barrierDismissible: false,
@@ -163,40 +162,47 @@ class CreateView extends GetView<CreateController> {
height: Get.theme.buttonTheme.height,
),
child: RoundedLoadingButton(
color: Get.theme.colorScheme.secondary,
onPressed: () async {
try {
if (createFormKey.currentState!.validate()) {
color: Get.theme.colorScheme.secondary,
duration: const Duration(milliseconds: 100),
onPressed: () async {
try {
downloadController.start();
if (controller.selectedIndexes.isEmpty) {
Get.snackbar('tip'.tr, 'noFileSelected'.tr);
return;
}
if (createFormKey.currentState!.validate()) {
// if (Util.isAndroid()) {
// if (!await Permission.storage.request().isGranted) {
// Get.snackbar('error'.tr,
// 'noStoragePermission'.tr);
// return;
// }
// }
// if (Util.isAndroid()) {
// if (!await Permission.storage.request().isGranted) {
// Get.snackbar('error'.tr,
// 'noStoragePermission'.tr);
// return;
// }
// }
await createTask(CreateTask(
rid: rr.id,
opts: Options(
name: '',
path: pathController.text,
selectFiles:
controller.selectedIndexs.cast<int>())));
Get.back();
Get.rootDelegate.offNamed(Routes.DOWNLOADING);
await createTask(CreateTask(
rid: rr.id,
opts: Options(
name: '',
path: pathController.text,
selectFiles: controller.selectedIndexes
.cast<int>())));
Get.rootDelegate.offNamed(Routes.DOWNLOADING);
}
} catch (e) {
Get.snackbar('error'.tr, e.toString());
rethrow;
} finally {
downloadController.reset();
}
} catch (e) {
Get.snackbar('error'.tr, e.toString());
rethrow;
} finally {
downloadController.reset();
}
},
controller: downloadController,
child: Text('download'.tr),
),
},
controller: downloadController,
child: Text(
'download'.tr,
// style: controller.selectedIndexes.isEmpty
// ? Get.textTheme.disabled
// : Get.textTheme.titleSmall
)),
),
],
));
@@ -1,7 +1,5 @@
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';
@@ -77,29 +75,23 @@ class HomeView extends GetView<HomeController> {
))
]),
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)),
? BottomNavigationBar(
items: <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: const Icon(Icons.format_align_left_outlined),
label: 'downloading'.tr,
),
BottomNavigationBarItem(
icon: const Icon(Icons.format_align_justify_outlined),
label: 'downloaded'.tr,
),
BottomNavigationBarItem(
icon: const Icon(Icons.settings),
label: 'setting'.tr,
),
],
// hasNotch: true,
currentIndex: controller.currentIndex.value,
// selectedItemColor: Get.theme.highlightColor,
onTap: (index) {
switch (index) {
case 0:
@@ -117,6 +109,46 @@ class HomeView extends GetView<HomeController> {
}
},
)
// 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(),
);
});
@@ -8,7 +8,7 @@ import 'package:intl/intl.dart';
import 'package:url_launcher/url_launcher.dart';
import '../../../../generated/locales.g.dart';
import '../../../../i18n/localeManager.dart';
import '../../../../util/localeManager.dart';
import '../../../../util/package_info.dart';
import '../../../../util/util.dart';
import '../../../views/views/check_list_view.dart';