2022-08-15 10:54:10 +02:00

62 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:spine_flutter/spine_flutter.dart' as spine_flutter;
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
late int majorVersion;
late int minorVersion;
@override
void initState() {
super.initState();
majorVersion = spine_flutter.spine_major_version();
minorVersion = spine_flutter.spine_minor_version();
}
@override
Widget build(BuildContext context) {
const textStyle = TextStyle(fontSize: 25);
const spacerSmall = SizedBox(height: 10);
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Native Packages'),
),
body: SingleChildScrollView(
child: Container(
padding: const EdgeInsets.all(10),
child: Column(
children: [
const Text(
'This calls a native function through FFI that is shipped as source in the package. '
'The native code is built as part of the Flutter Runner build.',
style: textStyle,
textAlign: TextAlign.center,
),
spacerSmall,
Text(
'Spine version: $majorVersion.$minorVersion',
style: textStyle,
textAlign: TextAlign.center,
)
],
),
),
),
),
);
}
}