Widget buildNumEditRenewalAmount(String title, String? content,
{double? titleW = 100, bool needBotLine = true, TextEditingController? controller, ValueChanged<String>? onChanged, String hint = '请输入数量'}) {
if (content != null&&content.length>0) {
controller = TextEditingController.fromValue(TextEditingValue(
// 设置内容
text: content??'',
// 保持光标在最后
selection: TextSelection.fromPosition(TextPosition(
affinity: TextAffinity.downstream,
offset: content!.length)))
);
// controller?.text = content;
}
return Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.symmetric(horizontal: 15.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
if (titleW == null) Text('$title}', style: YYTStyle.ts_333_14),
if (titleW != null)
Container(
width: titleW,
child: Text('$title', style: YYTStyle.ts_333_14),
),
SizedBox(width: 10),
Expanded(
child: TextField(
enabled: type == "2" ? false : true,
inputFormatters: [FilteringTextInputFormatter.deny(RegExp(Config.REGEX_EMOJI)), FilteringTextInputFormatter.digitsOnly],
onChanged: onChanged,
textAlign: TextAlign.right,
style: TextStyle(fontSize: 13),
controller: controller,
maxLength: 8,
decoration: InputDecoration(
hintText: hint, hintStyle: TextStyle(color: YYWidget.lightColor, fontSize: 13), border: InputBorder.none, counterText: ''),
),
),
],
),
),
if (needBotLine) Divider(height: 8.0),
],
);
}