flet-rive 0.1.0.dev1__py3-none-any.whl → 0.2.0.dev30__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of flet-rive might be problematic. Click here for more details.
- flet_rive/__init__.py +1 -1
- flet_rive/rive.py +77 -184
- flet_rive-0.2.0.dev30.dist-info/METADATA +62 -0
- flet_rive-0.2.0.dev30.dist-info/RECORD +16 -0
- {flet_rive-0.1.0.dev1.dist-info → flet_rive-0.2.0.dev30.dist-info}/WHEEL +1 -1
- flet_rive-0.2.0.dev30.dist-info/licenses/LICENSE +201 -0
- flutter/flet_rive/CHANGELOG.md +4 -0
- flutter/flet_rive/lib/flet_rive.dart +1 -1
- flutter/flet_rive/lib/src/extension.dart +16 -0
- flutter/flet_rive/lib/src/rive.dart +52 -57
- flutter/flet_rive/pubspec.lock +167 -118
- flutter/flet_rive/pubspec.yaml +7 -2
- flet_rive-0.1.0.dev1.dist-info/METADATA +0 -42
- flet_rive-0.1.0.dev1.dist-info/RECORD +0 -15
- flutter/flet_rive/lib/src/create_control.dart +0 -22
- {flet_rive-0.1.0.dev1.dist-info → flet_rive-0.2.0.dev30.dist-info}/top_level.txt +0 -0
|
@@ -3,78 +3,73 @@ import 'package:flutter/widgets.dart';
|
|
|
3
3
|
import 'package:rive/rive.dart';
|
|
4
4
|
|
|
5
5
|
class RiveControl extends StatefulWidget {
|
|
6
|
-
final Control? parent;
|
|
7
6
|
final Control control;
|
|
8
|
-
final List<Control> children;
|
|
9
|
-
final bool parentDisabled;
|
|
10
|
-
final bool? parentAdaptive;
|
|
11
|
-
final FletControlBackend backend;
|
|
12
7
|
|
|
13
|
-
const RiveControl(
|
|
14
|
-
{super.key,
|
|
15
|
-
required this.parent,
|
|
16
|
-
required this.control,
|
|
17
|
-
required this.children,
|
|
18
|
-
required this.parentDisabled,
|
|
19
|
-
required this.parentAdaptive,
|
|
20
|
-
required this.backend});
|
|
8
|
+
const RiveControl({super.key, required this.control});
|
|
21
9
|
|
|
22
10
|
@override
|
|
23
11
|
State<RiveControl> createState() => _RiveControlState();
|
|
24
12
|
}
|
|
25
13
|
|
|
26
|
-
class _RiveControlState extends State<RiveControl>
|
|
14
|
+
class _RiveControlState extends State<RiveControl> {
|
|
27
15
|
@override
|
|
28
16
|
Widget build(BuildContext context) {
|
|
29
17
|
debugPrint("Rive build: ${widget.control.id} (${widget.control.hashCode})");
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
var src = widget.control.attrString("src", "")!;
|
|
34
|
-
if (src == "") {
|
|
18
|
+
var src = widget.control.getString("src");
|
|
19
|
+
if (src == null) {
|
|
35
20
|
return const ErrorControl("Rive must have \"src\" specified.");
|
|
36
21
|
}
|
|
37
22
|
|
|
38
|
-
var artBoard = widget.control.
|
|
39
|
-
var antiAliasing = widget.control.
|
|
40
|
-
var useArtBoardSize = widget.control.
|
|
41
|
-
var fit =
|
|
42
|
-
var alignment =
|
|
43
|
-
var
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
23
|
+
var artBoard = widget.control.getString("art_board");
|
|
24
|
+
var antiAliasing = widget.control.getBool("enable_anti_aliasing", true)!;
|
|
25
|
+
var useArtBoardSize = widget.control.getBool("use_art_board_size", false)!;
|
|
26
|
+
var fit = widget.control.getBoxFit("fit");
|
|
27
|
+
var alignment = widget.control.getAlignment("alignment");
|
|
28
|
+
var placeholder = widget.control.buildWidget("placeholder");
|
|
29
|
+
var speedMultiplier = widget.control.getDouble("speed_multiplier", 1)!;
|
|
30
|
+
var animations = widget.control.get<List<String>>("animations", const [])!;
|
|
31
|
+
var stateMachines =
|
|
32
|
+
widget.control.get<List<String>>("state_machines", const [])!;
|
|
33
|
+
var headers = widget.control.get("headers")?.cast<String, String>();
|
|
34
|
+
var clipRect = widget.control.getRect("clip_rect");
|
|
47
35
|
|
|
48
|
-
|
|
49
|
-
Widget? rive;
|
|
36
|
+
Widget? rive;
|
|
50
37
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
38
|
+
var assetSrc = widget.control.backend.getAssetSource(src);
|
|
39
|
+
if (assetSrc.isFile) {
|
|
40
|
+
// Local File
|
|
41
|
+
rive = RiveAnimation.file(
|
|
42
|
+
assetSrc.path,
|
|
43
|
+
artboard: artBoard,
|
|
44
|
+
fit: fit,
|
|
45
|
+
antialiasing: antiAliasing,
|
|
46
|
+
useArtboardSize: useArtBoardSize,
|
|
47
|
+
alignment: alignment,
|
|
48
|
+
placeHolder: placeholder,
|
|
49
|
+
speedMultiplier: speedMultiplier,
|
|
50
|
+
animations: animations,
|
|
51
|
+
stateMachines: stateMachines,
|
|
52
|
+
clipRect: clipRect,
|
|
53
|
+
);
|
|
54
|
+
} else {
|
|
55
|
+
// URL
|
|
56
|
+
rive = RiveAnimation.network(
|
|
57
|
+
assetSrc.path,
|
|
58
|
+
fit: fit,
|
|
59
|
+
artboard: artBoard,
|
|
60
|
+
alignment: alignment,
|
|
61
|
+
antialiasing: antiAliasing,
|
|
62
|
+
useArtboardSize: useArtBoardSize,
|
|
63
|
+
placeHolder: placeholder,
|
|
64
|
+
speedMultiplier: speedMultiplier,
|
|
65
|
+
animations: animations,
|
|
66
|
+
stateMachines: stateMachines,
|
|
67
|
+
headers: headers,
|
|
68
|
+
clipRect: clipRect,
|
|
69
|
+
// onInit: _onInit,
|
|
70
|
+
);
|
|
71
|
+
}
|
|
76
72
|
|
|
77
|
-
|
|
78
|
-
});
|
|
73
|
+
return ConstrainedControl(control: widget.control, child: rive);
|
|
79
74
|
}
|
|
80
75
|
}
|