add animation for button "To top"

This commit is contained in:
shirotame 2024-10-06 18:28:28 +04:00
parent 011fbbd05f
commit 28c448046f

View File

@ -155,15 +155,18 @@ class _BodyState extends State<Body> {
],
),
BlocBuilder<HomeBloc, HomeState>(
builder: (context, state) => state.isButtonToTopShown
? Container(
alignment: Alignment.topRight,
padding: EdgeInsets.only(right: 16, top: 64),
child: FloatingActionButton(
onPressed: _goToTop,
child: Icon(Icons.arrow_upward_rounded),
))
: SizedBox.shrink(),
builder: (context, state) => AnimatedSwitcher(
duration: Duration(milliseconds: 250),
child: state.isButtonToTopShown
? Container(
key: ValueKey<int>(1),
alignment: Alignment.topRight,
padding: EdgeInsets.only(right: 16, top: 72),
child: FloatingActionButton(
onPressed: _goToTop,
child: Icon(Icons.arrow_upward_rounded),
))
: SizedBox.shrink(key: ValueKey<int>(0))),
)
]);
}