flutter_physics_ui library

A Flutter package providing physics-based UI elements that respond to touch and gravity.

This package includes physics containers, buttons, and cards that simulate real-world physics behavior, making your UI more engaging and interactive.

Features

  • Physics Engine: A lightweight 2D physics engine for UI elements
  • Physics Container: A container that responds to touch and gravity
  • Physics Button: A button that bounces when pressed
  • Physics Card: A draggable card with physics simulation
  • Customizable Physics: Adjust gravity, friction, restitution, and more
  • Cross-Platform: Supports iOS, Android, Web, Windows, macOS, and Linux
  • WASM Compatible: Works with Flutter Web WASM

Getting Started

import 'package:flutter_physics_ui/flutter_physics_ui.dart';

PhysicsContainer(
  physics: PhysicsProperties(
    gravity: 9.8,
    friction: 0.5,
    restitution: 0.8,
  ),
  child: Text('Physics-based UI!'),
)

Classes

MeasureSize
PhysicsButton
A physics-based button that bounces when pressed.
PhysicsCard
A physics-based card that can be dragged and dropped.
PhysicsContainer
A physics-based container that responds to touch and gravity.
PhysicsContainerWidget
A physics-based container that responds to touch and gravity. This widget wraps the core PhysicsContainer.
PhysicsProperties
Configuration for physics behavior in physics-based UI elements.

Typedefs

OnWidgetSizeChange = void Function(Size size)