diff --git a/lib/features/menu/view/widgets/manage_home/manage_home_view.dart b/lib/features/menu/view/widgets/manage_home/manage_home_view.dart index d25f419..47122c0 100644 --- a/lib/features/menu/view/widgets/manage_home/manage_home_view.dart +++ b/lib/features/menu/view/widgets/manage_home/manage_home_view.dart @@ -16,85 +16,74 @@ class ManageHomeView extends StatelessWidget { var spaces = HomeCubit.getInstance().spaces; return DefaultScaffold( title: 'Manage Your Home', - child: spaces == null + height: MediaQuery.sizeOf(context).height, + child: spaces.isEmpty ? const Center( child: BodyMedium(text: 'No spaces found'), ) - : Column( - children: [ - DefaultContainer( - padding: const EdgeInsets.symmetric( - horizontal: 25, - vertical: 20, - ), - child: Column( - mainAxisSize: MainAxisSize.min, - mainAxisAlignment: MainAxisAlignment.start, - children: List.generate( - spaces.length, - (index) { - if (index == spaces.length - 1) { - return InkWell( - onTap: () { - Navigator.of(context).push(CustomPageRoute( - builder: (context) => HomeSettingsView( - space: spaces[index], - ))); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - BodyMedium(text: StringHelpers.toTitleCase(spaces[index].name)), - const Icon( - Icons.arrow_forward_ios, - color: ColorsManager.greyColor, - size: 15, - ) - ], - ), - ); - } - return InkWell( - onTap: () { - //TODO refactor the routing to use named routes - // Navigator.of(context).pushNamed( - // '/home_settings', - // arguments: spaces[index], - // ); + : DefaultContainer( + padding: 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( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + BodyMedium(text: StringHelpers.toTitleCase(spaces[index].name)), + const Icon( + Icons.arrow_forward_ios, + color: ColorsManager.greyColor, + size: 15, + ) + ], + ), + ); + } + 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, + 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: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - BodyMedium(text: HomeCubit.getInstance().spaces![index].name), - const Icon( - Icons.arrow_forward_ios, - color: ColorsManager.greyColor, - size: 15, - ) - ], - ), - Container( - margin: const EdgeInsets.symmetric(vertical: 15), - height: 1, + BodyMedium(text: HomeCubit.getInstance().spaces[index].name), + const Icon( + Icons.arrow_forward_ios, color: ColorsManager.greyColor, - ), + size: 15, + ) ], ), - ); - }, - ), - ), - ), - ], + Container( + margin: const EdgeInsets.symmetric(vertical: 15), + height: 1, + color: ColorsManager.greyColor, + ), + ], + ), + ); + }), )); } }