если значения customeHeight и customeWidth изменяются, то дочернее значение также должно измениться.В то же время размер текста должен соответствовать размеру и высоте родительского контейнера.
fontSize должен увеличиваться и уменьшаться.
// Родительский класс
Padding(
padding:
EdgeInsets.only(left: 60.0, top: 60.0, right: 20.0, bottom: 20.0),
child: Container(
height: customeHeight,
width: customeWidth,
child: widget.child,
decoration: BoxDecoration(
border: Border.all(color: Colors.red, width: 4.0),
borderRadius: BorderRadius.circular(2.0),
)
),
),
===============================================================================
// дочерний класс // это вернётся как дочерний элемент к своему родителю
return LayoutBuilder(
builder: (BuildContext context, BoxConstraints constraints) {
print("container size $constraints");
print("no of character $noOfChar");
// double maxSize =
// (constraints.maxWidth * constraints.maxHeight) / 3000;
// print("maxsize $maxSize");
return FittedBox(
fit: BoxFit.contain,
child: LimitedBox(
maxHeight: constraints.maxHeight + noOfChar,
maxWidth: constraints.maxWidth + noOfChar,
child: TextField(
keyboardType: TextInputType.multiline,
// maxLines: null,
onChanged: (str) {
setState(() {
noOfChar = str.length;
});
},
autofocus: true,
enabled: true,
// focusNode: myFocusNode,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 30.0,
color: const Color(0xFF000000),
fontWeight: FontWeight.bold,
fontStyle: FontStyle.italic,
fontFamily: widget.fontType),
decoration: new InputDecoration.collapsed(
hintText: widget.change),
),
),
);
})