2021-01-06 23:09:58 +00:00
|
|
|
import 'package:flutter/material.dart';
|
2021-01-12 06:21:18 +00:00
|
|
|
import 'package:flutter_app/cwtch/ffi.dart';
|
2021-01-13 05:47:20 +00:00
|
|
|
import 'package:flutter_app/cwtch/gomobile.dart';
|
2021-01-07 19:38:06 +00:00
|
|
|
import 'package:provider/provider.dart';
|
2021-01-12 06:21:18 +00:00
|
|
|
import 'cwtch/cwtch.dart';
|
2021-01-07 19:38:06 +00:00
|
|
|
import 'model.dart';
|
|
|
|
import 'views/profilemgrview.dart';
|
2021-01-10 07:22:31 +00:00
|
|
|
import 'package:flutter/services.dart';
|
|
|
|
import 'dart:io' show Platform;
|
|
|
|
import 'package:path/path.dart' as path;
|
|
|
|
import 'package:path_provider/path_provider.dart';
|
2021-01-06 23:09:58 +00:00
|
|
|
|
2021-01-07 19:38:06 +00:00
|
|
|
void main() => runApp(Flwtch());
|
2021-01-06 23:09:58 +00:00
|
|
|
|
2021-01-07 19:38:06 +00:00
|
|
|
class Flwtch extends StatefulWidget {
|
|
|
|
final Key flwtch = GlobalKey();
|
2021-01-06 23:09:58 +00:00
|
|
|
|
2021-01-07 19:38:06 +00:00
|
|
|
@override
|
|
|
|
FlwtchState createState() => FlwtchState();
|
2021-01-06 23:09:58 +00:00
|
|
|
}
|
|
|
|
|
2021-01-07 19:38:06 +00:00
|
|
|
class FlwtchState extends State<Flwtch> {
|
|
|
|
final TextStyle biggerFont = const TextStyle(fontSize: 18);
|
2021-01-06 23:09:58 +00:00
|
|
|
|
2021-01-12 06:21:18 +00:00
|
|
|
Cwtch cwtch;
|
2021-01-07 19:38:06 +00:00
|
|
|
AppModel appStatus;
|
2021-01-06 23:09:58 +00:00
|
|
|
|
2021-01-13 05:47:20 +00:00
|
|
|
|
2021-01-10 07:22:31 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
initState() {
|
|
|
|
super.initState();
|
|
|
|
|
|
|
|
if (Platform.isAndroid) {
|
2021-01-13 05:47:20 +00:00
|
|
|
cwtch = CwtchGomobile();
|
|
|
|
} else {
|
|
|
|
cwtch = CwtchFfi();
|
2021-01-10 07:22:31 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-06 23:09:58 +00:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2021-01-12 06:21:18 +00:00
|
|
|
appStatus = AppModel(cwtch: cwtch);
|
2021-01-13 05:47:20 +00:00
|
|
|
cwtch.Start();
|
2021-01-06 23:09:58 +00:00
|
|
|
|
2021-01-07 19:38:06 +00:00
|
|
|
return Provider<FlwtchState>(
|
|
|
|
create: (_) => this,
|
|
|
|
child: MaterialApp(
|
|
|
|
title: 'Flutter Demo',
|
|
|
|
theme: ThemeData(
|
|
|
|
// This is the theme of your application.
|
|
|
|
//
|
|
|
|
// Try running your application with "flutter run". You'll see the
|
|
|
|
// application has a blue toolbar. Then, without quitting the app, try
|
|
|
|
// changing the primarySwatch below to Colors.green and then invoke
|
|
|
|
// "hot reload" (press "r" in the console where you ran "flutter run",
|
|
|
|
// or simply save your changes to "hot reload" in a Flutter IDE).
|
|
|
|
// Notice that the counter didn't reset back to zero; the application
|
|
|
|
// is not restarted.
|
|
|
|
primarySwatch: Colors.blue,
|
|
|
|
// This makes the visual density adapt to the platform that you run
|
|
|
|
// the app on. For desktop platforms, the controls will be smaller and
|
|
|
|
// closer together (more dense) than on mobile platforms.
|
|
|
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
|
|
|
primaryColor: Color(0xFF4B3557),
|
|
|
|
canvasColor: Color(0xFFB09CBC),
|
|
|
|
accentColor: Color(0xFFD01972),
|
2021-01-06 23:09:58 +00:00
|
|
|
),
|
2021-01-07 19:38:06 +00:00
|
|
|
home: ProfileMgrView(),
|
|
|
|
));
|
2021-01-06 23:09:58 +00:00
|
|
|
}
|
2021-01-07 19:38:06 +00:00
|
|
|
}
|