1- import 'package:arabic_learning/funcs/ui.dart' ;
2- import 'package:arabic_learning/vars/statics_var.dart' ;
31import 'package:flutter/material.dart' ;
42import 'package:provider/provider.dart' ;
53
4+ import 'package:arabic_learning/funcs/ui.dart' ;
5+ import 'package:arabic_learning/vars/statics_var.dart' ;
66import 'package:arabic_learning/vars/global.dart' ;
77
88class DebugPage extends StatefulWidget {
@@ -13,14 +13,23 @@ class DebugPage extends StatefulWidget {
1313}
1414
1515class _DebugPage extends State <DebugPage > {
16+ ScrollController controller = ScrollController ();
17+
1618 @override
1719 Widget build (BuildContext context) {
1820 context.read <Global >().uiLogger.info ("构建 DebugPage" );
1921 return Scaffold (
2022 appBar: AppBar (
2123 title: Text ("调试设置" ),
2224 ),
23- body: Column (
25+ floatingActionButton: FloatingActionButton (
26+ child: Icon (Icons .arrow_upward),
27+ onPressed: (){
28+ controller.animateTo (0 , duration: Duration (milliseconds: 500 ), curve: StaticsVar .curve);
29+ }
30+ ),
31+ body: ListView (
32+ controller: controller,
2433 children: [
2534 TextContainer (text: "该页面为软件调试/测试和bug反馈使用,非必要请勿开启日志捕获,以免性能损耗" , style: TextStyle (color: Colors .redAccent)),
2635 Container (
@@ -78,30 +87,28 @@ class _DebugPage extends State<DebugPage> {
7887 ],
7988 ),
8089 ),
81- SizedBox (
82- width: MediaQuery .of (context).size.width,
83- height: MediaQuery .of (context).size.height * 0.7 ,
84- child: ExpansionTile (
85- title: Text ("日志捕获内容" ),
86- children: [
87- SizedBox (
88- height: MediaQuery .of (context).size.height * 0.6 ,
89- child: ListView (
90- children: List .generate (
91- context.watch <Global >().internalLogCapture.length,
92- (index){
93- final String logLine = context.read <Global >().internalLogCapture[context.read <Global >().internalLogCapture.length - index - 1 ];
94- return TextContainer (
95- text: logLine,
96- selectable: true ,
97- style: TextStyle (color: logLine.contains ("[SERVER]" ) ? Colors .redAccent : logLine.contains ("WARNING" ) ? Colors .amberAccent : logLine.contains ("FINE" ) ? Colors .grey : null )
98- );
99- }
100- ),
101- )
102- )
103- ],
104- ),
90+ ExpansionTile (
91+ title: Text ("日志捕获内容" ),
92+ children: [
93+ Column (
94+ children: List .generate (
95+ context.watch <Global >().internalLogCapture.length,
96+ (index){
97+ final String logLine = context.read <Global >().internalLogCapture[context.read <Global >().internalLogCapture.length - index - 1 ];
98+ return Container (
99+ width: MediaQuery .of (context).size.width * 0.9 ,
100+ decoration: BoxDecoration (
101+ color: Theme .of (context).colorScheme.onPrimary,
102+ borderRadius: index == 0 ? BorderRadius .vertical (top: Radius .circular (10.0 )) : index == context.watch <Global >().internalLogCapture.length- 1 ? BorderRadius .vertical (bottom: Radius .circular (10.0 )) : BorderRadius .all (Radius .circular (5.0 ))
103+ ),
104+ margin: EdgeInsets .all (2.0 ),
105+ padding: EdgeInsets .all (4.0 ),
106+ child: SelectableText (logLine, style: TextStyle (color: logLine.contains ("[SERVER]" ) ? Colors .redAccent : logLine.contains ("WARNING" ) ? Colors .amberAccent : logLine.contains ("FINE" ) ? Colors .grey : null )),
107+ );
108+ }
109+ ),
110+ )
111+ ],
105112 )
106113 ],
107114 ),
0 commit comments