diff --git a/demo/ios/Runner.xcodeproj/project.pbxproj b/demo/ios/Runner.xcodeproj/project.pbxproj index 9567c3d..0a73ba1 100644 --- a/demo/ios/Runner.xcodeproj/project.pbxproj +++ b/demo/ios/Runner.xcodeproj/project.pbxproj @@ -169,7 +169,7 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; - LastUpgradeCheck = 1430; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 331C8080294A63A400263BE5 = { diff --git a/demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 87131a0..8e3ca5d 100644 --- a/demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/demo/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ ? onChanged; @@ -66,29 +69,35 @@ class RemixCheckbox extends StatelessWidget { Widget build(BuildContext context) { return MixBuilder( style: $defaultCheckboxStyle.applyVariant( - checked ? CheckboxState.checked : CheckboxState.unchecked, + value ? CheckboxState.checked : CheckboxState.unchecked, ), builder: (mix) { final spec = CheckboxSpec.of(mix); - + final duration = mix.animation?.duration ?? Duration.zero; + final curve = mix.animation?.curve ?? Curves.linear; return Pressable( onPress: - onChanged == null || disabled ? null : () => onChanged!(!checked), + onChanged == null || disabled ? null : () => onChanged!(!value), child: MixedFlex( spec: spec.flexContainer, direction: Axis.horizontal, children: [ - MixedBox( + AnimatedMixedBox( spec: spec.innerContainer, - child: MixedIcon( - checked ? iconChecked : iconUnchecked, + duration: duration, + child: AnimatedMixedIcon( + icon: value ? iconChecked : iconUnchecked, spec: spec.icon, + duration: duration, + curve: curve, ), ), if (label != null) - MixedText( + AnimatedMixedText( text: label!, spec: spec.label, + duration: duration, + curve: curve, ), ], ), diff --git a/lib/components/checkbox/tokens/checkbox_spec.dart b/lib/components/checkbox/tokens/checkbox_spec.dart index 91c24bb..1589639 100644 --- a/lib/components/checkbox/tokens/checkbox_spec.dart +++ b/lib/components/checkbox/tokens/checkbox_spec.dart @@ -51,5 +51,10 @@ class CheckboxSpec extends Spec { } @override - List get props => [flexContainer, innerContainer, icon, label]; + List get props => [ + flexContainer, + innerContainer, + icon, + label, + ]; } diff --git a/lib/components/checkbox/tokens/checkbox_util.dart b/lib/components/checkbox/tokens/checkbox_util.dart index 17b5249..7985078 100644 --- a/lib/components/checkbox/tokens/checkbox_util.dart +++ b/lib/components/checkbox/tokens/checkbox_util.dart @@ -20,23 +20,23 @@ class CheckboxSpecUtility CheckboxSpecUtility(super.builder); BoxSpecUtility get innerContainer => BoxSpecUtility( - (innerContainer) => call(innerContainer: innerContainer), + (innerContainer) => only(innerContainer: innerContainer), ); FlexSpecUtility get flexContainer => FlexSpecUtility( - (flexContainer) => call(flexContainer: flexContainer), + (flexContainer) => only(flexContainer: flexContainer), ); IconSpecUtility get icon => IconSpecUtility( - (icon) => call(icon: icon), + (icon) => only(icon: icon), ); TextSpecUtility get label => TextSpecUtility( - (label) => call(label: label), + (label) => only(label: label), ); @override - T call({ + T only({ FlexSpecAttribute flexContainer = const FlexSpecAttribute(), BoxSpecAttribute innerContainer = const BoxSpecAttribute(), IconSpecAttribute icon = const IconSpecAttribute(), diff --git a/test/components/checkbox_test.dart b/test/components/checkbox_test.dart index c2fa04f..0cad07c 100644 --- a/test/components/checkbox_test.dart +++ b/test/components/checkbox_test.dart @@ -12,7 +12,7 @@ void main() { await tester.pumpWidget( MaterialApp( home: RemixCheckbox( - checked: isChecked, + value: isChecked, label: 'Checkbox', onChanged: (value) { expect(value, !isChecked); @@ -32,7 +32,7 @@ void main() { await tester.pumpWidget(MaterialApp( home: Scaffold( body: RemixCheckbox( - checked: false, + value: false, disabled: true, onChanged: (value) { didCallOnChanged = true; @@ -52,7 +52,7 @@ void main() { for (var isChecked in [true, false]) { await tester.pumpWidget(MaterialApp( home: RemixCheckbox( - checked: isChecked, + value: isChecked, label: 'Checkbox', onChanged: (value) {}, ), @@ -60,7 +60,7 @@ void main() { expect( find.byWidgetPredicate( - (widget) => widget is RemixCheckbox && widget.checked == isChecked, + (widget) => widget is RemixCheckbox && widget.value == isChecked, ), findsOneWidget, ); @@ -72,7 +72,7 @@ void main() { await tester.pumpWidget(MaterialApp( home: RemixCheckbox( - checked: false, + value: false, label: label, onChanged: (value) {}, ), @@ -94,7 +94,7 @@ void main() { for (var isChecked in [true, false]) { await tester.pumpWidget(MaterialApp( home: RemixCheckbox( - checked: isChecked, + value: isChecked, iconChecked: iconChecked, iconUnchecked: iconUnchecked, label: 'Checkbox',