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

多个大小不一元素(两边元素小,中间元素大)居中对齐的问题 #28

Open
dshcao opened this issue May 21, 2024 · 0 comments

Comments

@dshcao
Copy link

dshcao commented May 21, 2024

ConstraintLayout(
children: [
Guideline(
id: guideline,
horizontal: true,
guidelinePercent: 0.5),
Text(
'aaa',
style: TextStyle(
color: llmType > 0
? AppColors.textLGray
: AppColors.textWhite,
fontSize: 16),
textDirection: TextDirection.ltr,
).applyConstraint(
left: parent.left, centerVerticalTo: sId(1)),
Switch(
value: llmType > 0,
onChanged: (value) {
setState(() {
value ? llmType = 1 : llmType = 0;
});
})
.applyConstraint(
left: sId(-1).right, bottom: parent.bottom),
Text(
'bbb',
style: TextStyle(
color: llmType > 0
? AppColors.textWhite
: AppColors.textLGray,
fontSize: 16),
textDirection: TextDirection.ltr,
).applyConstraint(
left: sId(-1).right, centerVerticalTo: sId(-1)),
],
) 这个好像不起作用,第一个(aaa)元素和第三个(bbb)元素高度较小,但是三个元素要求水平居中对齐,所以aaa和bbb都要要相对较大的中间元素Switch看齐(对齐)。现在这样写好像不起作用,aaa没法后一个元素Switch对齐

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