how can I extend a progress bar in a AlertDialog(fluent UI)?

247

You can replace Expanded with SizedBox by providing infinity/ specific width. Also, can be use SizedBox.fromSize.

ContentDialog(
  title: Text("title"),
  content: SizedBox(
    width: double.infinity,
    child: ProgressBar(value: 50, strokeWidth: 10),
  ),

enter image description here

Share:
247
Eduard
Author by

Eduard

Updated on January 03, 2023

Comments

  • Eduard
    Eduard over 1 year

    I would like to implement an AlertDialog using Flutter and fluent_ui for Windows. This is a progressive progress bar, so the percentage will change when some of my other code executes. My problem is that the Progress Bar does not extend until the end of the AlertDialog. Currently, the progress bar looks like below, set at progress of 50.

    Progress bar inside AlertDialog

    Edit: Below is the code I have tried

    showDialog(
          context: context,
          builder: (context) {
            return ContentDialog(
              title: Text(title),
              content: const Expanded(
                child: ProgressBar(value: 50, strokeWidth: 10),
              ),
              actions: [
                const SizedBox(),
                Button(
                    style: MyButtonStyles.dialogYes(),
                    child: const Text('OK', style: TextStyle(fontSize: 16.0)),
                    onPressed: () {
                      Navigator.pop(context);
                    }),
              ],
            );
          },
        );
    
    • MendelG
      MendelG about 2 years
      Please edit your question to show the code you have already tried
    • Eduard
      Eduard about 2 years
      I've added the code to the question.