Add test for error_widget.0_test.dart (#153103)
Add test for error_widget.0_test.dart which is listed in this issue related to this issue https://github.com/flutter/flutter/issues/130459
This commit is contained in:
@@ -16,15 +16,7 @@ void main() {
|
||||
return ErrorWidget(details.exception);
|
||||
}
|
||||
// In release builds, show a yellow-on-blue message instead:
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'Error!\n${details.exception}',
|
||||
style: const TextStyle(color: Colors.yellow),
|
||||
textAlign: TextAlign.center,
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
);
|
||||
return ReleaseModeErrorWidget(details: details);
|
||||
};
|
||||
|
||||
// Start the app.
|
||||
@@ -69,3 +61,21 @@ class _ErrorWidgetExampleAppState extends State<ErrorWidgetExampleApp> {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ReleaseModeErrorWidget extends StatelessWidget {
|
||||
const ReleaseModeErrorWidget({super.key, required this.details});
|
||||
|
||||
final FlutterErrorDetails details;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
child: Text(
|
||||
'Error!\n${details.exception}',
|
||||
style: const TextStyle(color: Colors.yellow),
|
||||
textAlign: TextAlign.center,
|
||||
textDirection: TextDirection.ltr,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user