2021-01-06 23:09:58 +00:00
|
|
|
import 'dart:ffi';
|
|
|
|
import 'package:ffi/ffi.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
2021-01-07 19:38:06 +00:00
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'model.dart';
|
|
|
|
import 'views/profilemgrview.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-07 19:38:06 +00:00
|
|
|
DynamicLibrary library;
|
|
|
|
AppModel appStatus;
|
2021-01-06 23:09:58 +00:00
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2021-01-07 19:38:06 +00:00
|
|
|
library = DynamicLibrary.open("libCwtch.so");
|
|
|
|
appStatus = AppModel(library: library);
|
2021-01-06 23:09:58 +00:00
|
|
|
|
|
|
|
var startCwtchC = library.lookup<NativeFunction<start_cwtch_function>>("StartCwtch");
|
2021-01-07 19:38:06 +00:00
|
|
|
// ignore: non_constant_identifier_names
|
2021-01-06 23:09:58 +00:00
|
|
|
final StartCwtch = startCwtchC.asFunction<StartCwtchFn>();
|
|
|
|
|
2021-01-08 05:37:21 +00:00
|
|
|
var cwtchDir = "/home/sarah/.cwtch/dev/";
|
2021-01-06 23:09:58 +00:00
|
|
|
StartCwtch(Utf8.toUtf8(cwtchDir), cwtchDir.length);
|
|
|
|
|
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
|
|
|
}
|