Make sure that a TextSelectionToolbarTextButton doesn't crash in 0x0 … (#178374)

This is my attempt to handle
https://github.com/flutter/flutter/issues/6537 for the
TextSelectionToolbarTextButton widget.

Co-authored-by: Tong Mu <dkwingsmt@users.noreply.github.com>
Co-authored-by: Victor Sanni <victorsanniay@gmail.com>
This commit is contained in:
Ahmed Mohamed Sameh 2025-11-21 02:01:49 +02:00 committed by GitHub
parent 63ef482845
commit c5d2104166
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -176,4 +176,19 @@ void main() {
expect(textButton.style!.backgroundColor!.resolve(<WidgetState>{}), Colors.transparent);
});
}
testWidgets('TextSelectionToolbarTextButton does not crash at zero area', (
WidgetTester tester,
) async {
await tester.pumpWidget(
const MaterialApp(
home: Center(
child: SizedBox.shrink(
child: TextSelectionToolbarTextButton(padding: EdgeInsets.all(5), child: Text('X')),
),
),
),
);
expect(tester.getSize(find.byType(TextSelectionToolbarTextButton)), Size.zero);
});
}