Home > Software engineering >  how can I extend a progress bar in a AlertDialog(fluent UI)?
how can I extend a progress bar in a AlertDialog(fluent UI)?

Time:03-06

I would like to implement an AlertDialog using Flutter and 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);
                }),
          ],
        );
      },
    );

CodePudding user response:

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

  • Related