-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
143 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
 | ||
 | ||
 | ||
|
||
# Dough Library | ||
|
@@ -8,11 +9,12 @@ Squishy widgets for Flutter and the web. | |
## Quick Links | ||
|
||
- [Flutter Dough](./packages/dough/README.md) | ||
- [Flutter Dough Sensors](./packages/dough_sensors/README.md) | ||
- [Dough JS](./packages/dough-js/readme.md) | ||
|
||
## Demos | ||
|
||
Here are a few samples of the different widgets provided by this repo. You can find more information on how to use these widgets in the main [Dough](./packages/dough/README.md) project. | ||
Here are a few samples of the different widgets provided by this repo. You can find more information on how to use these widgets in the main [Dough](./packages/dough/README.md) project and the [Dough Sensors](./packages/dough_sensors/README.md) project. | ||
|
||
### Pressable Dough | ||
|
||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
 | ||
|
||
[](https://pub.dev/packages/very_good_analysis) | ||
[](https://github.com/Solido/awesome-flutter) | ||
|
||
This package provides some widgets you can use to create a smooshy UI. | ||
- [Flutter package](https://pub.dev/packages/dough) | ||
- [Source code](https://github.com/josiahsrc/flutter_dough) | ||
- [Source code](https://github.com/josiahsrc/dough) | ||
|
||
## How to use | ||
|
||
|
@@ -15,9 +14,9 @@ This package provides squishy widgets you can use right out of the box. Optional | |
|
||
Wrap any widget in `PressableDough` to make it squish based on a user's input gestures. | ||
|
||
``` | ||
```dart | ||
PressableDough( | ||
child: FloatingActionButton( ... ), | ||
child: FloatingActionButton( ... ), | ||
); | ||
``` | ||
|
||
|
@@ -29,11 +28,11 @@ You can find a full example of how to use this widget [here](example/lib/dough_w | |
|
||
Similar to Flutter's built-in Draggable widget, `DraggableDough` allows you to drag and drop widgets around... Only this time it's squishy! | ||
|
||
``` | ||
```dart | ||
DraggableDough<String>( | ||
data: 'My data', | ||
child: Container( ... ), | ||
feedback: Container( ... ), | ||
data: 'My data', | ||
child: Container( ... ), | ||
feedback: Container( ... ), | ||
); | ||
``` | ||
|
||
|
@@ -43,15 +42,7 @@ You can find a full example of how to use this widget [here](example/lib/dough_w | |
|
||
### 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](example/lib/dough_widget_demos/gyro_dough_demo.dart). | ||
The `GyroDough` widget has been moved to the [Dough Sensors](https://pub.dev/packages/dough_sensors) package. | ||
|
||
 | ||
|
||
|
@@ -67,17 +58,17 @@ If the above widgets aren't exactly what you're looking for, you can easily crea | |
|
||
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. | ||
|
||
``` | ||
```dart | ||
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( ... ), | ||
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( ... ), | ||
); | ||
``` | ||
|
||
|
@@ -87,6 +78,46 @@ You can find a full example of how to use this widget [here](example/lib/dough_w | |
|
||
--- | ||
|
||
## Migration from v1.x.x to v2.x.x | ||
|
||
If you're using `DraggablePrefs`, rename your `DraggablePrefs` to `DraggableDoughRecipeData`. | ||
|
||
```dart | ||
// v1.x.x | ||
DoughRecipe( | ||
data: DoughRecipeData( | ||
draggablePrefs: DraggablePrefs( ... ), | ||
), | ||
child: DraggableDough( prefs: DraggablePrefs( ... ), ... ), | ||
); | ||
// v2.x.x | ||
DoughRecipe( | ||
data: DoughRecipeData( | ||
draggableRecipe: DraggableDoughRecipeData( ... ), | ||
), | ||
child: DraggableDough( recipe: DraggableDoughRecipeData( ... ), ... ), | ||
) | ||
``` | ||
|
||
If you are using `GyroDough`, install the [Dough Sensors](https://pub.dev/packages/dough_sensors) package and replace `GyroDoughPrefs` with `GyroDoughRecipeData`. | ||
|
||
```dart | ||
// v1.x.x | ||
DoughRecipe( | ||
data: DoughRecipeData( | ||
gyroPrefs: GyroDoughPrefs( ... ), | ||
), | ||
child: GyroDough( ... ), | ||
); | ||
// v2.x.x | ||
GyroDoughRecipe( | ||
data: GyroDoughRecipeData( ... ), | ||
child: GyroDough( recipe: GyroDoughRecipeData( ... ), ... ), | ||
) | ||
``` | ||
|
||
## 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! | ||
|
@@ -98,8 +129,8 @@ You can find a full example of how to use this widget [here](example/lib/dough_w | |
## Contributing | ||
|
||
Contributions to this package are always welcome! Please read the [contributing guidlines](../../CONTRIBUTING.md). | ||
- If you have an idea/suggestion/bug-report, feel free to [create a ticket](https://github.com/josiahsrc/flutter_dough/issues). | ||
- If you created a custom `Dough` widget or some other awesome feature that you want to share with the community, you can fork the [repository](https://github.com/josiahsrc/flutter_dough) and submit a pull request! | ||
- If you have an idea/suggestion/bug-report, feel free to [create a ticket](https://github.com/josiahsrc/dough/issues). | ||
- If you created a custom `Dough` widget or some other awesome feature that you want to share with the community, you can fork the [repository](https://github.com/josiahsrc/dough) and submit a pull request! | ||
|
||
--- | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,55 @@ | ||
<!-- | ||
This README describes the package. If you publish this package to pub.dev, | ||
this README's contents appear on the landing page for your package. | ||
 | ||
|
||
For information about how to write a good package README, see the guide for | ||
[writing package pages](https://dart.dev/guides/libraries/writing-package-pages). | ||
[](https://github.com/Solido/awesome-flutter) | ||
|
||
For general information about developing packages, see the Dart guide for | ||
[creating packages](https://dart.dev/guides/libraries/create-library-packages) | ||
and the Flutter guide for | ||
[developing packages and plugins](https://flutter.dev/developing-packages). | ||
--> | ||
Smooshy widgets that use sensors. Builds on top of the [Dough](https://pub.dev/packages/dough) library. | ||
- [Flutter package](https://pub.dev/packages/dough_sensors) | ||
- [Source code](https://github.com/josiahsrc/dough) | ||
|
||
TODO: Put a short description of the package here that helps potential users | ||
know whether this package might be useful for them. | ||
## How to use | ||
|
||
## Features | ||
This package provides sensor-based squishy widgets you can use right out of the box. For a more complete overview on how to use the Dough Sensors library, check out the [example project](./example/README.md) provided on GitHub. | ||
|
||
TODO: List what your package can do. Maybe include images, gifs, or videos. | ||
### Gyro Dough | ||
|
||
## Getting started | ||
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. | ||
|
||
TODO: List prerequisites and provide or point to information on how to | ||
start using the package. | ||
``` | ||
GyroDough( | ||
child: Container( ... ), | ||
); | ||
``` | ||
|
||
You can find a full example of how to use this widget [here](example/lib/dough_widget_demos/gyro_dough_demo.dart). | ||
|
||
 | ||
|
||
--- | ||
|
||
## Usage | ||
## Customize how the Dough feels | ||
|
||
TODO: Include short and useful examples for package users. Add longer examples | ||
to `/example` folder. | ||
If you don't like the default dough settings, you can easily change how the dough feels. Just wrap any widget that uses `GyroDough` in a `GyroDoughRecipe` and you're good to go. | ||
|
||
```dart | ||
const like = 'sample'; | ||
``` | ||
GyroDoughRecipe( | ||
data: GyroDoughRecipeData( | ||
gyroMultiplier: 110, // Control the squishiness of the widget | ||
... | ||
), | ||
child: GyroDough( ... ), | ||
); | ||
``` | ||
|
||
You can find a full example of how to use this widget [here](example/lib/dough_widget_demos/gyro_dough_demo.dart). | ||
|
||
--- | ||
|
||
## Contributing | ||
|
||
Contributions to this package are always welcome! Please read the [contributing guidlines](../../CONTRIBUTING.md). | ||
- If you have an idea/suggestion/bug-report, feel free to [create a ticket](https://github.com/josiahsrc/dough/issues). | ||
- If you created a custom `Dough` widget or some other awesome feature that you want to share with the community, you can fork the [repository](https://github.com/josiahsrc/dough) and submit a pull request! | ||
|
||
## Additional information | ||
--- | ||
|
||
TODO: Tell users more about the package: where to find more information, how to | ||
contribute to the package, how to file issues, what response they can expect | ||
from the package authors, and more. | ||
keywords: dough, rubber, elastic, rubber-band, rubberband, stretchy, squishy, smooshy, linear-algebra, matrix, transformation, flexible, draggable, drag, pressable, custom, ui, ux, interactive, animation, engage, sensors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.