-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Expand file tree
/
Copy pathprogress_ring.dart
More file actions
40 lines (33 loc) · 1007 Bytes
/
progress_ring.dart
File metadata and controls
40 lines (33 loc) · 1007 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright 2025 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:jaspr/jaspr.dart';
import 'package:jaspr_content/jaspr_content.dart';
import 'client/progress_ring.dart';
class ProgressRing extends CustomComponentBase {
const ProgressRing();
@override
Pattern get pattern => RegExp('ProgressRing', caseSensitive: false);
@override
Component apply(
String name,
Map<String, String> attributes,
Component? child,
) {
final progress = double.tryParse(attributes['progress'] ?? '') ?? 0.0;
assert(
progress >= 0.0 && progress <= 1.0,
'ProgressRing progress must be between 0.0 and 1.0',
);
final small = attributes['small'] != null;
final large = attributes['large'] != null;
return InteractiveProgressRing(
progress: progress,
size: small
? 24
: large
? 48
: 32,
);
}
}