mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-15 21:03:41 +00:00
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:
1 parent
9b1ed15fea
commit
74c24ad860
44 files changed
+1025
-360
No files matched your search
@@ -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,5 @@
|
||||
import 'package:get/get.dart';
|
||||
|
||||
class HomeController extends GetxController {
|
||||
var currentIndex = 0.obs;
|
||||
}
|
||||
@@ -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(),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user