Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: alignment inside cells. #98

Open
vd3d opened this issue Nov 11, 2023 · 1 comment
Open

Feature request: alignment inside cells. #98

vd3d opened this issue Nov 11, 2023 · 1 comment

Comments

@vd3d
Copy link

vd3d commented Nov 11, 2023

Hi,

I propose you to add a missing feature which is the alignment inside a cell. currently, if you have multiple cells of different heights
then the "content" is aligned on the top. To manage the alignment, we have to play with other components, but it will
be way better if we can set up the alignment in the GridPlacement.

Here is an example, on the left you have the text "Volume" which I have aligned with other components, on the right you have the
test "USD" which is put on the top of the cell by the LayoutGrid.

image

One idea would be to add some alignment parameters to the GridPlacement. Like this:

AlignmentGeometry? alignment

PS: and thanks for this fantastic layout.

@vd3d
Copy link
Author

vd3d commented Nov 11, 2023

BTW, I have created a sub-class of GridPlacement that does the job. It is a hack but it works.
It is not a clean solution, but still... it do the job ;-)

class LayoutGridPlacement extends GridPlacement {
LayoutGridPlacement({
super.key,
required Widget child,
super.columnStart,
super.columnSpan = 1,
super.rowStart,
super.rowSpan = 1,
AlignmentGeometry? alignment,
}) : super(child: _getChild(child, alignment)) {
//super(child: content);
}
static Widget _getChild(Widget content, AlignmentGeometry? alignment) {
if (alignment == null) alignment = Alignment.centerLeft;
return Container(alignment: alignment, child: content);
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant