flutter: Bug? only FlatButton but not CupertinoButton showing Text

694 Views Asked by At

Did you ever experience this? Does it make sense to register this as a bug and how would I do this?

For one of my screens I have now this situation for the 2nd time: I insert a CupertinoButton with Text as a child, however, the text does not show up. In the 1st occurrence, 2 pixels of text appeared to be rendered (I saw 2 dots). I have also copied a CupertinoButton from another line and left it unchanged. No change, text does not appear. If I then only change the widget name from CupertinoButton to FlatButton (leaving everything else untouched), the text appears.

Since CupertinoButtons are typically working for me, I guess I would have to submit the whole project for a bug report, since isolating the issue does not to be appear like a straight forward job.

1

There are 1 best solutions below

2
On BEST ANSWER

Please consider adding padding like this:

         CupertinoButton(
              padding: EdgeInsets.symmetric(vertical: 0, horizontal: 5),
              color: Colors.blue,
              borderRadius: BorderRadius.all(Radius.circular(12)),
              child: Text(
                'Login',
                style: TextStyle(
                    fontSize: 16,
                    fontWeight: FontWeight.bold,
                    color: Colors.white),
              ),
              onPressed: () => {},
            ),