Add tests for restorable_value.0.dart API example. (#148676)

This PR contributes to https://github.com/flutter/flutter/issues/130459

### Description
- Updates `examples/api/lib/widgets/restoration_properties/restorable_value.0.dart` to meet the latest API examples structure
- Adds tests for `examples/api/lib/widgets/restoration_properties/restorable_value.0.dart`
This commit is contained in:
Kostia Sokolovskyi
2024-05-23 10:34:23 +02:00
committed by GitHub
parent fe0932f2c0
commit 3beeed4929
4 changed files with 69 additions and 13 deletions

View File

@@ -13,14 +13,13 @@ class RestorableValueExampleApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return WidgetsApp(
title: 'RestorableValue Sample',
color: const Color(0xffffffff),
builder: (BuildContext context, Widget? child) {
return const Center(
child: RestorableValueExample(restorationId: 'main'),
);
},
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('RestorableValue Sample'),
),
body: const RestorableValueExample(restorationId: 'main'),
),
);
}
}
@@ -72,9 +71,11 @@ class _RestorableValueExampleState extends State<RestorableValueExample> with Re
@override
Widget build(BuildContext context) {
return OutlinedButton(
onPressed: _incrementAnswer,
child: Text('${_answer.value}'),
return Center(
child: OutlinedButton(
onPressed: _incrementAnswer,
child: Text('${_answer.value}'),
),
);
}
}