mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-11 15:47:44 +00:00
Compare commits
1 Commits
bugfix/add
...
SP-1492-FE
Author | SHA1 | Date | |
---|---|---|---|
c114161357 |
@ -0,0 +1,20 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:syncrow_web/utils/theme/responsive_text_theme.dart';
|
||||||
|
import 'package:syncrow_web/web_layout/web_scaffold.dart';
|
||||||
|
|
||||||
|
class AnalyticsPage extends StatelessWidget {
|
||||||
|
const AnalyticsPage({super.key});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return WebScaffold(
|
||||||
|
appBarTitle: Text(
|
||||||
|
'Syncrow Analytics',
|
||||||
|
style: ResponsiveTextTheme.of(context).deviceManagementTitle,
|
||||||
|
),
|
||||||
|
scaffoldBody: const Center(
|
||||||
|
child: Text('AnalyticsPage is Working!'),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -142,6 +142,19 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
|
|||||||
},
|
},
|
||||||
color: ColorsManager.primaryColor,
|
color: ColorsManager.primaryColor,
|
||||||
),
|
),
|
||||||
|
|
||||||
|
HomeItemModel(
|
||||||
|
title: 'Syncrow Analytics',
|
||||||
|
icon: Assets.devicesIcon,
|
||||||
|
active: true,
|
||||||
|
onPress: (context) {
|
||||||
|
context.read<SpaceTreeBloc>().add(ClearCachedData());
|
||||||
|
BlocProvider.of<RoutineBloc>(context)
|
||||||
|
.add(const TriggerSwitchTabsEvent(isRoutineTab: false));
|
||||||
|
context.go(RoutesConst.analytics);
|
||||||
|
},
|
||||||
|
color: ColorsManager.primaryColor,
|
||||||
|
),
|
||||||
|
|
||||||
// HomeItemModel(
|
// HomeItemModel(
|
||||||
// title: 'Move in',
|
// title: 'Move in',
|
||||||
|
@ -50,8 +50,9 @@ class HomeMobilePage extends StatelessWidget {
|
|||||||
height: size.height * 0.6,
|
height: size.height * 0.6,
|
||||||
width: size.width * 0.68,
|
width: size.width * 0.68,
|
||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
itemCount: 3,
|
itemCount: homeItems.length,
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate:
|
||||||
|
const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount: 2,
|
crossAxisCount: 2,
|
||||||
crossAxisSpacing: 20.0,
|
crossAxisSpacing: 20.0,
|
||||||
mainAxisSpacing: 20.0,
|
mainAxisSpacing: 20.0,
|
||||||
@ -60,10 +61,11 @@ class HomeMobilePage extends StatelessWidget {
|
|||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
return HomeCard(
|
return HomeCard(
|
||||||
index: index,
|
index: index,
|
||||||
active: homeItems[index]['active'],
|
active: homeBloc.homeItems[index].active!,
|
||||||
name: homeItems[index]['title'],
|
name: homeBloc.homeItems[index].title!,
|
||||||
img: homeItems[index]['icon'],
|
img: homeBloc.homeItems[index].icon!,
|
||||||
onTap: () => homeBloc.homeItems[index].onPress(context),
|
onTap: () =>
|
||||||
|
homeBloc.homeItems[index].onPress(context),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -94,6 +96,11 @@ class HomeMobilePage extends StatelessWidget {
|
|||||||
'icon': Assets.devicesIcon,
|
'icon': Assets.devicesIcon,
|
||||||
'active': true,
|
'active': true,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
'title': 'Syncrow Analytics',
|
||||||
|
'icon': Assets.iconEdit,
|
||||||
|
'active': true,
|
||||||
|
},
|
||||||
// {
|
// {
|
||||||
// 'title': 'Move in',
|
// 'title': 'Move in',
|
||||||
// 'icon': Assets.moveinIcon,
|
// 'icon': Assets.moveinIcon,
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_svg/svg.dart';
|
import 'package:flutter_svg/svg.dart';
|
||||||
import 'package:syncrow_web/pages/home/bloc/home_event.dart';
|
|
||||||
import 'package:syncrow_web/pages/home/view/agreement_and_privacy_dialog.dart';
|
|
||||||
import 'package:syncrow_web/pages/home/bloc/home_bloc.dart';
|
import 'package:syncrow_web/pages/home/bloc/home_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/home/bloc/home_event.dart';
|
||||||
import 'package:syncrow_web/pages/home/bloc/home_state.dart';
|
import 'package:syncrow_web/pages/home/bloc/home_state.dart';
|
||||||
|
import 'package:syncrow_web/pages/home/view/agreement_and_privacy_dialog.dart';
|
||||||
import 'package:syncrow_web/pages/home/view/home_card.dart';
|
import 'package:syncrow_web/pages/home/view/home_card.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
import 'package:syncrow_web/web_layout/web_scaffold.dart';
|
import 'package:syncrow_web/web_layout/web_scaffold.dart';
|
||||||
@ -24,7 +24,7 @@ class _HomeWebPageState extends State<HomeWebPage> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
final homeBloc = BlocProvider.of<HomeBloc>(context);
|
final homeBloc = BlocProvider.of<HomeBloc>(context);
|
||||||
homeBloc.add(FetchUserInfo());
|
homeBloc.add(const FetchUserInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -97,7 +97,7 @@ class _HomeWebPageState extends State<HomeWebPage> {
|
|||||||
height: size.height * 0.6,
|
height: size.height * 0.6,
|
||||||
width: size.width * 0.68,
|
width: size.width * 0.68,
|
||||||
child: GridView.builder(
|
child: GridView.builder(
|
||||||
itemCount: 3, // Change this count if needed.
|
itemCount: homeBloc.homeItems.length,
|
||||||
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
|
||||||
crossAxisCount: 3, // Adjust as needed.
|
crossAxisCount: 3, // Adjust as needed.
|
||||||
crossAxisSpacing: 20.0,
|
crossAxisSpacing: 20.0,
|
||||||
|
@ -457,17 +457,16 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
|
|||||||
emit(SpaceManagementLoading());
|
emit(SpaceManagementLoading());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final spaceTreeState = event.context.read<SpaceTreeBloc>().state;
|
|
||||||
|
|
||||||
final updatedSpaces =
|
final updatedSpaces =
|
||||||
await saveSpacesHierarchically(event.context, event.spaces, event.communityUuid);
|
await saveSpacesHierarchically(event.context, event.spaces, event.communityUuid);
|
||||||
|
|
||||||
final allSpaces = await _fetchSpacesForCommunity(event.communityUuid);
|
final allSpaces = await _fetchSpacesForCommunity(event.communityUuid);
|
||||||
|
|
||||||
emit(SpaceCreationSuccess(spaces: updatedSpaces));
|
emit(SpaceCreationSuccess(spaces: updatedSpaces));
|
||||||
|
|
||||||
if (previousState is SpaceManagementLoaded) {
|
if (previousState is SpaceManagementLoaded) {
|
||||||
await _updateLoadedState(
|
await _updateLoadedState(
|
||||||
spaceTreeState,
|
event.context,
|
||||||
previousState,
|
previousState,
|
||||||
allSpaces,
|
allSpaces,
|
||||||
event.communityUuid,
|
event.communityUuid,
|
||||||
@ -484,39 +483,35 @@ class SpaceManagementBloc extends Bloc<SpaceManagementEvent, SpaceManagementStat
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _updateLoadedState(
|
Future<void> _updateLoadedState(
|
||||||
SpaceTreeState spaceTreeState,
|
BuildContext context,
|
||||||
SpaceManagementLoaded previousState,
|
SpaceManagementLoaded previousState,
|
||||||
List<SpaceModel> allSpaces,
|
List<SpaceModel> allSpaces,
|
||||||
String communityUuid,
|
String communityUuid,
|
||||||
Emitter<SpaceManagementState> emit,
|
Emitter<SpaceManagementState> emit,
|
||||||
) async {
|
) async {
|
||||||
try {
|
var prevSpaceModels = await fetchSpaceModels();
|
||||||
var prevSpaceModels = await fetchSpaceModels();
|
await fetchTags();
|
||||||
|
final spaceTreeState = context.read<SpaceTreeBloc>().state;
|
||||||
|
final communities = spaceTreeState.searchQuery.isNotEmpty
|
||||||
|
? spaceTreeState.filteredCommunity
|
||||||
|
: spaceTreeState.communityList;
|
||||||
|
|
||||||
await fetchTags();
|
for (var community in communities) {
|
||||||
|
if (community.uuid == communityUuid) {
|
||||||
|
community.spaces = allSpaces;
|
||||||
|
_spaceTreeBloc.add(InitialEvent());
|
||||||
|
|
||||||
final communities = spaceTreeState.searchQuery.isNotEmpty
|
emit(SpaceManagementLoaded(
|
||||||
? spaceTreeState.filteredCommunity
|
|
||||||
: spaceTreeState.communityList;
|
|
||||||
|
|
||||||
for (var community in communities) {
|
|
||||||
if (community.uuid == communityUuid) {
|
|
||||||
community.spaces = allSpaces;
|
|
||||||
_spaceTreeBloc.add(InitialEvent());
|
|
||||||
|
|
||||||
emit(SpaceManagementLoaded(
|
|
||||||
communities: communities,
|
communities: communities,
|
||||||
products: _cachedProducts ?? [],
|
products: _cachedProducts ?? [],
|
||||||
selectedCommunity: community,
|
selectedCommunity: community,
|
||||||
selectedSpace: null,
|
selectedSpace: null,
|
||||||
spaceModels: prevSpaceModels,
|
spaceModels: prevSpaceModels,
|
||||||
allTags: _cachedTags ?? [],
|
allTags: _cachedTags ?? []));
|
||||||
));
|
return;
|
||||||
return;
|
} else {
|
||||||
}
|
print("Community not found");
|
||||||
}
|
}
|
||||||
} catch (e, stackTrace) {
|
|
||||||
rethrow;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,9 +53,6 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
|
|||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
if (state is SpaceManagementLoading) {
|
if (state is SpaceManagementLoading) {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return const Center(child: CircularProgressIndicator());
|
||||||
}
|
|
||||||
if (state is SpaceManagementInitial) {
|
|
||||||
return const Center(child: CircularProgressIndicator());
|
|
||||||
} else if (state is BlankState) {
|
} else if (state is BlankState) {
|
||||||
return LoadedSpaceView(
|
return LoadedSpaceView(
|
||||||
communities: state.communities,
|
communities: state.communities,
|
||||||
|
@ -526,8 +526,6 @@ class CreateSpaceDialogState extends State<CreateSpaceDialog> {
|
|||||||
isNameFieldInvalid = true;
|
isNameFieldInvalid = true;
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
} else if (isNameFieldExist) {
|
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
String newName = enteredName.isNotEmpty ? enteredName : (widget.name ?? '');
|
String newName = enteredName.isNotEmpty ? enteredName : (widget.name ?? '');
|
||||||
if (newName.isNotEmpty) {
|
if (newName.isNotEmpty) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
||||||
|
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_event.dart';
|
||||||
import 'package:syncrow_web/pages/space_tree/view/space_tree_view.dart';
|
import 'package:syncrow_web/pages/space_tree/view/space_tree_view.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_event.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_event.dart';
|
||||||
|
@ -2,10 +2,10 @@ import 'dart:async';
|
|||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:syncrow_web/common/widgets/empty_search_result_widget.dart';
|
||||||
import 'package:syncrow_web/common/widgets/search_bar.dart';
|
import 'package:syncrow_web/common/widgets/search_bar.dart';
|
||||||
import 'package:syncrow_web/common/widgets/sidebar_communities_list.dart';
|
import 'package:syncrow_web/common/widgets/sidebar_communities_list.dart';
|
||||||
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/space_tree/bloc/space_tree_state.dart';
|
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_bloc.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_event.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/bloc/space_management_event.dart';
|
||||||
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart';
|
import 'package:syncrow_web/pages/spaces_management/all_spaces/model/community_model.dart';
|
||||||
@ -114,48 +114,41 @@ class _SidebarWidgetState extends State<SidebarWidget> {
|
|||||||
return Container(
|
return Container(
|
||||||
width: _width,
|
width: _width,
|
||||||
decoration: subSectionContainerDecoration,
|
decoration: subSectionContainerDecoration,
|
||||||
child: spaceTreeState is SpaceTreeLoadingState
|
child: Column(
|
||||||
? const Center(child: CircularProgressIndicator())
|
mainAxisSize: MainAxisSize.min,
|
||||||
: Column(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisSize: MainAxisSize.min,
|
children: [
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
SidebarHeader(onAddCommunity: _onAddCommunity),
|
||||||
children: [
|
CustomSearchBar(
|
||||||
SidebarHeader(onAddCommunity: _onAddCommunity),
|
onSearchChanged: _onSearchChanged,
|
||||||
CustomSearchBar(
|
),
|
||||||
onSearchChanged: _onSearchChanged,
|
const SizedBox(height: 16),
|
||||||
),
|
Expanded(
|
||||||
const SizedBox(height: 16),
|
child: Visibility(
|
||||||
Expanded(
|
visible: filteredCommunities.isNotEmpty,
|
||||||
child: Builder(
|
replacement: const EmptySearchResultWidget(),
|
||||||
builder: (_) {
|
child: SidebarCommunitiesList(
|
||||||
return SidebarCommunitiesList(
|
scrollController: _scrollController,
|
||||||
scrollController: _scrollController,
|
onScrollToEnd: () {},
|
||||||
onScrollToEnd: () {},
|
communities: filteredCommunities,
|
||||||
communities: filteredCommunities,
|
itemBuilder: (context, index) {
|
||||||
itemBuilder: (context, index) {
|
if (index == filteredCommunities.length) {
|
||||||
if (index == filteredCommunities.length) {
|
final spaceTreeState = context.read<SpaceTreeBloc>().state;
|
||||||
final spaceTreeState = context.read<SpaceTreeBloc>().state;
|
if (spaceTreeState.paginationIsLoading) {
|
||||||
if (spaceTreeState.paginationIsLoading) {
|
return const Padding(
|
||||||
return const Padding(
|
padding: EdgeInsets.all(8.0),
|
||||||
padding: EdgeInsets.all(8.0),
|
child: Center(child: CircularProgressIndicator()),
|
||||||
child: Center(child: CircularProgressIndicator()),
|
);
|
||||||
);
|
} else {
|
||||||
} else {
|
return const SizedBox.shrink();
|
||||||
return const SizedBox.shrink();
|
}
|
||||||
}
|
}
|
||||||
}
|
return _buildCommunityTile(context, filteredCommunities[index]);
|
||||||
return _buildCommunityTile(context, filteredCommunities[index]);
|
}),
|
||||||
},
|
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
if (spaceTreeState.paginationIsLoading || spaceTreeState.isSearching)
|
|
||||||
Center(
|
|
||||||
child: CircularProgressIndicator(),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:syncrow_web/pages/access_management/view/access_management.dart';
|
import 'package:syncrow_web/pages/access_management/view/access_management.dart';
|
||||||
|
import 'package:syncrow_web/pages/analytics/modules/analytics/views/analytics_page.dart';
|
||||||
import 'package:syncrow_web/pages/auth/view/login_page.dart';
|
import 'package:syncrow_web/pages/auth/view/login_page.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/all_devices/view/device_managment_page.dart';
|
import 'package:syncrow_web/pages/device_managment/all_devices/view/device_managment_page.dart';
|
||||||
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
import 'package:syncrow_web/pages/home/view/home_page.dart';
|
||||||
@ -37,6 +38,11 @@ class AppRoutes {
|
|||||||
GoRoute(
|
GoRoute(
|
||||||
path: RoutesConst.rolesAndPermissions,
|
path: RoutesConst.rolesAndPermissions,
|
||||||
builder: (context, state) => const RolesAndPermissionPage()),
|
builder: (context, state) => const RolesAndPermissionPage()),
|
||||||
|
GoRoute(
|
||||||
|
path: RoutesConst.analytics,
|
||||||
|
name: 'analytics',
|
||||||
|
builder: (context, state) => const AnalyticsPage(),
|
||||||
|
),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,4 +6,5 @@ class RoutesConst {
|
|||||||
static const String deviceManagementPage = '/device-management-page';
|
static const String deviceManagementPage = '/device-management-page';
|
||||||
static const String spacesManagementPage = '/spaces_management-page';
|
static const String spacesManagementPage = '/spaces_management-page';
|
||||||
static const String rolesAndPermissions = '/roles_and_Permissions-page';
|
static const String rolesAndPermissions = '/roles_and_Permissions-page';
|
||||||
|
static const String analytics = '/syncrow_analytics';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user