Skip to content

Commit

Permalink
Fix for bdlukaa#83
Browse files Browse the repository at this point in the history
  • Loading branch information
bdlukaa committed Oct 20, 2021
1 parent 6cc0b20 commit a3c6301
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Date format: DD/MM/YYYY

## [3.3.0] - [DD/10/2021]
## [3.3.1] - [20/10/2021]

- `ProgressRing` now spins on the correct direction ([#83](https://github.com/bdlukaa/fluent_ui/issues/83))
- Added the `backwards` property to `ProgressRing`

## [3.3.0] - [12/10/2021]

- Back button now isn't forced when using top navigation mode ([#74](https://github.com/bdlukaa/fluent_ui/issues/74))
- `PilButtonBar` now accept 2 items ([#66](https://github.com/bdlukaa/fluent_ui/issues/66))
Expand Down
8 changes: 8 additions & 0 deletions example/lib/screens/others.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,14 @@ class _OthersState extends State<Others> {
padding: EdgeInsets.all(10),
child: ProgressRing(value: 85),
),
Padding(
padding: EdgeInsets.all(6),
child: ProgressBar(),
),
Padding(
padding: EdgeInsets.all(10),
child: ProgressRing(),
),
]),
// Row(children: [
// CalendarView(
Expand Down
10 changes: 9 additions & 1 deletion lib/src/controls/surfaces/progress_indicators.dart
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class ProgressRing extends StatefulWidget {
this.semanticLabel,
this.backgroundColor,
this.activeColor,
this.backwards = false,
}) : assert(value == null || value >= 0 && value <= 100),
super(key: key);

Expand All @@ -291,6 +292,9 @@ class ProgressRing extends StatefulWidget {
/// [ThemeData.accentColor] is used
final Color? activeColor;

/// Whether the indicator spins backwards or not. Defaults to false
final bool backwards;

@override
_ProgressRingState createState() => _ProgressRingState();

Expand Down Expand Up @@ -368,6 +372,7 @@ class _ProgressRingState extends State<ProgressRing>
lowSpeed = v[2];
highSpeed = v[3];
},
backwards: widget.backwards,
),
);
},
Expand All @@ -384,6 +389,7 @@ class _ProgressRingState extends State<ProgressRing>
lowSpeed: lowSpeed,
highSpeed: highSpeed,
onUpdate: (v) {},
backwards: widget.backwards,
),
);
}(),
Expand All @@ -399,6 +405,7 @@ class _RingPainter extends CustomPainter {
final double? value;
final double d1, d2, lowSpeed, highSpeed;
final ValueChanged onUpdate;
final bool backwards;

const _RingPainter({
required this.color,
Expand All @@ -410,6 +417,7 @@ class _RingPainter extends CustomPainter {
required this.lowSpeed,
required this.highSpeed,
required this.onUpdate,
required this.backwards,
});

static const double _twoPi = math.pi * 2.0;
Expand Down Expand Up @@ -443,7 +451,7 @@ class _RingPainter extends CustomPainter {
void drawArc() {
canvas.drawArc(
Offset.zero & size,
(90 - d2) * _deg2Rad,
(backwards ? (90 - d2) : (90 + d2)) * _deg2Rad,
((d2 - d1) * _deg2Rad),
false,
paint,
Expand Down

0 comments on commit a3c6301

Please sign in to comment.