DebugScreen: Add buttons to jump to top and bottom

This commit is contained in:
Vishesh Handa
2020-05-17 19:56:25 +02:00
parent c62d5e469f
commit a2b72a1a81

View File

@ -14,13 +14,23 @@ class _DebugScreenState extends State<DebugScreen> {
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((_) {
WidgetsBinding.instance.addPostFrameCallback((_) => _scrollToBottom());
}
void _scrollToTop() {
_controller.animateTo(
_controller.position.minScrollExtent,
duration: const Duration(milliseconds: 10),
curve: Curves.easeOut,
);
}
void _scrollToBottom() {
_controller.animateTo(
_controller.position.maxScrollExtent,
duration: const Duration(milliseconds: 10),
curve: Curves.easeOut,
);
});
}
@override
@ -34,6 +44,16 @@ class _DebugScreenState extends State<DebugScreen> {
Navigator.of(context).pop();
},
),
actions: <Widget>[
IconButton(
icon: const Icon(Icons.arrow_upward),
onPressed: _scrollToTop,
),
IconButton(
icon: const Icon(Icons.arrow_downward),
onPressed: _scrollToBottom,
),
],
),
body: Scrollbar(
child: ListView(