text
stringlengths 1
372
|
|---|
@override
|
widget build(BuildContext context) {
|
return material(
|
child: center(
|
child: TextButton(
|
onPressed: () {
|
debugDumpFocusTree();
|
},
|
child: const Text('Dump focus tree'),
|
),
|
),
|
);
|
}
|
}
|
<code_end>
|
<topic_end>
|
<topic_start>
|
print the semantics tree
|
the debugDumpSemanticsTree() function prints the semantic tree for the app.
|
the semantics tree is presented to the system accessibility APIs.
|
to obtain a dump of the semantics tree:
|
<topic_end>
|
<topic_start>
|
example 8: call debugDumpSemanticsTree()
|
<code_start>
|
import 'package:flutter/foundation.dart';
|
import 'package:flutter/material.dart';
|
import 'package:flutter/rendering.dart';
|
void main() {
|
runApp(
|
const MaterialApp(
|
home: AppHome(),
|
),
|
);
|
}
|
class AppHome extends StatelessWidget {
|
const AppHome({super.key});
|
@override
|
widget build(BuildContext context) {
|
return material(
|
child: center(
|
child: semantics(
|
button: true,
|
enabled: true,
|
label: 'clickable text here!',
|
child: GestureDetector(
|
onTap: () {
|
debugDumpSemanticsTree();
|
if (kdebugmode) {
|
print('Clicked!');
|
}
|
},
|
child: const Text('Click me!', style: TextStyle(fontSize: 56))),
|
),
|
),
|
);
|
}
|
}
|
<code_end>
|
<topic_end>
|
<topic_start>
|
print event timings
|
if you want to find out where your events happen relative to the frame’s
|
begin and end, you can set prints to log these events.
|
to print the beginning and end of the frames to the console,
|
toggle the debugPrintBeginFrameBanner
|
and the debugPrintEndFrameBanner.
|
the print frame banner log for example 1
|
to print the call stack causing the current frame to be scheduled,
|
use the debugPrintScheduleFrameStacks flag.
|
<topic_end>
|
<topic_start>
|
debug layout issues
|
to debug a layout problem using a GUI, set
|
debugPaintSizeEnabled to true.
|
this flag can be found in the rendering library.
|
you can enable it at any time and affects all painting while true.
|
consider adding it to the top of your void main() entry point.
|
<topic_end>
|
<topic_start>
|
example 9
|
see an example in the following code:
|
<code_start>
|
//add import to rendering library
|
import 'package:flutter/rendering.dart';
|
void main() {
|
debugPaintSizeEnabled = true;
|
runApp(const MyApp());
|
}
|
<code_end>
|
when enabled, flutter displays the following changes to your app:
|
the debugPaintBaselinesEnabled flag
|
does something similar but for objects with baselines.
|
the app displays the baseline for alphabetic characters in bright green
|
and the baseline for ideographic characters in orange.
|
alphabetic characters “sit” on the alphabetic baseline,
|
but that baseline “cuts” through the bottom of CJK characters.
|
flutter positions the ideographic baseline at the very bottom of the text line.
|
the debugPaintPointersEnabled flag turns on a special mode that
|
highlights any objects that you tap in teal.
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.