container height and textfield hight match in flutter

50 views Asked by At

in this code when resizable container drag the textfield yellow color size also increase with container. when drag container size increase and textfiled size also increse but both not same increase see the image. in this code when resizable container drag the textfield size also increase with container. when drag container size increase and textfiled size also increse but both not same increase see the image.

child: Container(
                    height: height,
                    width: width,

                    decoration: _isSelected ? BoxDecoration(
                      color: Colors.transparent,
                      border: Border.all(
                        width: 2,
                        color: Colors.black,
                      ),
                    ) : null,
                    child: Center(
                      child:
                      TextField(
                        // focusNode: _focusNode,
                        key: textFieldKey,
                        controller: textController,
                        style: TextStyle(color: Colors.black, fontSize: fontSize),
                        decoration: InputDecoration(
                          isDense: true,
                          filled: true,
                          fillColor: Colors.yellow,
                            hintText: "Enter Your Text",
                            helperStyle: TextStyle(color: Colors.black),
                            border: InputBorder.none
                        ),
                        textAlign: TextAlign.center,
                        onChanged: (text) {
                          // Update the dimensions based on the text content
                          updateDimensions();
                        },
                        onSubmitted: (text){
                          setState(() {
                            _isSelected = false;
                            // GlobalState.selectedIndex = -1;
                          });
                        },
                    ),
                  ),
                  ),

This is drag icon functionality.in this code when resizable container drag the textfield size also increase with container. when drag container size increase and textfiled size also increse but both not same increase see the image.

if(_isSelected)
  Positioned(
    top: top - ballDiameter / 2,
    left: left - ballDiameter / 2,
    child: ManipulatingBall(
      onDrag: (dx, dy) {
        var newWidth = width - (2*dx);
        var newHeight = height - (2*dx/aspectRatio);
        setState(() {
          fontSize = height / 3.57*1.5;
          print("height = $height");
          print("width = $width");
          print("fontsize = $fontSize");

          if(newHeight > 10 && newWidth > 10)
          {
            height = newHeight;
            width = newWidth;
            top = top + (dx/aspectRatio);
            left = left + dx;
          }

        });
      },
      handlerWidget: HandlerWidget.VERTICAL,
    ),
  ),

in this code when resizable container drag the textfield size also increase with container. when drag container size increase and textfiled size also increse but both not same increase see the image. in this code when resizable container drag the textfield size also increase with container. when drag container size increase and textfiled size also increse but both not same increase see the image. i add the image in this image text show on top of container not set center.

what wrong in this code

0

There are 0 answers