1

I am trying to increase my button bar buttons' width so I used buttonMinWidth, but for some reason it isn't working, here's my code:

ButtonBar(
  children: [
    TextButton.icon(
      onPressed: null,
      icon: const Icon(
        Icons.replay,
        color: Colors.red,
      ),
      label: const Text(
        "Retry",
        style: TextStyle(color: Colors.red),
      ),
    ),
    TextButton.icon(
      onPressed: null,
      icon: const Icon(
        Icons.replay,
        color: Colors.green,
      ),
      label: const Text(
        "Continue",
        style: TextStyle(color: Colors.green),
      ),
    ),
  ],
  buttonMinWidth: 100,
),

It's probably simple but I can't seem to find the problem.

Zavier Xx
  • 45
  • 6

1 Answers1

0

You can wrap ButtonBar widget with SizedBox widget and you can give width. but i don't this is the best solution but this will solve your problem.

    SizedBox(
      width: 300,
      child: ButtonBar(
        children: [
          TextButton.icon(
            onPressed: null,
            icon: const Icon(
              Icons.replay,
              color: Colors.red,
            ),
            label: const Text(
              "Retry",
              style: TextStyle(color: Colors.red),
            ),
          ),
          TextButton.icon(
            onPressed: null,
            icon: const Icon(
              Icons.replay,
              color: Colors.green,
            ),
            label: const Text(
              "Continue",
              style: TextStyle(color: Colors.green),
            ),
          ),
        ],
      ),
    ),
MSARKrish
  • 3,355
  • 4
  • 30
  • 43