flutter_app/lib/main.dart

61 lines
2.2 KiB
Dart
Raw Normal View History

import 'dart:ffi';
import 'package:ffi/ffi.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'model.dart';
import 'views/profilemgrview.dart';
void main() => runApp(Flwtch());
class Flwtch extends StatefulWidget {
final Key flwtch = GlobalKey();
@override
FlwtchState createState() => FlwtchState();
}
class FlwtchState extends State<Flwtch> {
final TextStyle biggerFont = const TextStyle(fontSize: 18);
DynamicLibrary library;
AppModel appStatus;
@override
Widget build(BuildContext context) {
library = DynamicLibrary.open("libCwtch.so");
appStatus = AppModel(library: library);
var startCwtchC = library.lookup<NativeFunction<start_cwtch_function>>("StartCwtch");
// ignore: non_constant_identifier_names
final StartCwtch = startCwtchC.asFunction<StartCwtchFn>();
2021-01-08 05:37:21 +00:00
var cwtchDir = "/home/sarah/.cwtch/dev/";
StartCwtch(Utf8.toUtf8(cwtchDir), cwtchDir.length);
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),
),
home: ProfileMgrView(),
));
}
}