[inspect][dart] Copy Flutter Hello World app into Inspect app.
Subsequent CLs will plug in the use of the Inspect and child nodes.
CF-602 #comment
Change-Id: I4fc0175145ab65748657853c4fd031fc2b34c3b4
diff --git a/public/dart/fuchsia_inspect/examples/inspect_mod/lib/src/inspect_example_app.dart b/public/dart/fuchsia_inspect/examples/inspect_mod/lib/src/inspect_example_app.dart
index 8dc68f3..3c2c201 100644
--- a/public/dart/fuchsia_inspect/examples/inspect_mod/lib/src/inspect_example_app.dart
+++ b/public/dart/fuchsia_inspect/examples/inspect_mod/lib/src/inspect_example_app.dart
@@ -17,7 +17,13 @@
@override
Widget build(BuildContext context) {
- return Container(color: _appColor);
+ return MaterialApp(
+ title: 'Inspect Example',
+ theme: ThemeData(
+ primarySwatch: _appColor,
+ ),
+ home: _InspectHomePage(title: 'Hello Inspect!'),
+ );
}
/// Initializes the [Inspect] metrics for this widget.
@@ -25,3 +31,43 @@
_inspect.rootNode.createStringProperty('app-color').value = '$_appColor';
}
}
+
+class _InspectHomePage extends StatefulWidget {
+ final String title;
+
+ _InspectHomePage({Key key, this.title}) : super(key: key);
+
+ @override
+ _InspectHomePageState createState() => _InspectHomePageState();
+}
+
+class _InspectHomePageState extends State<_InspectHomePage> {
+ int _counter = 0;
+
+ void _incrementCounter() {
+ setState(() {
+ _counter++;
+ });
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return Scaffold(
+ appBar: AppBar(
+ title: Text(
+ widget.title,
+ ),
+ ),
+ body: Center(
+ child: Text(
+ 'Button tapped $_counter time${_counter == 1 ? '' : 's'}.',
+ ),
+ ),
+ floatingActionButton: FloatingActionButton(
+ onPressed: _incrementCounter,
+ tooltip: 'Increment',
+ child: Icon(Icons.add),
+ ),
+ );
+ }
+}