ajilo297 / Flutter-Dotted-Border

A Flutter package to easily add dashed borders around widgets
https://pub.dev/packages/dotted_border
MIT License
297 stars 62 forks source link

BorderType.Circle doesn't place the child Text widget in center if the String length in 1 #14

Closed rmahmadkhan closed 3 years ago

rmahmadkhan commented 3 years ago

Hey, this issue still persists in the case of BorderType.Circle.

If we write just one letter in the Text(), it just place it outside the border.

image See code:

DottedBorder(
      borderType: BorderType.Circle,
      padding: EdgeInsets.all(15),
      child: Text('1'),
)

The same code if I change BorderType.Circle to BorderType.Oval or BorderType.Rect outputs:

image image

I solved this by wrapping DottedBorder inside SizedBox and then wrapping the Text with Center

SizedBox(
      width: 30,
      height: 30,
      child: DottedBorder(
        borderType: BorderType.Circle,
        child: Center(child: Text('1')),
      ),
)

So, here's the output now:

image

Please open this issue.

Originally posted by @rmahmadkhan in https://github.com/ajilo297/Flutter-Dotted-Border/issues/2#issuecomment-893264505