-
Notifications
You must be signed in to change notification settings - Fork 230
/
Copy pathmain.dart
271 lines (265 loc) · 9.2 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
import 'package:arkit_plugin_example/body_tracking_page.dart';
import 'package:arkit_plugin_example/camera_properties_page.dart';
import 'package:arkit_plugin_example/check_support_page.dart';
import 'package:arkit_plugin_example/custom_animation_page.dart';
import 'package:arkit_plugin_example/custom_object_page.dart';
import 'package:arkit_plugin_example/load_gltf_or_glb_page.dart';
import 'package:arkit_plugin_example/distance_tracking_page.dart';
import 'package:arkit_plugin_example/custom_light_page.dart';
import 'package:arkit_plugin_example/earth_page.dart';
import 'package:arkit_plugin_example/hello_world.dart';
import 'package:arkit_plugin_example/image_detection_page.dart';
import 'package:arkit_plugin_example/light_estimate_page.dart';
import 'package:arkit_plugin_example/manipulation_page.dart';
import 'package:arkit_plugin_example/measure_page.dart';
import 'package:arkit_plugin_example/midas_page.dart';
import 'package:arkit_plugin_example/network_image_detection.dart';
import 'package:arkit_plugin_example/occlusion_page.dart';
import 'package:arkit_plugin_example/physics_page.dart';
import 'package:arkit_plugin_example/plane_detection_page.dart';
import 'package:arkit_plugin_example/snapshot_depth_scene.dart';
import 'package:arkit_plugin_example/snapshot_scene.dart';
import 'package:arkit_plugin_example/tap_page.dart';
import 'package:arkit_plugin_example/face_detection_page.dart';
import 'package:arkit_plugin_example/panorama_page.dart';
import 'package:arkit_plugin_example/video_page.dart';
import 'package:arkit_plugin_example/widget_projection.dart';
import 'package:arkit_plugin_example/real_time_updates.dart';
import 'package:flutter/material.dart';
void main() => runApp(MaterialApp(home: MyApp()));
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
final samples = [
Sample(
'Hello World',
'The simplest scene with all geometries.',
Icons.home,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => HelloWorldPage())),
),
Sample(
'Check configuration',
'Shows which kinds of AR configuration are supported on the device',
Icons.settings,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => CheckSupportPage())),
),
Sample(
'Earth',
'Sphere with an image texture and rotation animation.',
Icons.language,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => EarthPage())),
),
Sample(
'Tap',
'Sphere which handles tap event.',
Icons.touch_app,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => TapPage())),
),
Sample(
'Midas',
'Turns walls, floor, and Earth itself into gold by tap.',
Icons.touch_app,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => MidasPage())),
),
Sample(
'Plane Detection',
'Detects horizontal plane.',
Icons.blur_on,
() => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (c) => PlaneDetectionPage())),
),
Sample(
'Distance tracking',
'Detects horizontal plane and track distance on it.',
Icons.blur_on,
() => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (c) => DistanceTrackingPage())),
),
Sample(
'Measure',
'Measures distances',
Icons.linear_scale,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => MeasurePage())),
),
Sample(
'Physics',
'A sphere and a plane with dynamic and static physics',
Icons.file_download,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => PhysicsPage())),
),
Sample(
'Image Detection',
'Detects Earth photo and puts a 3D object near it.',
Icons.collections,
() => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (c) => ImageDetectionPage())),
),
Sample(
'Network Image Detection',
'Detects Mars photo and puts a 3D object near it.',
Icons.collections,
() => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (c) => NetworkImageDetectionPage())),
),
Sample(
'Custom Light',
'Hello World scene with a custom light spot.',
Icons.lightbulb_outline,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => CustomLightPage())),
),
Sample(
'Light Estimation',
'Estimates and applies the light around you.',
Icons.brightness_6,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => LightEstimatePage())),
),
Sample(
'Custom Object',
'Place custom object on plane with coaching overlay.',
Icons.nature,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => CustomObjectPage())),
),
Sample(
'Load .gltf or .glb',
'Load .gltf or .glb from the Flutter assets or the Documents folder',
Icons.folder_copy,
() => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (c) => LoadGltfOrGlbFilePage())),
),
Sample(
'Occlusion',
'Spheres which are not visible after horizontal and vertical planes.',
Icons.blur_circular,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => OcclusionPage())),
),
Sample(
'Manipulation',
'Custom objects with pinch and rotation events.',
Icons.threed_rotation,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => ManipulationPage())),
),
Sample(
'Face Tracking',
'Face mask sample.',
Icons.face,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => FaceDetectionPage())),
),
Sample(
'Body Tracking',
'Dash that follows your hand.',
Icons.person,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => BodyTrackingPage())),
),
Sample(
'Panorama',
'360 photo sample.',
Icons.panorama,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => PanoramaPage())),
),
Sample(
'Video',
'360 video sample.',
Icons.videocam,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => VideoPage())),
),
Sample(
'Custom Animation',
'Custom object animation. Port of https://github.com/eh3rrera/ARKitAnimation',
Icons.accessibility_new,
() => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (c) => CustomAnimationPage())),
),
Sample(
'Widget Projection',
'Flutter widgets in AR',
Icons.widgets,
() => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (c) => WidgetProjectionPage())),
),
Sample(
'Real Time Updates',
'Calls a function once per frame',
Icons.timer,
() => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (c) => RealTimeUpdatesPage())),
),
Sample(
'Snapshot',
'Make a photo of AR content',
Icons.camera,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => SnapshotScenePage())),
),
Sample(
'Camera properties',
'Shows position, Intrinsic, and resolution of the camera',
Icons.location_on,
() => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (c) => CameraPropertiesPage())),
),
Sample(
'Depth Scene Snapshot',
'Make a photo of the depth scene using LiDAR',
Icons.camera,
() => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (c) => SnapshotDepthScenePage())),
),
];
return Scaffold(
appBar: AppBar(
title: const Text('ARKit Demo'),
),
body:
ListView(children: samples.map((s) => SampleItem(item: s)).toList()),
);
}
}
class SampleItem extends StatelessWidget {
const SampleItem({
required this.item,
Key? key,
}) : super(key: key);
final Sample item;
@override
Widget build(BuildContext context) {
return Card(
child: InkWell(
onTap: () => item.onTap(),
child: ListTile(
leading: Icon(item.icon),
title: Text(
item.title,
style: Theme.of(context).textTheme.titleMedium,
),
subtitle: Text(
item.description,
style: Theme.of(context).textTheme.titleSmall,
),
),
),
);
}
}
class Sample {
const Sample(this.title, this.description, this.icon, this.onTap);
final String title;
final String description;
final IconData icon;
final Function onTap;
}