Flutter_ConstraintLayout icon indicating copy to clipboard operation
Flutter_ConstraintLayout copied to clipboard

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

Open dshcao opened this issue 9 months ago • 0 comments

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对齐

dshcao avatar May 21 '24 04:05 dshcao