-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Description
Is there an existing feature request for this?
- I have searched the existing issues.
Command
Option to visualize widget boundaries in golden test scenarios
Description
When using GoldenTestGroup, the layout is affected by the largest widget (including text of test names) in each row/column. This makes it hard to tell the actual size or constraints of each widget.
It would be super helpful to have a built-in option (maybe a debug flag or wrapper) to show widget boundaries — like drawing a border around each child — to better see margins, padding, and overall sizing.
Right now, I manually add a DecoratedBox with a white border (see “enabled 2” in the image) to simulate this. Although DecoratedBox may not be the most optimal solution, it serves to illustrate what I want.
Thanks!
This is test is for the alchemist example.
import 'package:alchemist/alchemist.dart';
import 'package:example/widgets/widgets.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('Red Button Golden Tests', () {
goldenTest(
'renders correctly',
fileName: 'red_button',
builder: () => GoldenTestGroup(
children: [
GoldenTestScenario(
name: 'enabled',
child: RedButton(
onPressed: () {},
child: const Text('Red Button'),
),
),
GoldenTestScenario(
name: 'enabled 2',
child: DecoratedBox(
decoration: BoxDecoration(
border: Border.all(
color: Colors.white,
width: 4,
),
),
child: RedButton(
onPressed: () {},
child: const Text('Red Button'),
),
),
),
GoldenTestScenario(
name: 'disabled',
child: const RedButton(
onPressed: null,
child: Text('Red Button'),
),
),
GoldenTestScenario(
name: 'with icon',
child: RedButton(
onPressed: () {},
icon: const Icon(Icons.add),
child: const Text('Red Button'),
),
),
GoldenTestScenario(
name: 'disabled with icon',
child: const RedButton(
onPressed: null,
icon: Icon(Icons.add),
child: Text('Red Button'),
),
),
],
),
);
});
}Reasoning
.
Additional context and comments
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels