[modular-examples] Add example mod to test elevation handling.

Test=Manually tested.

Change-Id: Iaaf382174a829530f5eb8e5ee9a248e3eac0e64a
diff --git a/examples/modular/multilevel_mod/BUILD.gn b/examples/modular/multilevel_mod/BUILD.gn
new file mode 100644
index 0000000..f9a9e72
--- /dev/null
+++ b/examples/modular/multilevel_mod/BUILD.gn
@@ -0,0 +1,28 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("//topaz/runtime/flutter_runner/flutter_app.gni")
+
+flutter_app("multilevel_mod") {
+  package_name = "multilevel_mod"
+  main_dart = "lib/main.dart"
+
+  fuchsia_package_name = "multilevel_mod"
+
+  meta = [
+    {
+      path = rebase_path("meta/multilevel_mod.cmx")
+      dest = "multilevel_mod.cmx"
+    },
+  ]
+
+  sources = [
+    "src/handlers/root_intent_handler.dart",
+  ]
+
+  deps = [
+    "//third_party/dart-pkg/git/flutter/packages/flutter",
+    "//topaz/public/dart/fuchsia_modular",
+  ]
+}
diff --git a/examples/modular/multilevel_mod/README.md b/examples/modular/multilevel_mod/README.md
new file mode 100644
index 0000000..8a06d5d
--- /dev/null
+++ b/examples/modular/multilevel_mod/README.md
@@ -0,0 +1 @@
+A simple mod to demonstrate mod elevation handling.
\ No newline at end of file
diff --git a/examples/modular/multilevel_mod/analysis_options.yaml b/examples/modular/multilevel_mod/analysis_options.yaml
new file mode 100644
index 0000000..f0cea8a
--- /dev/null
+++ b/examples/modular/multilevel_mod/analysis_options.yaml
@@ -0,0 +1,5 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+include: ../../../tools/analysis_options.yaml
diff --git a/examples/modular/multilevel_mod/lib/main.dart b/examples/modular/multilevel_mod/lib/main.dart
new file mode 100644
index 0000000..0bd9792
--- /dev/null
+++ b/examples/modular/multilevel_mod/lib/main.dart
@@ -0,0 +1,10 @@
+// Copyright 2018 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'package:fuchsia_modular/module.dart';
+import 'src/handlers/root_intent_handler.dart';
+
+void main() {
+  Module().registerIntentHandler(RootIntentHandler());
+}
diff --git a/examples/modular/multilevel_mod/lib/src/handlers/root_intent_handler.dart b/examples/modular/multilevel_mod/lib/src/handlers/root_intent_handler.dart
new file mode 100644
index 0000000..4297cb0
--- /dev/null
+++ b/examples/modular/multilevel_mod/lib/src/handlers/root_intent_handler.dart
@@ -0,0 +1,70 @@
+// Copyright 2018 The Fuchsia Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'package:flutter/material.dart';
+import 'package:fuchsia_modular/module.dart';
+
+const List<Color> _colors = const <Color>[
+  Colors.red,
+  Colors.orange,
+  Colors.yellow,
+  Colors.green,
+  Colors.blue,
+  Colors.indigo,
+  Colors.purple,
+];
+const double _elevationMultiplier = 6;
+const int _numTotalLayers = 7;
+const double _sizeMultiplier = 60;
+
+class RootIntentHandler extends IntentHandler {
+  @override
+  void handleIntent(Intent intent) {
+    // Note that this mod does not care about intent.
+    runApp(
+      MaterialApp(
+        title: 'Multilevel Mod',
+        home: Scaffold(
+          backgroundColor: Colors.black54,
+          body: Center(
+            child: Stack(
+                alignment: const Alignment(0.0, 0.0),
+                children: _createLayers(_numTotalLayers)),
+          ),
+        ),
+      ),
+    );
+  }
+
+  // Helper function to create list of concentric Material widgets.
+  List<Widget> _createLayers(int totalLayers) {
+    var layers = <Widget>[];
+    for (var i = 0; i < totalLayers; i++) {
+      // Elevation in descending order to demonstrate how flutter renders in
+      // elevation, not stack order.
+      double elevation =
+          (totalLayers * _elevationMultiplier) - (i * _elevationMultiplier);
+      Color color = _colors[i % _colors.length];
+      double sideLength = (i + 1).toDouble() * _sizeMultiplier;
+      layers.add(_makeLayer(elevation, color, sideLength, sideLength));
+    }
+    return layers;
+  }
+
+  // Helper function to create Material layer with specified elevation, color,
+  // and size. Includes text describing the elevation of the material.
+  Widget _makeLayer(
+      double elevation, Color color, double height, double width) {
+    return Material(
+      elevation: elevation,
+      child: Container(
+        color: color,
+        height: height,
+        width: width,
+        child: Text((elevation).toString(),
+            style: TextStyle(fontWeight: FontWeight.bold)),
+      ),
+    );
+  }
+}
diff --git a/examples/modular/multilevel_mod/meta/multilevel_mod.cmx b/examples/modular/multilevel_mod/meta/multilevel_mod.cmx
new file mode 100644
index 0000000..dd46ace
--- /dev/null
+++ b/examples/modular/multilevel_mod/meta/multilevel_mod.cmx
@@ -0,0 +1,22 @@
+{
+    "program": {
+        "data": "data/multilevel_mod"
+    },
+    "sandbox": {
+        "services": [
+            "fuchsia.cobalt.LoggerFactory",
+            "fuchsia.fonts.Provider",
+            "fuchsia.logger.LogSink",
+            "fuchsia.modular.Clipboard",
+            "fuchsia.modular.ContextWriter",
+            "fuchsia.modular.ModuleContext",
+            "fuchsia.netstack.Netstack",
+            "fuchsia.sys.Environment",
+            "fuchsia.ui.input.ImeService",
+            "fuchsia.ui.policy.Presenter",
+            "fuchsia.ui.scenic.Scenic",
+            "fuchsia.ui.viewsv1.ViewManager",
+            "fuchsia.wlan.service.Wlan"
+        ]
+    }
+}
\ No newline at end of file
diff --git a/examples/modular/multilevel_mod/pubspec.yaml b/examples/modular/multilevel_mod/pubspec.yaml
new file mode 100644
index 0000000..de784fc
--- /dev/null
+++ b/examples/modular/multilevel_mod/pubspec.yaml
@@ -0,0 +1,3 @@
+# Copyright 2018 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
diff --git a/packages/examples/modular b/packages/examples/modular
index 2a2b498..56daa1f 100644
--- a/packages/examples/modular
+++ b/packages/examples/modular
@@ -1,6 +1,7 @@
 {
     "packages": [
         "//topaz/examples/modular/fibonacci_agent",
+        "//topaz/examples/modular/multilevel_mod",
         "//topaz/examples/modular/shapes_mod",
         "//topaz/examples/modular/slider_mod"
     ]