Skip to content

Commit

Permalink
docs for dough sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
josiahsrc committed Jan 27, 2024
1 parent 56a2272 commit dee2b11
Show file tree
Hide file tree
Showing 12 changed files with 143 additions and 87 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
![Flutter Dough](./assets/images/[email protected])
![Flutter Dough Sensors](./assets/images/[email protected])
![Dough JS](./assets/images/[email protected])

# Dough Library
Expand All @@ -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

Expand Down
Binary file added assets/images/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
89 changes: 60 additions & 29 deletions packages/dough/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
![Flutter Dough](../../assets/images/[email protected])

[![style: very good analysis](https://img.shields.io/badge/style-very_good_analysis-B22C89.svg)](https://pub.dev/packages/very_good_analysis)
[![Awesome: Flutter](https://img.shields.io/badge/Awesome-Flutter-blue.svg?longCache=true&style=flat-square)](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

Expand All @@ -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( ... ),
);
```

Expand All @@ -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( ... ),
);
```

Expand All @@ -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.

![GyroDough Demo](../../assets/gifs/gyro-dough.gif)

Expand All @@ -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( ... ),
);
```

Expand All @@ -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!
Expand All @@ -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!

---

Expand Down
68 changes: 42 additions & 26 deletions packages/dough_sensors/README.md
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.
![Flutter Dough](../../assets/images/[email protected])

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).
[![Awesome: Flutter](https://img.shields.io/badge/Awesome-Flutter-blue.svg?longCache=true&style=flat-square)](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).

![GyroDough Demo](../../assets/gifs/gyro-dough.gif)

---

## 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
17 changes: 3 additions & 14 deletions packages/dough_sensors/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,6 @@

This app has different demos that show how to use dough widgets.

- [Dough Recipe Demo](./lib/dough_widget_demos/dough_recipe_demo.dart)
- Provides an example of how to use the DoughRecipe widget which
provides the "squish theme" for all dough widgets.

- [Pressable Dough Demo](./lib/dough_widget_demos/pressable_dough_demo.dart)
- Provides an example of how to use the PressableDough widget which
smooshes its child around based on how a user presses the widget.

- [Draggable Dough Demo](./lib/dough_widget_demos/draggable_dough_demo.dart)
- Provides an example of how to use the DraggableDough widget which
wraps a Draggable widget and makes it squishy.

- [Custom Dough Demo](./lib/dough_widget_demos/custom_dough_demo.dart)
- Provides an example of how to create your own squishy widgets.
- [Gyro Dough Demo](./lib/dough_widget_demos/gyro_dough_demo.dart)
- Provides an example of how to use the GyroDough widget which
wraps a Gyroscope widget and makes it squishy.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
<string>12.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion packages/dough_sensors/example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '9.0'
platform :ios, '12.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
Loading

0 comments on commit dee2b11

Please sign in to comment.