shader_buffers
1.1.4, released 9 months ago by marcobavagnoli.com
Widget that runs GLSL shaders and feeds their output to other shaders or widgets
WASM-ready
What it does
ShaderBuffers lets you load fragment shaders from assets, pass uniforms, capture pointer events, and chain multiple shader layers. It exposes a controller to play, pause, rewind and query shader state.
AI-written summary of version 1.1.4, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to display ShaderToy-like effects in a Flutter app
- You want to layer multiple shaders and use their outputs as textures
- You need interactive shaders that respond to touch or mouse
Skip it when
- You only need simple image or color manipulation
- You are targeting iOS with Impeller enabled (may have issues)
Strengths
- Easy to set up with a single widget
- Supports multiple layers and custom uniforms
- Provides built‑in uniforms (iResolution, iTime, iMouse)
- Controller API for play/pause/rewind
Weaknesses
- Performance drops with many buffers
- Requires Flutter 3.10+ and may not work on Impeller
- Limited to fragment shaders only
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 0
Add package to pubspec, import, provide shader assets and LayerBuffer definitions
```dart
final mainImage = LayerBuffer(
shaderAssetsName: 'shaders/shader_main.glsl',
uniforms: Uniforms([
Uniform(name: 'blur', range: const RangeValues(0, 1), defaultValue: 0.9),
]),
);
ShaderBuffers(
controller: ShaderController(),
mainImage: mainImage,
);
```Works with
Packages commonly used together with shader_buffers: ones it builds on, ones built on it, and its own family.