flutter基于一个最小尺寸,允许组件的高度根据其内容自动调整,以避免内容溢出或不必要的滚动: IntrinsicWidth

 Row(
      children: [
        Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text(title,style: TextStyle(fontSize: 28.sp,fontWeight: FontWeight.w600),),
            SizedBox(height: 4.w),
            Text(desc,style: TextStyle(color:JadeColors.grey,fontSize: 22.sp),)
          ],
        ),
        Expanded(child: GestureDetector(
          child: Container(color: Colors.white,),
          onTap: (){
            FocusScope.of(context).requestFocus(focusNode);
          },
        )),
        if(editingController == logic.state.expectAmountController)
        Container(
          padding: EdgeInsets.only(bottom: 10.w),
          child: Text('¥',style: TextStyle(fontSize: 28.sp,color: JadeColors.grey,),),
        ),
        ConstrainedBox(
          constraints: BoxConstraints(minWidth: 20.w,maxWidth: Utils().screenWidth(context)*0.4),
          child: IntrinsicWidth(
            child: TextField(
              textAlign: TextAlign.right,
              controller: editingController,
              focusNode: focusNode,
              style: TextStyle(
                  fontSize: 30.sp,
                  color: JadeColors.grey_2,
                  fontWeight: FontWeight.w600),
              keyboardType: TextInputType.number,
              textInputAction: TextInputAction.next,
              maxLines: 1,
              decoration: InputDecoration(
                filled: true,
                fillColor: Colors.white,
                contentPadding: EdgeInsets.only(
                    left: 4.w, right: 4.w, top: 10.w,bottom: 10.w),
                alignLabelWithHint: false,
                border: OutlineInputBorder(
                    borderSide: BorderSide.none,
                    borderRadius: BorderRadius.circular(8.w)),
                focusedBorder: OutlineInputBorder(
                    borderSide: BorderSide.none,
                    borderRadius: BorderRadius.circular(8.w)),
              ),
              inputFormatters: [
                editingController == logic.state.expectPeopleController
                    ? FilteringTextInputFormatter(RegExp("[0-9]"), allow: true)
                    : FilteringTextInputFormatter.allow(RegExp(r'^\d*\.?\d{0,2}$'))
              ],
              cursorColor: JadeColors.grey,
              onChanged: (value){
                logic.countExpectAmount();
              },
              onEditingComplete: () {},
            ),
          ),
        ),
        if(editingController == logic.state.expectPeopleController)
          Container(
            padding: EdgeInsets.only(right: 10.w,bottom: 10.w),
            child: Text('${S.current.ren1}',style: TextStyle(fontSize: 28.sp,color: JadeColors.grey_2,),),
          ),
        Container(
          child: Image.asset(
            'images/my/option/shezhi_jiantou.png',
            color: Color(0xffa3a3a3),
            height: 13,
            width: 7,
          ),
        )
      ],
    )
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值