add device type comes from products

This commit is contained in:
hannathkadher
2024-11-20 20:10:39 +04:00
parent bf0dc7b56c
commit 9affae0269
11 changed files with 256 additions and 95 deletions

View File

@ -5,9 +5,11 @@ import 'package:syncrow_web/pages/spaces_management/bloc/space_management_event.
import 'package:syncrow_web/pages/spaces_management/bloc/space_management_state.dart';
import 'package:syncrow_web/pages/spaces_management/model/community_model.dart';
import 'package:syncrow_web/pages/spaces_management/model/connection_model.dart';
import 'package:syncrow_web/pages/spaces_management/model/product_model.dart';
import 'package:syncrow_web/pages/spaces_management/model/space_data_model.dart';
import 'package:syncrow_web/pages/spaces_management/model/space_model.dart';
import 'package:syncrow_web/pages/spaces_management/widgets/loaded_space_widget.dart';
import 'package:syncrow_web/services/product_api.dart';
import 'package:syncrow_web/services/space_mana_api.dart';
import 'package:syncrow_web/web_layout/web_scaffold.dart';
@ -22,11 +24,14 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
CommunityModel? selectedCommunity;
SpaceModel? selectedSpace;
final CommunitySpaceManagementApi _api = CommunitySpaceManagementApi();
final ProductApi _productApi = ProductApi();
Map<String, List<SpaceModel>> communitySpaces = {};
double canvasWidth = 1000;
double canvasHeight = 1000;
List<SpaceData> spaces = [];
List<Connection> connections = [];
List<ProductModel> products = [];
bool isProductDataLoaded = false;
@override
void initState() {
@ -37,7 +42,7 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
Widget build(BuildContext context) {
return BlocProvider(
create: (context) =>
SpaceManagementBloc(CommunitySpaceManagementApi())..add(LoadCommunityAndSpacesEvent()),
SpaceManagementBloc(_api, _productApi)..add(LoadCommunityAndSpacesEvent()),
child: WebScaffold(
appBarTitle: Text('Space Management', style: Theme.of(context).textTheme.headlineLarge),
enableMenuSidebar: false,
@ -57,6 +62,7 @@ class SpaceManagementPageState extends State<SpaceManagementPage> {
communities: state.communities,
selectedCommunity: selectedCommunity,
selectedSpace: selectedSpace,
products:state.products,
onCommunitySelected: (community) {
setState(() {
selectedCommunity = community;