mirror of
https://github.com/twonlyapp/twonly-app.git
synced 2026-01-15 11:18:41 +00:00
fix #115
This commit is contained in:
parent
d8155765a6
commit
cbe2619a06
1 changed files with 65 additions and 46 deletions
|
|
@ -4,13 +4,30 @@ import 'package:path_provider/path_provider.dart';
|
|||
import 'package:flutter/services.dart';
|
||||
import 'package:twonly/src/utils/misc.dart';
|
||||
|
||||
class DiagnosticsView extends StatelessWidget {
|
||||
class DiagnosticsView extends StatefulWidget {
|
||||
const DiagnosticsView({super.key});
|
||||
|
||||
@override
|
||||
State<DiagnosticsView> createState() => _DiagnosticsViewState();
|
||||
}
|
||||
|
||||
class _DiagnosticsViewState extends State<DiagnosticsView> {
|
||||
final ScrollController _scrollController = ScrollController();
|
||||
|
||||
void _scrollToBottom() {
|
||||
// Assuming the button is at the bottom of the scroll view
|
||||
_scrollController.animateTo(
|
||||
_scrollController.position.maxScrollExtent, // Scroll to the bottom
|
||||
duration: Duration(milliseconds: 300),
|
||||
curve: Curves.easeInOut,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SafeArea(
|
||||
child: FutureBuilder<String>(
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Diagnostics')),
|
||||
body: FutureBuilder<String>(
|
||||
future: _loadLogFile(),
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.connectionState == ConnectionState.waiting) {
|
||||
|
|
@ -20,12 +37,11 @@ class DiagnosticsView extends StatelessWidget {
|
|||
} else {
|
||||
final logText = snapshot.data ?? '';
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: const Text('Diagnostics')),
|
||||
body: Column(
|
||||
return Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
controller: _scrollController,
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
child: Text(logText),
|
||||
),
|
||||
|
|
@ -45,6 +61,10 @@ class DiagnosticsView extends StatelessWidget {
|
|||
},
|
||||
child: const Text('Copy All Text'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: _scrollToBottom,
|
||||
child: const Text('Scroll to Bottom'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
if (await deleteLogFile()) {
|
||||
|
|
@ -67,7 +87,6 @@ class DiagnosticsView extends StatelessWidget {
|
|||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue