@@ -36,21 +36,14 @@ class WoxListView<T> extends StatelessWidget {
3636
3737 @override
3838 Widget build (BuildContext context) {
39- final Stopwatch ? buildStopwatch = LoggerSwitch .enableBuildTimeLog ? (Stopwatch ()..start ()) : null ;
40- int ? cp1, cp2, cp3, cp4;
41-
4239 // Fast path: when showFilter is false, we don't need LayoutBuilder
4340 // because we don't need to measure available space for filter
4441 if (! showFilter) {
45- if (buildStopwatch != null ) cp1 = buildStopwatch.elapsedMicroseconds;
46-
4742 final itemHeight =
4843 listViewType == WoxListViewTypeEnum .WOX_LIST_VIEW_TYPE_ACTION .code || listViewType == WoxListViewTypeEnum .WOX_LIST_VIEW_TYPE_CHAT .code
4944 ? WoxThemeUtil .instance.getActionItemHeight ()
5045 : WoxThemeUtil .instance.getResultListViewHeightByCount (1 );
5146
52- if (buildStopwatch != null ) cp2 = buildStopwatch.elapsedMicroseconds;
53-
5447 final listWidget = ConstrainedBox (
5548 constraints: BoxConstraints (maxHeight: maxHeight),
5649 child: Scrollbar (
@@ -128,26 +121,12 @@ class WoxListView<T> extends StatelessWidget {
128121 ),
129122 );
130123
131- if (buildStopwatch != null ) {
132- cp3 = buildStopwatch.elapsedMicroseconds;
133- buildStopwatch.stop ();
134- final prepTime = (cp1 ?? 0 );
135- final heightTime = (cp2 ?? 0 ) - (cp1 ?? 0 );
136- final listTime = (cp3 ?? 0 ) - (cp2 ?? 0 );
137- Logger .instance.debug (
138- const UuidV4 ().generate (),
139- "flutter build metric: list view (fast) - total:${buildStopwatch .elapsedMicroseconds }μs, prep:${prepTime }μs, height:${heightTime }μs, list:${listTime }μs, items:${controller .items .length }" ,
140- );
141- }
142-
143124 return listWidget;
144125 }
145126
146127 // Slow path: with filter, need LayoutBuilder to measure available space
147128 return LayoutBuilder (
148129 builder: (context, constraints) {
149- if (buildStopwatch != null ) cp1 = buildStopwatch.elapsedMicroseconds;
150-
151130 const filterTopPadding = 6.0 ;
152131 const filterFieldHeight = 40.0 ;
153132 final hasBoundedHeight = constraints.hasBoundedHeight;
@@ -164,8 +143,6 @@ class WoxListView<T> extends StatelessWidget {
164143 ? WoxThemeUtil .instance.getActionItemHeight ()
165144 : WoxThemeUtil .instance.getResultListViewHeightByCount (1 );
166145
167- if (buildStopwatch != null ) cp2 = buildStopwatch.elapsedMicroseconds;
168-
169146 // Build the list widget
170147 final listWidget = ConstrainedBox (
171148 constraints: BoxConstraints (maxHeight: listMaxHeight),
@@ -247,8 +224,6 @@ class WoxListView<T> extends StatelessWidget {
247224 ),
248225 );
249226
250- if (buildStopwatch != null ) cp3 = buildStopwatch.elapsedMicroseconds;
251-
252227 // Build filter widget if needed
253228 Widget ? filterWidget;
254229 if (canShowFilter) {
@@ -347,23 +322,7 @@ class WoxListView<T> extends StatelessWidget {
347322 );
348323 }
349324
350- if (buildStopwatch != null ) cp4 = buildStopwatch.elapsedMicroseconds;
351-
352325 final content = Column (mainAxisSize: MainAxisSize .min, children: [listWidget, if (filterWidget != null ) filterWidget]);
353-
354- if (buildStopwatch != null ) {
355- buildStopwatch.stop ();
356- final layoutTime = cp1 ?? 0 ;
357- final prepTime = (cp2 ?? 0 ) - (cp1 ?? 0 );
358- final listTime = (cp3 ?? 0 ) - (cp2 ?? 0 );
359- final filterTime = (cp4 ?? 0 ) - (cp3 ?? 0 );
360- final columnTime = buildStopwatch.elapsedMicroseconds - (cp4 ?? 0 );
361- Logger .instance.debug (
362- const UuidV4 ().generate (),
363- "flutter build metric: list view - total:${buildStopwatch .elapsedMicroseconds }μs, layout:${layoutTime }μs, prep:${prepTime }μs, list:${listTime }μs, filter:${filterTime }μs, column:${columnTime }μs, items:${controller .items .length }" ,
364- );
365- }
366-
367326 return content;
368327 },
369328 );
0 commit comments