frosty/lib/widgets/scroll_to_top_button.dart
Tommy 3af5406f60
Update linting and formatting rules (#261)
* Add new linting rules

* Apply new linting rules

* Fix dart sdk version

* Format code to 80 lines
2023-04-29 11:34:28 -04:00

29 lines
865 B
Dart

import 'package:flutter/material.dart';
import 'package:frosty/widgets/button.dart';
class ScrollToTopButton extends StatelessWidget {
final ScrollController scrollController;
const ScrollToTopButton({Key? key, required this.scrollController})
: super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.only(bottom: 5.0),
child: Tooltip(
message: 'Scroll to top',
preferBelow: false,
child: Button(
onPressed: () => scrollController.animateTo(
0.0,
curve: Curves.easeOut,
duration: const Duration(milliseconds: 500),
),
padding: const EdgeInsets.symmetric(horizontal: 25.0, vertical: 10.0),
child: const Icon(Icons.keyboard_double_arrow_up_rounded),
),
),
);
}
}