Make compact Dock persistent and support week swipes
This commit is contained in:
@@ -19,10 +19,10 @@ void main() {
|
||||
preview: true,
|
||||
);
|
||||
// Sample beside the visible label, away from icon glow and glass rims.
|
||||
final selected = _channel(resting, 22, 52, 0);
|
||||
final base = _channel(resting, 160, 52, 0);
|
||||
final selected = _channel(resting, 16, 43, 0);
|
||||
final base = _channel(resting, 160, 43, 0);
|
||||
expect(base - selected, greaterThan(20));
|
||||
expect((_channel(resting, 22, 52, 2) - selected).abs(), lessThan(12));
|
||||
expect((_channel(resting, 16, 43, 2) - selected).abs(), lessThan(12));
|
||||
final held = await _render(
|
||||
tester,
|
||||
GlassDock(selectedIndex: 0, onSelected: (_) {}),
|
||||
@@ -30,7 +30,7 @@ void main() {
|
||||
held: true,
|
||||
preview: true,
|
||||
);
|
||||
expect(_channel(held, 22, 52, 0) - selected, greaterThan(18));
|
||||
expect(_channel(held, 16, 43, 0) - selected, greaterThan(18));
|
||||
});
|
||||
testWidgets(
|
||||
'glass softens fine background detail without whitening its colour',
|
||||
@@ -61,12 +61,14 @@ void main() {
|
||||
);
|
||||
// Below the symbol and away from the rim, the selected lens should retain
|
||||
// this saturated cyan backdrop while applying the new resting grey tint.
|
||||
final red = _channel(pixels, 22, 52, 0);
|
||||
final green = _channel(pixels, 22, 52, 1);
|
||||
final blue = _channel(pixels, 22, 52, 2);
|
||||
final red = _channel(pixels, 16, 40, 0);
|
||||
final green = _channel(pixels, 16, 40, 1);
|
||||
final blue = _channel(pixels, 16, 40, 2);
|
||||
expect(red, lessThan(85));
|
||||
expect(green - red, greaterThan(95));
|
||||
expect(blue - red, greaterThan(140));
|
||||
// The strongest resting tint (34%) and base veil (5%) retain about 63%
|
||||
// of the source's 210-level blue/red contrast, including the shorter rim.
|
||||
expect(blue - red, greaterThan(130));
|
||||
},
|
||||
);
|
||||
|
||||
@@ -81,7 +83,7 @@ void main() {
|
||||
);
|
||||
for (final start in [32, 160]) {
|
||||
final reds = [
|
||||
for (var x = start; x < start + 20; x++) _channel(pixels, x, 60, 0),
|
||||
for (var x = start; x < start + 20; x++) _channel(pixels, x, 50, 0),
|
||||
];
|
||||
final contrast =
|
||||
reds.reduce((a, b) => a > b ? a : b) -
|
||||
@@ -104,7 +106,7 @@ void main() {
|
||||
);
|
||||
for (final start in [24, 160]) {
|
||||
final reds = [
|
||||
for (var x = start; x < start + 40; x++) _channel(pixels, x, 60, 0),
|
||||
for (var x = start; x < start + 40; x++) _channel(pixels, x, 50, 0),
|
||||
];
|
||||
final contrast =
|
||||
reds.reduce((a, b) => a > b ? a : b) -
|
||||
@@ -173,6 +175,7 @@ Future<ByteData> _render(
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
addTearDown(tester.view.resetDevicePixelRatio);
|
||||
final key = GlobalKey(), glassKey = GlobalKey();
|
||||
final height = glass is GlassDock ? 58 : 68;
|
||||
await tester.pumpWidget(
|
||||
RepaintBoundary(
|
||||
key: key,
|
||||
@@ -183,7 +186,7 @@ Future<ByteData> _render(
|
||||
child: SizedBox(
|
||||
key: glassKey,
|
||||
width: 264,
|
||||
height: 68,
|
||||
height: height.toDouble(),
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
@@ -235,11 +238,11 @@ Future<ByteData> _render(
|
||||
ui.Canvas(recorder).drawImageRect(
|
||||
image,
|
||||
region,
|
||||
const Rect.fromLTWH(0, 0, 792, 204),
|
||||
Rect.fromLTWH(0, 0, 792, height * 3.0),
|
||||
Paint()..filterQuality = FilterQuality.high,
|
||||
);
|
||||
final picture = recorder.endRecording();
|
||||
final previewImage = await picture.toImage(792, 204);
|
||||
final previewImage = await picture.toImage(792, height * 3);
|
||||
final png = (await previewImage.toByteData(
|
||||
format: ui.ImageByteFormat.png,
|
||||
))!;
|
||||
@@ -254,8 +257,8 @@ Future<ByteData> _render(
|
||||
previewImage.dispose();
|
||||
picture.dispose();
|
||||
}
|
||||
final cropped = ByteData(264 * 68 * 4);
|
||||
for (var y = 0; y < 68; y++) {
|
||||
final cropped = ByteData(264 * height * 4);
|
||||
for (var y = 0; y < height; y++) {
|
||||
for (var x = 0; x < 264; x++) {
|
||||
final source =
|
||||
((region.top.round() + y) * image.width + region.left.round() + x) *
|
||||
|
||||
Reference in New Issue
Block a user