mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +00:00
Hide unused widgets
This commit is contained in:
@ -288,31 +288,31 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
static int pageIndex = 0;
|
||||
|
||||
static Map<String, List<Widget>> appBarActions = {
|
||||
'Dashboard': [
|
||||
// IconButton(
|
||||
// icon: const Icon(
|
||||
// Icons.add,
|
||||
// size: 25,
|
||||
// ),
|
||||
// style: ButtonStyle(
|
||||
// foregroundColor: WidgetStateProperty.all(ColorsManager.textPrimaryColor),
|
||||
// ),
|
||||
// onPressed: () {
|
||||
// Navigator.push(
|
||||
// NavigationService.navigatorKey.currentContext!,
|
||||
// CustomPageRoute(
|
||||
// builder: (context) => CurtainView(
|
||||
// curtain: DeviceModel(
|
||||
// name: "Curtain",
|
||||
// status: [StatusModel(code: "awd", value: 1)],
|
||||
// productType: DeviceType.Curtain,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// },
|
||||
// ),
|
||||
],
|
||||
// 'Dashboard': [
|
||||
// // IconButton(
|
||||
// // icon: const Icon(
|
||||
// // Icons.add,
|
||||
// // size: 25,
|
||||
// // ),
|
||||
// // style: ButtonStyle(
|
||||
// // foregroundColor: WidgetStateProperty.all(ColorsManager.textPrimaryColor),
|
||||
// // ),
|
||||
// // onPressed: () {
|
||||
// // Navigator.push(
|
||||
// // NavigationService.navigatorKey.currentContext!,
|
||||
// // CustomPageRoute(
|
||||
// // builder: (context) => CurtainView(
|
||||
// // curtain: DeviceModel(
|
||||
// // name: "Curtain",
|
||||
// // status: [StatusModel(code: "awd", value: 1)],
|
||||
// // productType: DeviceType.Curtain,
|
||||
// // ),
|
||||
// // ),
|
||||
// // ),
|
||||
// // );
|
||||
// // },
|
||||
// // ),
|
||||
// ],
|
||||
'Devices': [
|
||||
//TODO: to be checked
|
||||
// IconButton(
|
||||
@ -406,7 +406,7 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
};
|
||||
|
||||
static Map<String, Widget?> appBarLeading = {
|
||||
'Dashboard': const AppBarHomeDropdown(),
|
||||
// 'Dashboard': const AppBarHomeDropdown(),
|
||||
'Devices': const AppBarHomeDropdown(),
|
||||
'Routine': const AppBarHomeDropdown(),
|
||||
'Menu': Padding(
|
||||
@ -421,7 +421,7 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
};
|
||||
|
||||
static var bottomNavItems = [
|
||||
defaultBottomNavBarItem(icon: Assets.assetsIconsDashboard, label: 'Dashboard'),
|
||||
// defaultBottomNavBarItem(icon: Assets.assetsIconsDashboard, label: 'Dashboard'),
|
||||
// defaultBottomNavBarItem(icon: Assets.assetsIconslayout, label: 'Layout'),
|
||||
defaultBottomNavBarItem(icon: Assets.assetsIconsDevices, label: 'Devices'),
|
||||
defaultBottomNavBarItem(icon: Assets.assetsIconsRoutines, label: 'Routine'),
|
||||
@ -429,7 +429,7 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
];
|
||||
|
||||
final List<Widget> pages = [
|
||||
const DashboardView(),
|
||||
// const DashboardView(),
|
||||
// const LayoutPage(),
|
||||
BlocProvider(
|
||||
create: (context) => DevicesCubit.getInstance(),
|
||||
|
@ -12,62 +12,65 @@ class AppBarHomeDropdown extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<HomeCubit, HomeState>(
|
||||
builder: (context, state) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||
child: DropdownButton(
|
||||
icon: const Icon(
|
||||
Icons.expand_more,
|
||||
color: ColorsManager.textPrimaryColor,
|
||||
size: 16,
|
||||
),
|
||||
underline: const SizedBox.shrink(),
|
||||
padding: EdgeInsets.zero,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
value: HomeCubit.getInstance().selectedSpace!.id,
|
||||
items: HomeCubit.getInstance().spaces!.map((space) {
|
||||
return DropdownMenuItem(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
value: space.id,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
SvgPicture.asset(
|
||||
Assets.assetsIconsHome,
|
||||
width: 25,
|
||||
height: 25,
|
||||
colorFilter: const ColorFilter.mode(
|
||||
ColorsManager.textPrimaryColor,
|
||||
BlendMode.srcIn,
|
||||
return HomeCubit.getInstance().spaces != null || HomeCubit.getInstance().spaces!.isNotEmpty
|
||||
? BlocBuilder<HomeCubit, HomeState>(
|
||||
builder: (context, state) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||
child: DropdownButton(
|
||||
icon: const Icon(
|
||||
Icons.expand_more,
|
||||
color: ColorsManager.textPrimaryColor,
|
||||
size: 16,
|
||||
),
|
||||
underline: const SizedBox.shrink(),
|
||||
padding: EdgeInsets.zero,
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
value: HomeCubit.getInstance().selectedSpace?.id ?? '',
|
||||
items: HomeCubit.getInstance().spaces!.map((space) {
|
||||
return DropdownMenuItem(
|
||||
alignment: AlignmentDirectional.centerStart,
|
||||
value: space.id,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
SvgPicture.asset(
|
||||
Assets.assetsIconsHome,
|
||||
width: 25,
|
||||
height: 25,
|
||||
colorFilter: const ColorFilter.mode(
|
||||
ColorsManager.textPrimaryColor,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Flexible(
|
||||
child: BodyMedium(
|
||||
text: space.name,
|
||||
style: context.bodyMedium.copyWith(
|
||||
fontSize: 15,
|
||||
color: ColorsManager.textPrimaryColor,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
Flexible(
|
||||
child: BodyMedium(
|
||||
text: space.name,
|
||||
style: context.bodyMedium.copyWith(
|
||||
fontSize: 15,
|
||||
color: ColorsManager.textPrimaryColor,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 5),
|
||||
],
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
HomeCubit.getInstance().changeSelectedSpace(HomeCubit.getInstance()
|
||||
.spaces!
|
||||
.firstWhere((element) => element.id == value));
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
HomeCubit.getInstance().changeSelectedSpace(
|
||||
HomeCubit.getInstance().spaces!.firstWhere((element) => element.id == value));
|
||||
}
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
)
|
||||
: Container();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user