Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add state error on MixWidgetState #489

Merged
merged 1 commit into from
Sep 27, 2024
Merged

feat: Add state error on MixWidgetState #489

merged 1 commit into from
Sep 27, 2024

Conversation

tilucasoli
Copy link
Collaborator

Description

  • Add a new state to MixWidgetState called error.

Changes

  • Add the new state and update some tests

Review Checklist

  • Testing: Have you tested your changes, including unit tests and integration tests for affected code?
  • Breaking Changes: Does this change introduce breaking changes affecting existing code or users?
  • Documentation Updates: Are all relevant documentation files (e.g. README, API docs) updated to reflect the changes in this PR?
  • Website Updates: Is the website containing the updates you make on documentation?

Additional Information (optional)

class ExampleButton extends StatefulWidget {
  const ExampleButton({super.key});

  @override
  State<ExampleButton> createState() => _ExampleButtonState();
}

class _ExampleButtonState extends State<ExampleButton> {
  late final MixWidgetStateController controller;

  @override
  void initState() {
    super.initState();
    controller = MixWidgetStateController();
  }

  @override
  void dispose() {
    controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Pressable(
      onPress: () => controller.error = true,
      controller: controller,
      child: Box(
        style: Style(
          $box.chain
            ..padding.horizontal(16)
            ..padding.vertical(12)
            ..border.all(color: Colors.black)
            ..border.all(color: Colors.black)
            ..borderRadius.circular(8)
            ..color.white.shade(3)
            ..shadow.color(Colors.black)
            ..shadow.offset(2, 4),
          $on.error(
            $box.chain
              ..border.all(color: Colors.red)
              ..shadow.color(Colors.red),
            $text.style.color.red(),
          ),
          $text.style.bold(),
        ),
        child: const StyledText('Click me'),
      ),
    );
  }
}

Copy link

vercel bot commented Sep 26, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
mix-docs ⬜️ Ignored (Inspect) Sep 26, 2024 6:05pm

Copy link
Member

@leoafarias leoafarias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@leoafarias leoafarias merged commit 9286d7a into main Sep 27, 2024
6 checks passed
@leoafarias leoafarias deleted the feat/error branch September 27, 2024 17:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants