Merge pull request #110 from SyncrowIOT/SP-1439-FE-On-Manage-your-home-screen-the-container-height-that-has-the-spaces-is-longer-than-needed-it-should-extend-based-on-the-data-in-the-list

[FE] On Manage your home screen the container height that has the spaces is longer than needed it should extend based on the data in the list
This commit is contained in:
raf-dev1
2025-06-23 14:06:56 +03:00
committed by GitHub

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/features/app_layout/model/community_model.dart';
import 'package:syncrow_app/features/menu/view/widgets/manage_home/home_settings.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
@ -15,29 +16,37 @@ class ManageHomeView extends StatelessWidget {
Widget build(BuildContext context) {
var spaces = HomeCubit.getInstance().spaces;
return DefaultScaffold(
title: 'Manage Your Home',
height: MediaQuery.sizeOf(context).height,
title: 'Manage Your Home',
child: Align(
alignment: Alignment.topCenter,
child: spaces.isEmpty
? const Center(
child: BodyMedium(text: 'No spaces found'),
)
? const Center(child: BodyMedium(text: 'No spaces found'))
: DefaultContainer(
padding: EdgeInsets.symmetric(horizontal: 20, vertical: 25),
padding:
const EdgeInsets.symmetric(horizontal: 20, vertical: 25),
child: ListView.builder(
itemCount: spaces.length,
itemBuilder: (context, index) {
if (index == spaces.length - 1) {
return InkWell(
onTap: () {
Navigator.of(context).push(CustomPageRoute(
builder: (context) => HomeSettingsView(
space: spaces[index],
)));
},
child: Row(
shrinkWrap: true,
itemCount: spaces.length,
itemBuilder: (context, index) {
final space = spaces[index];
return InkWell(
onTap: () {
Navigator.of(context).push(
CustomPageRoute(
builder: (context) =>
HomeSettingsView(space: space),
),
);
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BodyMedium(text: StringHelpers.toTitleCase(spaces[index].name)),
BodyMedium(
text: StringHelpers.toTitleCase(space.name)),
const Icon(
Icons.arrow_forward_ios,
color: ColorsManager.greyColor,
@ -45,45 +54,19 @@ class ManageHomeView extends StatelessWidget {
)
],
),
);
}
return InkWell(
onTap: () {
//TODO refactor the routing to use named routes
// Navigator.of(context).pushNamed(
// '/home_settings',
// arguments: spaces[index],
// );
Navigator.of(context).push(CustomPageRoute(
builder: (context) => HomeSettingsView(
space: spaces[index],
)));
},
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BodyMedium(text: HomeCubit.getInstance().spaces[index].name),
const Icon(
Icons.arrow_forward_ios,
color: ColorsManager.greyColor,
size: 15,
)
],
),
if (index != spaces.length - 1)
Container(
margin: const EdgeInsets.symmetric(vertical: 15),
height: 1,
color: ColorsManager.greyColor,
),
],
),
);
}),
));
],
),
);
},
),
),
),
);
}
}