mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-08-26 06:49:39 +00:00
using Align to keep the container stick with elemnts number (tested for many items)
This commit is contained in:
@ -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,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}),
|
||||
));
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user