mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 02:07:39 +08:00
DebugScreen: Add buttons to jump to top and bottom
This commit is contained in:
@ -14,13 +14,23 @@ class _DebugScreenState extends State<DebugScreen> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
|
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
WidgetsBinding.instance.addPostFrameCallback((_) => _scrollToBottom());
|
||||||
_controller.animateTo(
|
}
|
||||||
_controller.position.maxScrollExtent,
|
|
||||||
duration: const Duration(milliseconds: 10),
|
void _scrollToTop() {
|
||||||
curve: Curves.easeOut,
|
_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
|
@override
|
||||||
@ -34,6 +44,16 @@ class _DebugScreenState extends State<DebugScreen> {
|
|||||||
Navigator.of(context).pop();
|
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(
|
body: Scrollbar(
|
||||||
child: ListView(
|
child: ListView(
|
||||||
|
Reference in New Issue
Block a user