Tweak animation curves (#90)
Changed button and scale curves to improve responsiveness (makes the button react faster when tapping).
This commit is contained in:
parent
00a7e82d15
commit
5c3b0c6775
8 changed files with 17 additions and 6 deletions
|
|
@ -97,6 +97,8 @@ class Chat extends StatelessWidget {
|
|||
child: Observer(
|
||||
builder: (_) => AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
switchInCurve: Curves.easeOutCubic,
|
||||
switchOutCurve: Curves.easeInCubic,
|
||||
child: chatStore.autoScroll
|
||||
? null
|
||||
: Button(
|
||||
|
|
|
|||
|
|
@ -205,6 +205,8 @@ class _ChattersListState extends State<ChattersList> {
|
|||
Observer(
|
||||
builder: (context) => AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
switchInCurve: Curves.easeOutCubic,
|
||||
switchOutCurve: Curves.easeInCubic,
|
||||
child: chatDetailsStore.showJumpButton ? ScrollToTopButton(scrollController: _scrollController) : null,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -72,6 +72,8 @@ class _CategoriesState extends State<Categories> with AutomaticKeepAliveClientMi
|
|||
Observer(
|
||||
builder: (context) => AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
switchInCurve: Curves.easeOutCubic,
|
||||
switchOutCurve: Curves.easeInCubic,
|
||||
child: _categoriesStore.showJumpButton ? ScrollToTopButton(scrollController: _categoriesStore.scrollController) : null,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -141,6 +141,8 @@ class _CategoryStreamsState extends State<CategoryStreams> {
|
|||
child: Observer(
|
||||
builder: (context) => AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
switchInCurve: Curves.easeOutCubic,
|
||||
switchOutCurve: Curves.easeInCubic,
|
||||
child: widget.listStore.showJumpButton ? ScrollToTopButton(scrollController: widget.listStore.scrollController) : null,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -102,6 +102,8 @@ class _StreamsListState extends State<StreamsList> with AutomaticKeepAliveClient
|
|||
Observer(
|
||||
builder: (context) => AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
switchInCurve: Curves.easeOutCubic,
|
||||
switchOutCurve: Curves.easeInCubic,
|
||||
child: _listStore.showJumpButton ? ScrollToTopButton(scrollController: _listStore.scrollController) : null,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@ class _AnimateScaleState extends State<AnimateScale> with SingleTickerProviderSt
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
const duration = Duration(milliseconds: 200);
|
||||
const downCurve = Curves.easeInCubic;
|
||||
const upCurve = Curves.easeOutCubic;
|
||||
const downCurve = Curves.easeOutCubic;
|
||||
const upCurve = Curves.easeInCubic;
|
||||
|
||||
return InkWell(
|
||||
onTap: widget.onTap,
|
||||
|
|
|
|||
|
|
@ -79,17 +79,17 @@ class _ButtonState extends State<Button> with SingleTickerProviderStateMixin {
|
|||
: Listener(
|
||||
onPointerDown: (_) => _animationController.animateTo(
|
||||
_animationController.upperBound,
|
||||
curve: Curves.easeInCubic,
|
||||
curve: Curves.easeOutCubic,
|
||||
duration: duration,
|
||||
),
|
||||
onPointerUp: (_) => _animationController.animateTo(
|
||||
_animationController.lowerBound,
|
||||
curve: Curves.easeOutCubic,
|
||||
curve: Curves.easeInCubic,
|
||||
duration: duration,
|
||||
),
|
||||
onPointerCancel: (_) => _animationController.animateTo(
|
||||
_animationController.lowerBound,
|
||||
curve: Curves.easeOutCubic,
|
||||
curve: Curves.easeInCubic,
|
||||
duration: duration,
|
||||
),
|
||||
child: button,
|
||||
|
|
|
|||
|
|
@ -14,9 +14,10 @@ class ScrollToTopButton extends StatelessWidget {
|
|||
child: FloatingActionButton(
|
||||
onPressed: () {
|
||||
HapticFeedback.lightImpact();
|
||||
|
||||
scrollController.animateTo(
|
||||
0.0,
|
||||
curve: Curves.fastOutSlowIn,
|
||||
curve: Curves.easeOutCubic,
|
||||
duration: const Duration(milliseconds: 500),
|
||||
);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue