wx_anchor 2.1.1 copy "wx_anchor: ^2.1.1" to clipboard
wx_anchor: ^2.1.1 copied to clipboard

Clickable zone within a widget that activates an interactive overlay upon touch or hover.

Pub Version GitHub GitHub GitHub

Clickable zone within a widget that activates an interactive overlay upon touch or hover.

Preview

Demo

Usage #

To read more about classes and other references used by wx_anchor, see the API Reference.

Overlay Effect #

WxAnchor has a default overlay effect that changes the opacity based on user interactions (focused, hovered, pressed, and disabled).

// Rectangle shape
WxAnchor(
  onTap: () {},
  padding: const EdgeInsets.symmetric(
    horizontal: 10,
    vertical: 6,
  ),
  borderRadius: BorderRadius.circular(5),
  child: const Text('Click Here'),
)

// Circle shape
WxAnchor.circle(
  onTap: () {},
  overlayRadius: 20, // overlay radius
  child: const Icon(Icons.chat),
)

Disable Overlay effect #

WxAnchor(
  onTap: () {},
  overlay: false,
  child: const Text('Click Here'),
)

Customize Overlay Effect #

// Changes overlay opacity based on user interaction
WxAnchor(
  onTap: () {},
  overlayColor: Colors.amber,
  focusedStyle: const WxAnchorStyle(overlayOpacity: 0.25),
  hoveredStyle: const WxAnchorStyle(overlayOpacity: 0.15),
  pressedStyle: const WxAnchorStyle(
    overlayOpacity: 0.25,
    overlayColor: Colors.red,
  ),
  borderRadius: BorderRadius.circular(15),
  child: const Icon(Icons.power_off),
)

// Changes overlay radius based on user interaction
WxAnchor.circle(
  onTap: () {},
  overlayRadius: 0,
  hoveredStyle: const WxAnchorStyle.circle(overlayRadius: 25),
  pressedStyle: const WxAnchorStyle.circle(overlayRadius: 20),
  child: const Icon(Icons.power_off),
)

Child Opacity & Scale #

WxAnchor.circle(
  onTap: () {},
  opacity: 1,
  scale: 1,
  overlay: false,
  hoveredStyle: const WxAnchorStyle(opacity: .7, scale: 1.1),
  pressedStyle: const WxAnchorStyle(opacity: 1, scale: 1),
  child: const Icon(Icons.chat),
)

Sponsoring #

Buy Me A Coffee Ko-Fi

If this package or any other package I created is helping you, please consider to sponsor me so that I can take time to read the issues, fix bugs, merge pull requests and add features to these packages.

4
likes
160
pub points
0%
popularity

Publisher

verified publisherwidgetarian.com

Clickable zone within a widget that activates an interactive overlay upon touch or hover.

Repository (GitHub)
View/report issues

Topics

#ui #anchor #widgetarian

Documentation

API reference

Funding

Consider supporting this project:

buymeacoffee.com
ko-fi.com

License

BSD-3-Clause (license)

Dependencies

animated_icon_theme, animated_transform, flutter, widget_event, wx_utils

More

Packages that depend on wx_anchor