Add responsive parity smoke matrix
This commit is contained in:
parent
51672e691e
commit
e61c2a58a7
14 changed files with 191 additions and 67 deletions
|
|
@ -85,7 +85,7 @@ class InspectorSliderRow extends StatelessWidget {
|
|||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 34,
|
||||
constraints: const BoxConstraints(minHeight: 34),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
||||
decoration: BoxDecoration(
|
||||
gradient: const LinearGradient(
|
||||
|
|
@ -99,24 +99,35 @@ class InspectorSliderRow extends StatelessWidget {
|
|||
BoxShadow(color: Color(0x66000000), blurRadius: 8, offset: Offset(0, 2)),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 190,
|
||||
child: Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFFFB84F),
|
||||
fontFamily: 'monospace',
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final labelText = Text(
|
||||
label,
|
||||
style: const TextStyle(
|
||||
color: Color(0xFFFFB84F),
|
||||
fontFamily: 'monospace',
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: CultUiSlider(value: value),
|
||||
),
|
||||
],
|
||||
);
|
||||
if (constraints.maxWidth < 520) {
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
labelText,
|
||||
const SizedBox(height: 4),
|
||||
CultUiSlider(value: value),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return Row(
|
||||
children: [
|
||||
SizedBox(width: 190, child: labelText),
|
||||
Expanded(child: CultUiSlider(value: value)),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 81 KiB After Width: | Height: | Size: 81 KiB |
BIN
flutter/eve_parity/test/goldens/cultui-inspector-phone.png
Normal file
BIN
flutter/eve_parity/test/goldens/cultui-inspector-phone.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 57 KiB |
BIN
flutter/eve_parity/test/goldens/cultui-inspector-tablet.png
Normal file
BIN
flutter/eve_parity/test/goldens/cultui-inspector-tablet.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 74 KiB |
|
|
@ -3,14 +3,30 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('renders CultUI inspector parity fixture', (tester) async {
|
||||
await tester.binding.setSurfaceSize(const Size(1280, 720));
|
||||
await tester.pumpWidget(const EveParityApp());
|
||||
await tester.pumpAndSettle();
|
||||
for (final viewport in _viewports) {
|
||||
testWidgets('renders CultUI inspector parity fixture at ${viewport.id}', (tester) async {
|
||||
await tester.binding.setSurfaceSize(Size(viewport.width, viewport.height));
|
||||
await tester.pumpWidget(const EveParityApp());
|
||||
await tester.pumpAndSettle();
|
||||
|
||||
await expectLater(
|
||||
find.byType(EveParityApp),
|
||||
matchesGoldenFile('goldens/cultui-inspector.png'),
|
||||
);
|
||||
});
|
||||
await expectLater(
|
||||
find.byType(EveParityApp),
|
||||
matchesGoldenFile('goldens/cultui-inspector-${viewport.id}.png'),
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const _viewports = [
|
||||
_Viewport('phone', 390, 844),
|
||||
_Viewport('tablet', 768, 1024),
|
||||
_Viewport('desktop', 1280, 720),
|
||||
];
|
||||
|
||||
class _Viewport {
|
||||
const _Viewport(this.id, this.width, this.height);
|
||||
|
||||
final String id;
|
||||
final double width;
|
||||
final double height;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue