Add test for build_owner.0.dart (#157499)
Contributes to https://github.com/flutter/flutter/issues/130459 It adds a test for - `examples/api/lib/widgets/framework/build_owner.0.dart`
This commit is contained in:
@@ -8,12 +8,33 @@ import 'package:flutter/rendering.dart';
|
||||
/// Flutter code sample for [BuildOwner].
|
||||
|
||||
void main() {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
final Size size = measureWidget(const SizedBox(width: 640, height: 480));
|
||||
|
||||
// Just displays the size calculated above.
|
||||
runApp(
|
||||
WidgetsApp(
|
||||
const BuildOwnerExample(),
|
||||
);
|
||||
}
|
||||
|
||||
class BuildOwnerExample extends StatefulWidget {
|
||||
const BuildOwnerExample({
|
||||
super.key,
|
||||
});
|
||||
|
||||
@override
|
||||
State<BuildOwnerExample> createState() => _BuildOwnerExampleState();
|
||||
}
|
||||
|
||||
class _BuildOwnerExampleState extends State<BuildOwnerExample> {
|
||||
late final Size size;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
size = measureWidget(const SizedBox(width: 640, height: 480));
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// Just displays the size calculated above.
|
||||
return WidgetsApp(
|
||||
title: 'BuildOwner Sample',
|
||||
color: const Color(0xff000000),
|
||||
builder: (BuildContext context, Widget? child) {
|
||||
@@ -23,8 +44,8 @@ void main() {
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Size measureWidget(Widget widget) {
|
||||
|
||||
Reference in New Issue
Block a user