Home > Software design >  Why can't I increase my button width inside flutter buttonbar?
Why can't I increase my button width inside flutter buttonbar?

Time:04-09

I want to increase the width of my buttons so they take the whole screen, but buttonMinWidth isn't working,

here is 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,
),

I previously tried to increase the width of the button bar using sized box, but it didn't work.

CodePudding user response:

Hello Please Check with Below Code Hope it's work for you Let me know if you have any query

ButtonBar(
      alignment: MainAxisAlignment.spaceBetween,
      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),
          ),
        ),
      ],
    ),
  • Related