feat: ui improvement

flutter 3.7 compatibility
responsive view
beautiful progress bar
select file in treeview
downlading and downloaded page
This commit is contained in:
wuke2022 authored and liwei committed 2023-02-16 11:34:42 +08:00
1 parent a875a9258e
commit 9b1ed15fea
28 files changed
+932 -439

No files matched your search

+121 -66
View File
@@ -4,6 +4,7 @@ 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> {
@@ -14,73 +15,127 @@ class HomeView extends GetView<HomeController> {
return GetRouterOutlet.builder(
builder: (context, delegate, currentRoute) {
//This router outlet handles the appbar and the bottom navigation bar
final currentLocation = currentRoute?.location;
var currentIndex = 0;
if (currentLocation?.startsWith(Routes.setting) == true) {
currentIndex = 1;
}
return Scaffold(
extendBody: true, //to make floating action button notch transparent
//to avoid the floating action button overlapping behavior,
// when a soft keyboard is displayed
// resizeToAvoidBottomInset: false,
body: GetRouterOutlet(
initialRoute: Routes.task,
//delegate: Get.nestedKey(Routes.HOME),
// key: Get.nestedKey(Routes.HOME),
// key: Get.nestedKey(Routes.home),
),
bottomNavigationBar: StylishBottomBar(
option: AnimatedBarOptions(
iconSize: 32,
barAnimation: BarAnimation.fade,
iconStyle: IconStyle.Default,
opacity: 0.3,
),
items: [
BottomBarItem(
icon: const Icon(Icons.list),
selectedColor: Get.theme.primaryColor,
title: Text('home.task'.tr)),
BottomBarItem(
icon: const Icon(Icons.settings),
selectedColor: Get.theme.primaryColor,
title: Text('home.setting'.tr)),
],
hasNotch: true,
currentIndex: currentIndex,
onTap: (index) {
switch (index) {
case 0:
delegate.toNamed(Routes.task);
break;
case 1:
delegate.toNamed(Routes.setting);
break;
}
},
),
floatingActionButton: 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,
)),
floatingActionButtonLocation:
FloatingActionButtonLocation.centerDocked,
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,
);
},
);