diff --git a/.rive_head b/.rive_head index bb2edbd..06a46dd 100644 --- a/.rive_head +++ b/.rive_head @@ -1 +1 @@ -ad4236501bdf0218046a93c54f2ee4a379747890 +a91b1b7647965149bd1b7894fa428f189e57f653 diff --git a/lib/src/rive_core/solo.dart b/lib/src/rive_core/solo.dart index fef0b94..790031f 100644 --- a/lib/src/rive_core/solo.dart +++ b/lib/src/rive_core/solo.dart @@ -1,5 +1,6 @@ import 'package:rive/src/generated/solo_base.dart'; import 'package:rive/src/rive_core/component.dart'; +import 'package:rive/src/rive_core/constraints/constraint.dart'; import 'package:rive/src/rive_core/container_component.dart'; export 'package:rive/src/generated/solo_base.dart'; @@ -24,6 +25,9 @@ class Solo extends SoloBase { @override void propagateCollapseToChildren(bool collapse) { for (final child in children) { + if (child is Constraint) { + continue; + } child.propagateCollapse(collapse || child != _activeComponent); } } diff --git a/test/assets/events_on_states.riv b/test/assets/events_on_states.riv index 8e66032..ea95f1c 100644 Binary files a/test/assets/events_on_states.riv and b/test/assets/events_on_states.riv differ diff --git a/test/assets/follow_path_solos.riv b/test/assets/follow_path_solos.riv new file mode 100644 index 0000000..68f1439 Binary files /dev/null and b/test/assets/follow_path_solos.riv differ diff --git a/test/goldens/follow_path/golden_follow_path_solos_test.dart b/test/goldens/follow_path/golden_follow_path_solos_test.dart new file mode 100644 index 0000000..1c1b3df --- /dev/null +++ b/test/goldens/follow_path/golden_follow_path_solos_test.dart @@ -0,0 +1,59 @@ +import 'package:flutter_test/flutter_test.dart'; +import 'package:rive/rive.dart'; + +import '../../src/utils.dart'; +import '../golden_comparator.dart'; + +void main() { + group('Golden - follow path solo tests', () { + testWidgets('Follow path over time', (WidgetTester tester) async { + final riveBytes = loadFile('assets/follow_path_solos.riv'); + final file = RiveFile.import(riveBytes); + late Artboard artboard; + + final widget = RiveAnimation.direct( + file, + stateMachines: const ['State Machine 1'], + onInit: (a) { + artboard = a; + }, + ); + await tester.pumpWidget(widget); + + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'follow_path_solos_01.png', + reason: 'Follow path should work as animation advances', + ); + + artboard.advance(1.0, nested: true); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'follow_path_solos_02.png', + reason: 'Follow path should work as animation advances', + ); + + artboard.advance(1.5, nested: true); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'follow_path_solos_03.png', + reason: 'Follow path should work as animation advances', + ); + + artboard.advance(1.0, nested: true); + await tester.pump(); + + await expectGoldenMatches( + find.byType(RiveAnimation), + 'follow_path_solos_04.png', + reason: 'Follow path should work as animation advances', + ); + }); + }); +} diff --git a/test/goldens/follow_path/images/follow_path_solos_01.png b/test/goldens/follow_path/images/follow_path_solos_01.png new file mode 100644 index 0000000..aeb29a8 Binary files /dev/null and b/test/goldens/follow_path/images/follow_path_solos_01.png differ diff --git a/test/goldens/follow_path/images/follow_path_solos_02.png b/test/goldens/follow_path/images/follow_path_solos_02.png new file mode 100644 index 0000000..44275d8 Binary files /dev/null and b/test/goldens/follow_path/images/follow_path_solos_02.png differ diff --git a/test/goldens/follow_path/images/follow_path_solos_03.png b/test/goldens/follow_path/images/follow_path_solos_03.png new file mode 100644 index 0000000..46a76a0 Binary files /dev/null and b/test/goldens/follow_path/images/follow_path_solos_03.png differ diff --git a/test/goldens/follow_path/images/follow_path_solos_04.png b/test/goldens/follow_path/images/follow_path_solos_04.png new file mode 100644 index 0000000..80bb414 Binary files /dev/null and b/test/goldens/follow_path/images/follow_path_solos_04.png differ