InputDecorator negative baseline error message (#74837)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
@@ -4420,4 +4421,42 @@ void main() {
|
||||
final double intrinsicHeight = tester.getSize(find.byKey(intrinsicHeightKey)).height;
|
||||
expect(intrinsicHeight, equals(height));
|
||||
});
|
||||
|
||||
testWidgets('error message for negative baseline', (WidgetTester tester) async {
|
||||
FlutterErrorDetails? errorDetails;
|
||||
final FlutterExceptionHandler? oldHandler = FlutterError.onError;
|
||||
FlutterError.onError = (FlutterErrorDetails details) {
|
||||
errorDetails ??= details;
|
||||
};
|
||||
try {
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Center(
|
||||
child: Directionality(
|
||||
textDirection: TextDirection.ltr,
|
||||
child: InputDecorator(
|
||||
decoration: const InputDecoration(),
|
||||
child: Stack(
|
||||
children: const <Widget>[
|
||||
SizedBox(height: 0),
|
||||
Positioned(
|
||||
bottom: 5,
|
||||
child: Text('ok'),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
null,
|
||||
EnginePhase.layout,
|
||||
);
|
||||
} finally {
|
||||
FlutterError.onError = oldHandler;
|
||||
}
|
||||
|
||||
expect(errorDetails?.toString(), contains("InputDecorator's children reported a negative baseline"));
|
||||
expect(errorDetails?.toString(), contains('RenderStack'));
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user