mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 15:24:35 +01:00
opt.: debug page (#259)
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
|
import 'package:toolbox/core/extension/datetime.dart';
|
||||||
import 'package:toolbox/data/res/ui.dart';
|
import 'package:toolbox/data/res/ui.dart';
|
||||||
|
|
||||||
import '../../data/res/misc.dart';
|
import '../../data/res/misc.dart';
|
||||||
@@ -17,7 +18,7 @@ class DebugProvider extends ChangeNotifier {
|
|||||||
widgets.add(Text.rich(TextSpan(
|
widgets.add(Text.rich(TextSpan(
|
||||||
children: [
|
children: [
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: '[${record.loggerName}]',
|
text: '[${DateTime.now().hourMinute}][${record.loggerName}]',
|
||||||
style: const TextStyle(color: Colors.cyan),
|
style: const TextStyle(color: Colors.cyan),
|
||||||
),
|
),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
|
|||||||
@@ -53,5 +53,6 @@ abstract final class GithubIds {
|
|||||||
'aliuzzz',
|
'aliuzzz',
|
||||||
'58fly',
|
'58fly',
|
||||||
'Potterli20',
|
'Potterli20',
|
||||||
|
'Seifon',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import 'package:hive_flutter/hive_flutter.dart';
|
|||||||
import 'package:logging/logging.dart';
|
import 'package:logging/logging.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:toolbox/core/build_mode.dart';
|
|
||||||
import 'package:toolbox/core/channel/bg_run.dart';
|
import 'package:toolbox/core/channel/bg_run.dart';
|
||||||
import 'package:toolbox/core/utils/sync/icloud.dart';
|
import 'package:toolbox/core/utils/sync/icloud.dart';
|
||||||
import 'package:toolbox/core/utils/platform/base.dart';
|
import 'package:toolbox/core/utils/platform/base.dart';
|
||||||
@@ -81,7 +80,6 @@ Future<void> _initApp() async {
|
|||||||
Computer.shared.turnOn(
|
Computer.shared.turnOn(
|
||||||
// Plus 1 to avoid 0.
|
// Plus 1 to avoid 0.
|
||||||
workersCount: (Stores.server.box.keys.length / 3).round() + 1,
|
workersCount: (Stores.server.box.keys.length / 3).round() + 1,
|
||||||
verbose: !BuildMode.isRelease,
|
|
||||||
);
|
);
|
||||||
_setupLogger();
|
_setupLogger();
|
||||||
_setupProviders();
|
_setupProviders();
|
||||||
|
|||||||
@@ -6,14 +6,9 @@ import 'package:toolbox/data/res/provider.dart';
|
|||||||
|
|
||||||
import '../widget/appbar.dart';
|
import '../widget/appbar.dart';
|
||||||
|
|
||||||
class DebugPage extends StatefulWidget {
|
class DebugPage extends StatelessWidget {
|
||||||
const DebugPage({super.key});
|
const DebugPage({super.key});
|
||||||
|
|
||||||
@override
|
|
||||||
_DebugPageState createState() => _DebugPageState();
|
|
||||||
}
|
|
||||||
|
|
||||||
class _DebugPageState extends State<DebugPage> {
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@@ -24,6 +19,12 @@ class _DebugPageState extends State<DebugPage> {
|
|||||||
),
|
),
|
||||||
title: const Text('Logs', style: TextStyle(color: Colors.white)),
|
title: const Text('Logs', style: TextStyle(color: Colors.white)),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
|
actions: [
|
||||||
|
IconButton(
|
||||||
|
onPressed: () => Pros.debug.clear(),
|
||||||
|
icon: const Icon(Icons.delete, color: Colors.white),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
body: _buildTerminal(context),
|
body: _buildTerminal(context),
|
||||||
backgroundColor: Colors.black,
|
backgroundColor: Colors.black,
|
||||||
@@ -36,22 +37,18 @@ class _DebugPageState extends State<DebugPage> {
|
|||||||
color: Colors.black,
|
color: Colors.black,
|
||||||
child: DefaultTextStyle(
|
child: DefaultTextStyle(
|
||||||
style: const TextStyle(
|
style: const TextStyle(
|
||||||
fontFamily: 'monospace',
|
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
),
|
),
|
||||||
child: SingleChildScrollView(
|
child: ChangeNotifierProvider.value(
|
||||||
child: ChangeNotifierProvider(
|
value: Pros.debug,
|
||||||
create: (_) => Pros.debug,
|
child: Consumer<DebugProvider>(
|
||||||
child: Consumer<DebugProvider>(
|
builder: (_, provider, __) {
|
||||||
builder: (_, debug, __) {
|
return ListView(
|
||||||
return Column(
|
key: ValueKey(provider.widgets.length),
|
||||||
mainAxisSize: MainAxisSize.min,
|
reverse: true,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
children: provider.widgets,
|
||||||
children: debug.widgets,
|
);
|
||||||
);
|
},
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user