From 87e9d715dd714124f61fbc9f2956656ff1a4ab72 Mon Sep 17 00:00:00 2001 From: Osman Date: Wed, 28 Feb 2024 13:51:58 +0000 Subject: [PATCH] Remove fixed with for progress bar --- .../pages/components/progress_example.dart | 15 +++--- lib/src/components/progress/progress_bar.dart | 53 +++++++++---------- 2 files changed, 34 insertions(+), 34 deletions(-) diff --git a/example/lib/pages/components/progress_example.dart b/example/lib/pages/components/progress_example.dart index 11ddae85..69b31456 100644 --- a/example/lib/pages/components/progress_example.dart +++ b/example/lib/pages/components/progress_example.dart @@ -103,12 +103,15 @@ class _WrapperState extends State { return Column( // Replace with a Column for vertical children: [ - ProgressBar( - progress: progress, - border: widget.border, - type: type, - weight: widget.weight, - label: widget.label), + SizedBox( + width: 400, + child: ProgressBar( + progress: progress, + border: widget.border, + type: type, + weight: widget.weight, + label: widget.label), + ), const SizedBox(width: 40), Row( mainAxisAlignment: MainAxisAlignment.center, diff --git a/lib/src/components/progress/progress_bar.dart b/lib/src/components/progress/progress_bar.dart index 38b3e262..488ed621 100644 --- a/lib/src/components/progress/progress_bar.dart +++ b/lib/src/components/progress/progress_bar.dart @@ -93,37 +93,34 @@ class ProgressBar extends Progress { class _ProgressBarState extends ProgressState { @override Widget build(BuildContext context) { - return SizedBox( - width: 400, - child: Column( - children: [ - if (widget.label != null) - SizedBox( - child: Text( - widget.label!, - textAlign: TextAlign.start, - ), + return Column( + children: [ + if (widget.label != null) + SizedBox( + child: Text( + widget.label!, + textAlign: TextAlign.start, ), - Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ - Expanded( - child: AnimatedContainer( - duration: const Duration(milliseconds: 500), - height: _weight(), - child: LinearProgressIndicator( - borderRadius: _border(), - value: widget.type == BarType.indeterminate - ? null - : animation.value, - backgroundColor: widget.type == BarType.buffering - ? const Color.fromRGBO(224, 227, 233, 1) - : Colors.transparent, - ), + ), + Row(crossAxisAlignment: CrossAxisAlignment.start, children: [ + Expanded( + child: AnimatedContainer( + duration: const Duration(milliseconds: 500), + height: _weight(), + child: LinearProgressIndicator( + borderRadius: _border(), + value: widget.type == BarType.indeterminate + ? null + : animation.value, + backgroundColor: widget.type == BarType.buffering + ? const Color.fromRGBO(224, 227, 233, 1) + : Colors.transparent, ), ), - _extraWidgets(), - ]) - ], - ), + ), + _extraWidgets(), + ]) + ], ); }