Skip to content
SimplifyJobsPublic

About

Shader effects for Flutter: BorderBeam, light around a widget's border, and DistortionWave, a wave that carries one screen into another. Built for Impeller.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

prismatic

Light and motion for Flutter, drawn by shaders.

pub package pub points Flutter 3.47+ CI codecov License: MIT

prismatic gives you two effects. Each is one small shader, made for Flutter's Impeller renderer. They run on Skia and the web too.

BorderBeam

A beam of light that travels around a widget's border. Put it on a card while an agent works, on a search bar, or on anything that is thinking.

Border beams lapping a card, riding a chat composer's edge, and breathing in from a card's border

BorderBeam(
  borderRadius: 16,
  colors: BeamColors.ocean,
  child: card,
)

Pick the effect that fits:

  • rotate laps the border. It's the default.
  • line rides one edge. Lovely on inputs.
  • pulse breathes in from every side. A calm "thinking" state.

There are 19 palettes, squircle corners, a theme and a controller. Use the same radius as your widget, and the light sits right on its edge.

DistortionWave

A colourful wave that bends one screen into the next. Use it when someone pays, sends, finishes a step, or succeeds.

A wave rising from a Send button and carrying a payment review into its receipt
vertical: up from a button
A wave crossing from the left edge to the next sign-up step
horizontal: across from an edge
A ring of colour spreading from an icon inside a sheet
center: a ring from an icon
DistortionWave(
  revealed: sent,
  revealedChild: const ReceiptScreen(),
  child: ReviewScreen(
    send: DistortionWaveAnchor(
      child: FilledButton(
        onPressed: () => setState(() => sent = true),
        child: const Text('Send'),
      ),
    ),
  ),
)

Flip revealed to send the wave out. Flip it back to bring it home. The anchor tells the wave where to start, and it leans toward your finger.

Going to a new page? Push a DistortionWaveRoute:

Navigator.of(context).push(
  DistortionWaveRoute<void>(
    source: WaveSource.of(context),
    builder: (_) => const ReceiptScreen(),
  ),
);

Five palettes come built in, and any BorderBeam palette works too through WavePalette.fromBeamColors(BeamColors.aurora). Or pass your own colours:

DistortionWave(
  palette: const WavePalette(
    colors: [Color(0xFF7C5CFF), Color(0xFF39C6FF), Color(0xFF4CF2B5)],
    ahead: Color(0xFFFF8FD8),
    behind: Color(0xFF3D5AFE),
  ),
  // ...
)

Get started

flutter pub add prismatic
import 'package:prismatic/prismatic.dart';

You need Flutter 3.47 or newer. Load the shaders before your first frame, so the very first beam or wave is smooth:

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await BorderBeam.precache();
  await DistortionWave.precache();
  runApp(const App());
}

Good to know

  • Give both screens of a wave an opaque background. The wave paints pictures of them.
  • The beam reads your light or dark theme from material_ui. Still on package:flutter/material.dart? Set BeamStyle(theme: BeamTheme.dark) yourself.
  • Both effects respect the system's reduced-motion setting.

Try it

Learn more

Credits

Both effects began as designs by Jakub Antalik: border-beam (React) and Distortion waves (SwiftUI), both MIT. prismatic recreates their look with its own Flutter renderer. If you like it, go star the originals.

License

MIT. See LICENSE, and NOTICE for the original works.

About

Shader effects for Flutter: BorderBeam, light around a widget's border, and DistortionWave, a wave that carries one screen into another. Built for Impeller.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages