Closed MyCocos closed 3 months ago
class HomeScreenView extends GetView { HomeScreenView({super.key});
final viewKey = GlobalKey(debugLabel: 'Navigation View Key');
@override Widget build(BuildContext context) { var themeIconName = controller.mode.value == ThemeMode.light ? "lightTheme".tr : "darkTheme".tr; controller.themeIconData.value = controller.mode.value == ThemeMode.light ? FluentIcons.lower_brightness : FluentIcons.light; return Obx( () => FluentApp( scrollBehavior: MyCustomScrollBehavior(), // <== add here builder: FlutterSmartDialog.init(), themeMode: controller.mode.value, debugShowCheckedModeBanner: true, //color: controller.color, theme: FluentThemeData.light(), darkTheme: FluentThemeData.dark(), locale: controller.locale, home: NavigationView( key: viewKey, appBar: NavigationAppBar( title: Text("admin_name".tr), leading: IconButton( icon: const Icon(FluentIcons.home, size: kDefaultPadding), onPressed: () { debugPrint('head to'); }, ), actions: Row( children: [ const Spacer(flex: 40), //δΈ»ι’εζ’ Expanded( flex: 4, child: Padding( padding: const EdgeInsets.only(top: kDefaultPadding * 0.4), child: Visibility( visible: (MediaQuery.of(context).size.width > kScreenWidthXl), child: IconButton( icon: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(semanticLabel: themeIconName, controller.themeIconData.value, size: kDefaultPadding), Text(themeIconName), ], ), onPressed: () { //setState(() { controller.mode.value = ShowUtils().updateTheme();
//themeIconName; // controller.themeIconData.value = controller.mode == ThemeMode.light ? FluentIcons.lower_brightness : FluentIcons.light; //}); }, ), ), ), ), //θ―θ¨εζ’ Expanded( flex: 5, child: Padding( padding: const EdgeInsets.only(top: kDefaultPadding * 0.4, left: kDefaultPadding * 0.3, right: kDefaultPadding * 1.0), child: Visibility( visible: (MediaQuery.of(context).size.width > kScreenWidthXl), child: DropDownButton( title: Row( children: [ const Icon(FluentIcons.locale_language, size: kDefaultPadding), Padding( padding: const EdgeInsets.only(left: kDefaultPadding * 0.5), child: Text("language".tr), ), ], ), items: [ MenuFlyoutItem( onPressed: () async { // ref.read(localChange.notifier).update((state) => state = ShowUtils.updateLocation(LanguageType.values[0])); ShowUtils.updateLocation(0, LanguageType[0]); }, text: Text(LanguageType[0]), ), MenuFlyoutItem( onPressed: () async { //ref.read(localChange.notifier).update((state) => state = ShowUtils.updateLocation(LanguageType.values[1])); ShowUtils.updateLocation(1, LanguageType[1]); }, text: Text(LanguageType[1]), ), ], ), ), ), ), // //η¨ζ·δΏ‘ζ― Expanded( flex: 2, child: Padding( padding: const EdgeInsets.only(top: kDefaultPadding * 0.4, left: kDefaultPadding * 0.3, right: kDefaultPadding * 1.0), child: IconButton( //tooltip: context.L!.admin, //padding: const EdgeInsets.only(top: kDefaultPadding * 0.6, left: kDefaultPadding * 0.2), onPressed: () { AwesomeDialog? dialog; // ε¨θΏιε£°ζ dialog ει dialog = AwesomeDialog( context: context, dialogType: DialogType.noHeader, width: kDialogWidth, body: AdminInfoView( context: context, onAccountButtonPressed: () { //const MyProfileRoute().go(context); }, onLogoutButtonPressed: () { dialog?.dismiss(); Utils.logout(); //userAppRouter().go(RoutePath.LOGIN); Get.off(LoginScreenView()); }, ), //padding: const EdgeInsets.only(bottom: 0, left: 0), alignment: Alignment.topRight, onDismissCallback: (type) {}, ); dialog.show(); }, icon: const Icon(FluentIcons.account_management, size: kDefaultPadding), ), ), ), ], ), ), onDisplayModeChanged: (mode) { debugPrint('ηΉε»θεεζ’ζΎη€Ίεζ’ to $mode'); }, pane: NavigationPane( selected: controller.topIndex.value, //indicator: indicators[indicator], onItemPressed: (index) { //Do anything you want to do, such as: //if (index == topIndex) { //if (displayMode == PaneDisplayMode.open) { // setState(() => this.displayMode = PaneDisplayMode.compact); //} else if (displayMode == PaneDisplayMode.compact) { // setState(() => this.displayMode = PaneDisplayMode.open); //} //} debugPrint('ηΉε»θεChanged to $index'); }, onChanged: (index) => controller.topIndex = index.obs, //setState(() => topIndex = index), displayMode: controller.displayMode, toggleable: true, // header: Text("menuDisplay".tr), size: const NavigationPaneSize(openMaxWidth: kDefaultPadding * 15.0), leading: IconButton( icon: const Icon(FluentIcons.home), onPressed: () { debugPrint('head to'); }, ), items: controller.getMenu(), ), ), ), );
} }
γγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγ List getMenu() { var menuList = StoreUtil.getMenuList(); List menus = []; // εε»ΊδΈδΈͺη©Ίη List 对豑 for (var v in menuList) { if (v.parentId > 0) { continue; } // ζ·»ε εθει‘Ή bool isChildMenu = false; for (var v1 in menuList) { if (v1.parentId == v.id) { isChildMenu = true; break; } } if (isChildMenu == true) { var children = PaneItemExpander( icon: Icon(_menusIconData(v.icon), size: kDefaultPadding), items: _getMenuChild(v.id, menuList), title: Text(v.menuName), onTap: () { onMenuActionClick(v.path, v.menuName); }, body: tabView.value, ); menus.add(children); } else { var children = PaneItem( icon: Icon(_menusIconData(v.icon), size: kDefaultPadding), title: Text(v.menuName), onTap: () { onMenuActionClick(v.path, v.menuName); }, body: tabView.value, ); menus.add(children); } } return menus; }
List _getMenuChild(int menuId, var list) { List subMenuItems = []; // ζ·»ε εθει‘Ή for (var v in list) { if (v.parentId == menuId) { // ζ·»ε εθει‘Ή bool isChildMenu = false; for (var v1 in list) { if (v1.parentId == v.id) { isChildMenu = true; break; } } if (isChildMenu == true) { var children = PaneItemExpander( icon: Icon(_menusIconData(v.icon), size: kDefaultPadding), items: _getMenuChild(v.id, list), title: Text(v.menuName), onTap: () { onMenuActionClick(v.path, v.menuName); }, body: tabView.value, ); subMenuItems.add(children); } else { var children = PaneItem( icon: Icon(_menusIconData(v.icon), size: kDefaultPadding), title: Text(v.menuName), onTap: () { onMenuActionClick(v.path, v.menuName); }, body: tabView.value, ); subMenuItems.add(children); } } } return subMenuItems; }
Please, use the issue template. It is impossible to read the issue like this.
class HomeScreenView extends GetView {
HomeScreenView({super.key});
final viewKey = GlobalKey(debugLabel: 'Navigation View Key');
@override Widget build(BuildContext context) { var themeIconName = controller.mode.value == ThemeMode.light ? "lightTheme".tr : "darkTheme".tr; controller.themeIconData.value = controller.mode.value == ThemeMode.light ? FluentIcons.lower_brightness : FluentIcons.light; return Obx( () => FluentApp( scrollBehavior: MyCustomScrollBehavior(), // <== add here builder: FlutterSmartDialog.init(), themeMode: controller.mode.value, debugShowCheckedModeBanner: true, //color: controller.color, theme: FluentThemeData.light(), darkTheme: FluentThemeData.dark(), locale: controller.locale, home: NavigationView( key: viewKey, appBar: NavigationAppBar( title: Text("admin_name".tr), leading: IconButton( icon: const Icon(FluentIcons.home, size: kDefaultPadding), onPressed: () { debugPrint('head to'); }, ), actions: Row( children: [ const Spacer(flex: 40), //δΈ»ι’εζ’ Expanded( flex: 4, child: Padding( padding: const EdgeInsets.only(top: kDefaultPadding * 0.4), child: Visibility( visible: (MediaQuery.of(context).size.width > kScreenWidthXl), child: IconButton( icon: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon(semanticLabel: themeIconName, controller.themeIconData.value, size: kDefaultPadding), Text(themeIconName), ], ), onPressed: () { //setState(() { controller.mode.value = ShowUtils().updateTheme();
} }
γγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγ List getMenu() {
var menuList = StoreUtil.getMenuList();
List menus = []; // εε»ΊδΈδΈͺη©Ίη List 对豑
for (var v in menuList) {
if (v.parentId > 0) {
continue;
}
// ζ·»ε εθει‘Ή
bool isChildMenu = false;
for (var v1 in menuList) {
if (v1.parentId == v.id) {
isChildMenu = true;
break;
}
}
if (isChildMenu == true) {
var children = PaneItemExpander(
icon: Icon(_menusIconData(v.icon), size: kDefaultPadding),
items: _getMenuChild(v.id, menuList),
title: Text(v.menuName),
onTap: () {
onMenuActionClick(v.path, v.menuName);
},
body: tabView.value,
);
menus.add(children);
} else {
var children = PaneItem(
icon: Icon(_menusIconData(v.icon), size: kDefaultPadding),
title: Text(v.menuName),
onTap: () {
onMenuActionClick(v.path, v.menuName);
},
body: tabView.value,
);
menus.add(children);
}
}
return menus;
}
List _getMenuChild(int menuId, var list) {
List subMenuItems = [];
// ζ·»ε εθει‘Ή
for (var v in list) {
if (v.parentId == menuId) {
// ζ·»ε εθει‘Ή
bool isChildMenu = false;
for (var v1 in list) {
if (v1.parentId == v.id) {
isChildMenu = true;
break;
}
}
if (isChildMenu == true) {
var children = PaneItemExpander(
icon: Icon(_menusIconData(v.icon), size: kDefaultPadding),
items: _getMenuChild(v.id, list),
title: Text(v.menuName),
onTap: () {
onMenuActionClick(v.path, v.menuName);
},
body: tabView.value,
);
subMenuItems.add(children);
} else {
var children = PaneItem(
icon: Icon(_menusIconData(v.icon), size: kDefaultPadding),
title: Text(v.menuName),
onTap: () {
onMenuActionClick(v.path, v.menuName);
},
body: tabView.value,
);
subMenuItems.add(children);
}
}
}
return subMenuItems;
}