Cheaper frosted-glass blurs: sigma 4 and one backdrop read per bar
Blur sigma 16 -> 4 keeps CanvasKit on its direct blur path; under the 84% fill the look is unchanged (max 13/255 inside the pieces). SegmentedBar's pieces share a BackdropGroup so Impeller reads the content behind them once. Adds a scroll frame-time bench, a backdrop census and filler rows to the full-app probe. CPU CanvasKit, 560x900: run timeline p50 31.8 -> 22.1 ms, runs list 25.3 -> 19.9 ms.
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/glass_pill.dart';
|
||||
import 'package:pipelines_app/ui/adaptive/segmented_bar.dart';
|
||||
|
||||
List<BackdropKey?> _keys(WidgetTester tester) => tester.layers
|
||||
.whereType<BackdropFilterLayer>()
|
||||
.map((layer) => layer.backdropKey)
|
||||
.toList();
|
||||
|
||||
void main() {
|
||||
testWidgets('a bar\'s pieces share one backdrop read; the expanded title '
|
||||
'reads its own', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
extendBodyBehindAppBar: true,
|
||||
appBar: SegmentedBar(
|
||||
cupertino: false,
|
||||
title: 'Release train run',
|
||||
subtitle: 'Run 7',
|
||||
expandableTitle: true,
|
||||
leading: const BackButton(),
|
||||
actions: [
|
||||
IconButton(icon: const Icon(Icons.more_vert), onPressed: () {}),
|
||||
],
|
||||
),
|
||||
body: const SizedBox.expand(),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final pieces = _keys(tester);
|
||||
expect(pieces, hasLength(3));
|
||||
final shared = pieces.first;
|
||||
expect(shared, isNotNull);
|
||||
expect(pieces, everyElement(same(shared)));
|
||||
|
||||
await tester.tap(find.text('Release train run'));
|
||||
await tester.pumpAndSettle();
|
||||
final keys = _keys(tester);
|
||||
expect(keys, hasLength(4));
|
||||
final expanded = keys.where((k) => !identical(k, shared)).toList();
|
||||
expect(expanded, hasLength(1));
|
||||
expect(expanded.single, isNotNull);
|
||||
});
|
||||
|
||||
testWidgets('a lone piece reads the backdrop on its own', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
const MaterialApp(
|
||||
home: Center(child: GlassPill(cupertino: false, child: Text('Tabs'))),
|
||||
),
|
||||
);
|
||||
expect(_keys(tester), [isNull]);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user