Squishy widgets for Flutter and the web.
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 project and the Dough Sensors project.
This package provides some widgets you can use to create a smooshy UI.
License: MIT License
Squishy widgets for Flutter and the web.
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 project and the Dough Sensors project.
Multi-touch
This would let you pinch and squeeze the dough from two or more sides, and the dough would droop down out or pile up, away from the forces applied to it, just like real dough. Currently, attempting to pinch the dough or use multi-touch make the dough warp across the screen.
A widget that morphs based on how a user moves their mobile device around in physical space (using gyro sensors). If a user shakes their phone to the left (or maybe tilts it to the left), a widget wrapped in the GyroDough
widget will droop left, as if it were a real piece of dough.
Long press Draggable, to have more control to move Dough Items inside List View
Describe the solution you'd like
https://api.flutter.dev/flutter/widgets/LongPressDraggable-class.html
This applies to the DoughRecipe
class. It'd be nice if Provider
was used instead of InheritedWidget.
Use this to update the rolling sum of the gyro widget and other related functionality.
Hello. Am getting the above error when I pop the containing page. Am I doing something wrong?
Love the package otherwise, thanks!
════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown while finalizing the widget tree:
_DoughState#6945b(ticker active) was disposed with an active Ticker.
_DoughState created a Ticker via its SingleTickerProviderStateMixin, but at the time dispose() was called on the mixin, that Ticker was still active. The Ticker must be disposed before calling super.dispose().
Tickers used by AnimationControllers should be disposed by calling dispose() on the AnimationController itself. Otherwise, the ticker will leak.
The offending ticker was: Ticker(created by _DoughState#6945b(lifecycle state: created))
The stack trace when the Ticker was actually created was:
#0 new Ticker.
package:flutter/…/scheduler/ticker.dart:66
#1 new Ticker
package:flutter/…/scheduler/ticker.dart:68
#2 SingleTickerProviderStateMixin.createTicker
package:flutter/…/widgets/ticker_provider.dart:129
#3 new AnimationController
package:flutter/…/animation/animation_controller.dart:247
#4 _DoughState.initState
package:dough/dough.dart:47
#5 StatefulElement._firstBuild
package:flutter/…/widgets/framework.dart:4640
#6 ComponentElement.mount
package:flutter/…/widgets/framework.dart:4476
... Normal element mounting (15 frames)
#21 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3446
#22 MultiChildRenderObjectElement.mount
package:flutter/…/widgets/framework.dart:5947
#23 Element.inflateWidget
package:flutter/…/widgets/framework.dart:3446
#24 Element.updateChild
package:flutter/…/widgets/framework.dart:3211
#25 ComponentElement.performRebuild
package:flutter/…/widgets/framework.dart:4527
#26 StatefulElement.performRebuild
package:flutter/…/widgets/framework.dart:4675
#27 Element.rebuild
package:flutter/…/widgets/framework.dart:4218
#28 BuildOwner.buildScope
package:flutter/…/widgets/framework.dart:2627
#29 WidgetsBinding.drawFrame
package:flutter/…/widgets/binding.dart:883
#30 RendererBinding._handlePersistentFrameCallback
package:flutter/…/rendering/binding.dart:284
#31 SchedulerBinding._invokeFrameCallback
package:flutter/…/scheduler/binding.dart:1113
#32 SchedulerBinding.handleDrawFrame
package:flutter/…/scheduler/binding.dart:1052
#33 SchedulerBinding._handleDrawFrame
package:flutter/…/scheduler/binding.dart:968
#37 _invoke (dart:ui/hooks.dart:261:10)
#38 _drawFrame (dart:ui/hooks.dart:219:3)
(elided 3 frames from dart:async)
When the exception was thrown, this was the stack
#0 SingleTickerProviderStateMixin.dispose.
package:flutter/…/widgets/ticker_provider.dart:142
#1 SingleTickerProviderStateMixin.dispose
package:flutter/…/widgets/ticker_provider.dart:156
#2 _DoughState.dispose
package:dough/dough.dart:60
#3 StatefulElement.unmount
package:flutter/…/widgets/framework.dart:4729
#4 _InactiveElements._unmount
package:flutter/…/widgets/framework.dart:1922
Dart team recommends that packages migrate to null-safety. Create/test a null safety API for dough.
Sensors introduces platform dependency for android and iOS and does not include the mac/linux/windows platform. This is causing the package to lose pub points.
Find a way to support accelerometer functionality on mobile platforms (for GyroDough) while maintaining support for web/desktop platforms.
I was messing around to achieve the realistic scaling mentioned in the README
In DraggableOverlayDoughTransformer.createDoughMatrix()
I made this change:
@override
Matrix4 createDoughMatrix() {
final adhesiveDx = delta.x * t / recipe.adhesion;
final adhesiveDy = delta.y * t / recipe.adhesion;
Matrix4 translate;
if (applyDelta) {
if (snapToTargetOnStop) {
final dx = -delta.x * (controller.isActive ? 1 : t);
final dy = -delta.y * (controller.isActive ? 1 : t);
translate = Matrix4.translationValues(
dx + adhesiveDx,
dy + adhesiveDy,
0,
)
//--- Rotate in 3 dimensions ---------------
* (Matrix4.identity()
..setEntry(3, 2, 0.01)
..rotateY(-(dx + adhesiveDx) * 0.01)
..rotateX((dy + adhesiveDy) * 0.01));
//-------------------------------------------
} else {
translate = Matrix4.translationValues(
-delta.x + adhesiveDx,
-delta.y + adhesiveDy,
0,
);
}
} else {
translate = Matrix4.translationValues(adhesiveDx, adhesiveDy, 0);
}
return translate * bendWithDeltaMatrix() * expansionMatrix();
}
Is that what you are looking for?
Some classes (such as DoughRecipe
and some of its fields) override equality checking manually using the ==
operator and hashcode()
override. This is prone to error as more fields are added. Replace this equality checking implementation with the equatable package equality checking implementation.
^
A squishy item that "comes off" when dragged somewhere else would be awesome.
Describe the bug
Operand of null-aware operation '!' has type 'WidgetsBinding' which excludes null.
The draggable dough widget feels awesome. The same concept could be applied to a ReorderableList
.
A possible implementation would be:
DraggableDough
, the list item will appear to stick to its slot. Once a drag threshold is met, the list item will elastically snap to the user's finger and will be freely movable/reorderable.Similar to this feature, except for reorderable lists instead:
Add an analysis options file
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.