magnetic_button 0.0.4 copy "magnetic_button: ^0.0.4" to clipboard
magnetic_button: ^0.0.4 copied to clipboard

A Flutter package that provides a button with a unique "magnetic" hover effect.

Magnetic Button #

The Magnetic Button is a custom Flutter widget that creates an interactive button with a "magnetic" effect. When you hover over the button, it moves in response to the mouse position, creating a unique and engaging user experience.

Platform Support

Android iOS MacOS Web Linux Windows

preview

Untested Features #

  • On-Hold Magnetic Effect (Mobile): We’re planning to add an on-hold magnetic effect primarily designed for mobile devices. This feature will allow the button to continue moving in response to touch gestures, creating a more interactive user experience on mobile platforms.

Features #

  • Hover Effect: The button moves in response to the mouse position when hovered over, creating a "magnetic" effect.
  • Return Duration: When the mouse is not hovering over the widget, the button returns to its original position. The speed at which it returns is controlled by the duration property. This property is set in milliseconds, so a larger value will make the return slower, and a smaller value will make it faster.
  • Customizable: You can customize the child widget of the Magnetic Button to fit your needs.

Usage #

  1. First, create a GlobalKey

    final innerMagneticButtonKeys = GlobalKey<MagneticButtonState>();
    
  2. Second, create a MagneticButton widget and pass in your desired child widget:

    MagneticButton(
      child: Container(
        decoration: BoxDecoration(
          borderRadius: BorderRadius.all(Radius.circular(40)),
          color: Colors.white,
          border: Border.all(color: Color(0xFF303032))
        ),
        width: 160,
        height: 80,
        child: Center(
          child: Text(
            'Explore',
            style: TextStyle(
              fontWeight: FontWeight.w400,
              fontSize: 19,
            ),
          ),
        ),
      ),
    )
    

Future Features #

We’re always looking to improve the Magnetic Button and add new features that enhance its functionality and user experience. Here are some features we’re planning to implement in the future:

  • On-Hold Magnetic Effect (Mobile): We’re planning to add an on-hold magnetic effect primarily designed for mobile devices. This feature will allow the button to continue moving in response to touch gestures, creating a more interactive user experience on mobile platforms.

  • Max Movement: You can control the maximum movement of the button in response to the mouse position using the mx and my properties.

Please note that these features are planned for future releases and are subject to change. We welcome feedback and suggestions from our users. If you have an idea for a feature that you’d like to see in Magnetic Button, please let us know!

5
likes
0
points
23
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package that provides a button with a unique "magnetic" hover effect.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on magnetic_button