arkit_plugin 0.0.3
arkit_plugin: ^0.0.3 copied to clipboard
Flutter Plugin for ARKit - Apple's augmented reality (AR) development platform for iOS mobile devices.
example/lib/main.dart
import 'package:arkit_plugin_example/earth_page.dart';
import 'package:arkit_plugin_example/hello_world.dart';
import 'package:arkit_plugin_example/physics_page.dart';
import 'package:arkit_plugin_example/plane_detection_page.dart';
import 'package:arkit_plugin_example/tap_page.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 only 3 AR objects.',
Icons.home,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => HelloWorldPage())),
),
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(
'Plane Detection',
'Detects horizontal plane and handle tap on it.',
Icons.blur_on,
() => Navigator.of(context).push<void>(
MaterialPageRoute(builder: (c) => PlaneDetectionPage())),
),
Sample(
'Physics',
'A sphere and a plane with dynamic and static physics',
Icons.file_download,
() => Navigator.of(context)
.push<void>(MaterialPageRoute(builder: (c) => PhysicsPage())),
),
];
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({Key key, this.item}) : 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.subhead,
),
subtitle: Text(
item.description,
style: Theme.of(context).textTheme.subtitle,
),
),
),
);
}
}
class Sample {
const Sample(this.title, this.description, this.icon, this.onTap);
final String title;
final String description;
final IconData icon;
final Function onTap;
}