Skip to content

求助约束问题 #30

Open
Open
@zyxcoder

Description

@zyxcoder

import 'package:flutter/material.dart';
import 'package:flutter_constraintlayout/flutter_constraintlayout.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:hexcolor/hexcolor.dart';

class PlanItem extends StatefulWidget {
const PlanItem({super.key});

@OverRide
State createState() => _PlanItemState();
}

class _PlanItemState extends State {
ConstraintId tagId = ConstraintId('tag_id');
ConstraintId companyId = ConstraintId('company_id');

@OverRide
Widget build(BuildContext context) {
return ConstraintLayout(
children: [
Constrained(
child: Container(
decoration: BoxDecoration(
color: Colors.blueGrey,
borderRadius: BorderRadius.all(Radius.circular(10.r))),
),
constraint: Constraint(size: matchParent)),
Container(
decoration: BoxDecoration(
color: HexColor('#33FD8515'),
borderRadius: BorderRadius.only(
topRight: Radius.circular(10.r),
bottomLeft: Radius.circular(10.r))),
child: Padding(
padding: EdgeInsets.symmetric(vertical: 3.h, horizontal: 14.w),
child: Text(
'大宗',
style: TextStyle(color: HexColor('#FD8515'), fontSize: 12.sp),
)),
).applyConstraint(id: tagId, topRightTo: parent),
Text(
'HHHHHHHHHHHHHHAAAAAAAAAAAAAAAAAAAAAAAAAAAAZZZZZZZZZZZZZZZCCCCCC',
style: TextStyle(color: HexColor('#333333'), fontSize: 32.sp),
).applyConstraint(
id: companyId,
top: parent.top,
left: parent.left,
right: tagId.left,
width: matchConstraint),
],
);
}
}
为什么我的companyId空间高度被截取了一部分,展示不全。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions