flutter_dough
this package provides some widgets you can use to create a smooshy ui.
how to use smooshy ui
this package provides squishy widgets you can use right out of the box. optionally, you can create custom dough widgets for a custom squish effect. for a more complete overview on how to use the dough library, check out the example project provided on github.
pressable dough
wrap any widget in pressabledough
to make it squish based on a user’s input gestures.
pressabledough(
child: floatingactionbutton( ... ),
);
you can find a full example of how to use this widget here.
draggable dough
similar to flutter’s built-in draggable widget, draggabledough
allows you to drag and drop widgets around… only this time it’s squishy!
draggabledough<string>(
data: 'my data',
child: container( ... ),
feedback: container( ... ),
);
you can find a full example of how to use this widget here.
gyro dough
wrap any widget in gyrodough
to make it squish based on how a user moves their phone around in physical space. this widget only works on devices that have accelerometer/gyroscope features.
gyrodough(
child: container( ... ),
);
you can find a full example of how to use this widget here.
make your own dough
if the above widgets aren’t exactly what you’re looking for, you can easily create your own squishy widget using the provided dough
widget! see the example project for more details on how to do this.
customize how the dough feels
if you don’t like the default dough settings, you can easily change how the dough feels. just wrap any widget that uses dough
in a doughrecipe
and you’re good to go.
doughrecipe(
data: doughrecipedata(
adhesion: 4,
viscosity: 250, // a more jello like substance
useperspectivewarp: true, // use for added jiggly-ness
perspectivewarpdepth: 0.02,
exitduration: duration(milliseconds: 600),
...
),
child: pressabledough( ... ),
);
you can find a full example of how to use this widget here.
future improvements
dough expansion – ideally, pressing on a dough widget would push pixels away from your finger, as if you were pressing on dough (possibly using a mesh-grid?). if you have any ideas for how to achieve this, please consider contributing!
more dough widgets – support for more out-of-the-box dough widgets will be added in the future. some dough widget ideas include…
- [ ] reorderablelistdough – same as the reorderable list widget, but it’s smooshy.
- [ ] sliverlistdough – same as the sliver list widget, but it’s smooshy.
Comments are closed.