main.dart 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import 'package:flutter/material.dart';
  2. import 'dart:async';
  3. import 'package:flutter/services.dart';
  4. import 'package:gravity_engine/gravity_engine.dart';
  5. void main() {
  6. runApp(const MyApp());
  7. }
  8. class MyApp extends StatefulWidget {
  9. const MyApp({super.key});
  10. @override
  11. State<MyApp> createState() => _MyAppState();
  12. }
  13. class _MyAppState extends State<MyApp> {
  14. String _platformVersion = 'Unknown';
  15. @override
  16. void initState() {
  17. super.initState();
  18. initPlatformState();
  19. }
  20. // Platform messages are asynchronous, so we initialize in an async method.
  21. Future<void> initPlatformState() async {
  22. // Platform messages may fail, so we use a try/catch PlatformException.
  23. // We also handle the message potentially returning null.
  24. // If the widget was removed from the tree while the asynchronous platform
  25. // message was in flight, we want to discard the reply rather than calling
  26. // setState to update our non-existent appearance.
  27. if (!mounted) return;
  28. }
  29. @override
  30. Widget build(BuildContext context) {
  31. return MaterialApp(
  32. home: Scaffold(
  33. appBar: AppBar(
  34. title: const Text('Plugin example app'),
  35. ),
  36. body: Center(
  37. child: Text('Running on: $_platformVersion\n'),
  38. ),
  39. ),
  40. );
  41. }
  42. }