Language Switcher and Package Info / License Viewer
This commit is contained in:
parent
75a508fe74
commit
e383085268
Binary file not shown.
After Width: | Height: | Size: 6.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 48 KiB |
|
@ -75,7 +75,7 @@ class CwtchFfi implements Cwtch {
|
||||||
var startCwtchC = library.lookup<NativeFunction<start_cwtch_function>>("c_StartCwtch");
|
var startCwtchC = library.lookup<NativeFunction<start_cwtch_function>>("c_StartCwtch");
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
final StartCwtch = startCwtchC.asFunction<StartCwtchFn>();
|
final StartCwtch = startCwtchC.asFunction<StartCwtchFn>();
|
||||||
StartCwtch(Utf8.toUtf8(cwtchDir), cwtchDir.length, Utf8.toUtf8(""), 0);
|
StartCwtch(cwtchDir.toNativeUtf8(), cwtchDir.length, "".toNativeUtf8(), 0);
|
||||||
|
|
||||||
// Spawn an isolate to listen to events from libcwtch-go and then dispatch them when received on main thread to cwtchNotifier
|
// Spawn an isolate to listen to events from libcwtch-go and then dispatch them when received on main thread to cwtchNotifier
|
||||||
var _receivePort = ReceivePort();
|
var _receivePort = ReceivePort();
|
||||||
|
@ -110,7 +110,7 @@ class CwtchFfi implements Cwtch {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
Pointer<Utf8> result = GetAppbusEvent();
|
Pointer<Utf8> result = GetAppbusEvent();
|
||||||
String event = Utf8.fromUtf8(result);
|
String event = result.toDartString();
|
||||||
yield event;
|
yield event;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -121,7 +121,7 @@ class CwtchFfi implements Cwtch {
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
final SelectProfile = selectProfileC.asFunction<GetJsonBlobStringFn>();
|
final SelectProfile = selectProfileC.asFunction<GetJsonBlobStringFn>();
|
||||||
|
|
||||||
SelectProfile(Utf8.toUtf8(onion), onion.length);
|
SelectProfile(onion.toNativeUtf8(), onion.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
|
@ -129,7 +129,7 @@ class CwtchFfi implements Cwtch {
|
||||||
var createProfileC = library.lookup<NativeFunction<void_from_string_string_function>>("c_CreateProfile");
|
var createProfileC = library.lookup<NativeFunction<void_from_string_string_function>>("c_CreateProfile");
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
final CreateProfile = createProfileC.asFunction<VoidFromStringStringFn>();
|
final CreateProfile = createProfileC.asFunction<VoidFromStringStringFn>();
|
||||||
CreateProfile(Utf8.toUtf8(nick), nick.length, Utf8.toUtf8(pass), pass.length);
|
CreateProfile(nick.toNativeUtf8(), nick.length, pass.toNativeUtf8(), pass.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
|
@ -137,7 +137,7 @@ class CwtchFfi implements Cwtch {
|
||||||
var loadProfileC = library.lookup<NativeFunction<string_to_void_function>>("c_LoadProfiles");
|
var loadProfileC = library.lookup<NativeFunction<string_to_void_function>>("c_LoadProfiles");
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
final LoadProfiles = loadProfileC.asFunction<StringFn>();
|
final LoadProfiles = loadProfileC.asFunction<StringFn>();
|
||||||
LoadProfiles(Utf8.toUtf8(pass), pass.length);
|
LoadProfiles(pass.toNativeUtf8(), pass.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<String> ACNEvents() async {
|
Future<String> ACNEvents() async {
|
||||||
|
@ -147,7 +147,7 @@ class CwtchFfi implements Cwtch {
|
||||||
final ACNEvents = acnEventsC.asFunction<ACNEventsFn>();
|
final ACNEvents = acnEventsC.asFunction<ACNEventsFn>();
|
||||||
|
|
||||||
Pointer<Utf8> result = ACNEvents();
|
Pointer<Utf8> result = ACNEvents();
|
||||||
String event = Utf8.fromUtf8(result);
|
String event = result.toDartString();
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ class CwtchFfi implements Cwtch {
|
||||||
final ContactEvents = acnEventsC.asFunction<ACNEventsFn>();
|
final ContactEvents = acnEventsC.asFunction<ACNEventsFn>();
|
||||||
|
|
||||||
Pointer<Utf8> result = ContactEvents();
|
Pointer<Utf8> result = ContactEvents();
|
||||||
String event = Utf8.fromUtf8(result);
|
String event = result.toDartString();
|
||||||
return event;
|
return event;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,7 +169,7 @@ class CwtchFfi implements Cwtch {
|
||||||
final GetProfiles = getProfilesC.asFunction<GetJsonBlobVoidFn>();
|
final GetProfiles = getProfilesC.asFunction<GetJsonBlobVoidFn>();
|
||||||
|
|
||||||
Pointer<Utf8> jsonProfilesBytes = GetProfiles();
|
Pointer<Utf8> jsonProfilesBytes = GetProfiles();
|
||||||
String jsonProfiles = Utf8.fromUtf8(jsonProfilesBytes);
|
String jsonProfiles = jsonProfilesBytes.toDartString();
|
||||||
return jsonProfiles;
|
return jsonProfiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,8 +177,8 @@ class CwtchFfi implements Cwtch {
|
||||||
var getContactsC = library.lookup<NativeFunction<get_json_blob_string_function>>("c_GetContacts");
|
var getContactsC = library.lookup<NativeFunction<get_json_blob_string_function>>("c_GetContacts");
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
final GetContacts = getContactsC.asFunction<GetJsonBlobStringFn>();
|
final GetContacts = getContactsC.asFunction<GetJsonBlobStringFn>();
|
||||||
Pointer<Utf8> jsonContactBytes = GetContacts(Utf8.toUtf8(onion), onion.length);
|
Pointer<Utf8> jsonContactBytes = GetContacts(onion.toNativeUtf8(), onion.length);
|
||||||
String jsonContacts = Utf8.fromUtf8(jsonContactBytes);
|
String jsonContacts = jsonContactBytes.toDartString();
|
||||||
return jsonContacts;
|
return jsonContacts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ class CwtchFfi implements Cwtch {
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
final NumMessages = numMessagesC.asFunction<GetIntFromStrStrFn>();
|
final NumMessages = numMessagesC.asFunction<GetIntFromStrStrFn>();
|
||||||
|
|
||||||
int num = NumMessages(Utf8.toUtf8(profile), profile.length, Utf8.toUtf8(handle), handle.length);
|
int num = NumMessages(profile.toNativeUtf8(), profile.length, handle.toNativeUtf8(), handle.length);
|
||||||
return num;
|
return num;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,8 +196,8 @@ class CwtchFfi implements Cwtch {
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
final GetMessage = getMessageC.asFunction<GetJsonBlobFromStrStrIntFn>();
|
final GetMessage = getMessageC.asFunction<GetJsonBlobFromStrStrIntFn>();
|
||||||
|
|
||||||
Pointer<Utf8> jsonMessageBytes = GetMessage(Utf8.toUtf8(profile), profile.length, Utf8.toUtf8(handle), handle.length, index);
|
Pointer<Utf8> jsonMessageBytes = GetMessage(profile.toNativeUtf8(), profile.length, handle.toNativeUtf8(), handle.length, index);
|
||||||
String jsonMessage = Utf8.fromUtf8(jsonMessageBytes);
|
String jsonMessage = jsonMessageBytes.toDartString();
|
||||||
return jsonMessage;
|
return jsonMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,8 +206,8 @@ class CwtchFfi implements Cwtch {
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
final GetMessages = getMessagesC.asFunction<GetJsonBlobFromStrStrIntIntFn>();
|
final GetMessages = getMessagesC.asFunction<GetJsonBlobFromStrStrIntIntFn>();
|
||||||
|
|
||||||
Pointer<Utf8> jsonMessagesBytes = GetMessages(Utf8.toUtf8(profile), profile.length, Utf8.toUtf8(handle), handle.length, start, end);
|
Pointer<Utf8> jsonMessagesBytes = GetMessages(profile.toNativeUtf8(), profile.length, handle.toNativeUtf8(), handle.length, start, end);
|
||||||
String jsonMessages = Utf8.fromUtf8(jsonMessagesBytes);
|
String jsonMessages = jsonMessagesBytes.toDartString();
|
||||||
return jsonMessages;
|
return jsonMessages;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,6 +216,6 @@ class CwtchFfi implements Cwtch {
|
||||||
var sendAppBusEvent = library.lookup<NativeFunction<string_string_to_void_function>>("c_SendProfileEvent");
|
var sendAppBusEvent = library.lookup<NativeFunction<string_string_to_void_function>>("c_SendProfileEvent");
|
||||||
// ignore: non_constant_identifier_names
|
// ignore: non_constant_identifier_names
|
||||||
final SendAppBusEvent = sendAppBusEvent.asFunction<StringStringFn>();
|
final SendAppBusEvent = sendAppBusEvent.asFunction<StringStringFn>();
|
||||||
SendAppBusEvent(Utf8.toUtf8(onion), onion.length, Utf8.toUtf8(json), json.length);
|
SendAppBusEvent(onion.toNativeUtf8(), onion.length, json.toNativeUtf8(), json.length);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,7 @@
|
||||||
import 'package:flutter_app/cwtch/ffi.dart';
|
import 'package:flutter_app/cwtch/ffi.dart';
|
||||||
import 'package:flutter_app/cwtch/gomobile.dart';
|
import 'package:flutter_app/cwtch/gomobile.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter_app/settings.dart';
|
||||||
import 'package:flutter_app/views/triplecolview.dart';
|
import 'package:flutter_app/views/triplecolview.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'cwtch/cwtch.dart';
|
import 'cwtch/cwtch.dart';
|
||||||
|
@ -36,6 +37,7 @@ class FlwtchState extends State<Flwtch> {
|
||||||
initState() {
|
initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
cwtchInit = false;
|
cwtchInit = false;
|
||||||
|
|
||||||
profs = ProfileListState();
|
profs = ProfileListState();
|
||||||
var cwtchNotifier = new CwtchNotifier(profs);
|
var cwtchNotifier = new CwtchNotifier(profs);
|
||||||
|
|
||||||
|
@ -54,6 +56,7 @@ class FlwtchState extends State<Flwtch> {
|
||||||
appStatus = AppModel(cwtch: cwtch);
|
appStatus = AppModel(cwtch: cwtch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChangeNotifierProvider<Settings> getSettingsProvider() => ChangeNotifierProvider(create: (context) => Settings(Locale("en", '')));
|
||||||
ChangeNotifierProvider<OpaqueTheme> getOpaqueProvider() => ChangeNotifierProvider(create: (context) => OpaqueTheme(Opaque.dark));
|
ChangeNotifierProvider<OpaqueTheme> getOpaqueProvider() => ChangeNotifierProvider(create: (context) => OpaqueTheme(Opaque.dark));
|
||||||
Provider<FlwtchState> getFlwtchStateProvider() => Provider<FlwtchState>(create: (_) => this);
|
Provider<FlwtchState> getFlwtchStateProvider() => Provider<FlwtchState>(create: (_) => this);
|
||||||
ChangeNotifierProvider<ProfileListState> getProfileListProvider() => ChangeNotifierProvider(create: (context) => profs);
|
ChangeNotifierProvider<ProfileListState> getProfileListProvider() => ChangeNotifierProvider(create: (context) => profs);
|
||||||
|
@ -62,17 +65,13 @@ class FlwtchState extends State<Flwtch> {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
appStatus = AppModel(cwtch: cwtch);
|
appStatus = AppModel(cwtch: cwtch);
|
||||||
|
|
||||||
final newTextTheme = Theme.of(context).textTheme.apply(
|
|
||||||
bodyColor: Opaque.current().mainTextColor(),
|
|
||||||
displayColor: Opaque.current().mainTextColor(),
|
|
||||||
);
|
|
||||||
|
|
||||||
return MultiProvider(
|
return MultiProvider(
|
||||||
providers: [getFlwtchStateProvider(), getProfileListProvider(), getOpaqueProvider()],
|
providers: [getFlwtchStateProvider(), getProfileListProvider(), getOpaqueProvider(), getSettingsProvider()],
|
||||||
builder: (context, widget) {
|
builder: (context, widget) {
|
||||||
|
Provider.of<Settings>(context).initPackageInfo();
|
||||||
return Consumer<OpaqueTheme>(
|
return Consumer<OpaqueTheme>(
|
||||||
builder: (context, opaque, child) => MaterialApp(
|
builder: (context, opaque, child) => MaterialApp(
|
||||||
locale: Locale("en",''),
|
locale: Provider.of<Settings>(context).locale,
|
||||||
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||||
supportedLocales: AppLocalizations.supportedLocales,
|
supportedLocales: AppLocalizations.supportedLocales,
|
||||||
title: 'Cwtch',
|
title: 'Cwtch',
|
||||||
|
@ -83,7 +82,39 @@ class FlwtchState extends State<Flwtch> {
|
||||||
canvasColor: opaque.current().backgroundPaneColor(),
|
canvasColor: opaque.current().backgroundPaneColor(),
|
||||||
accentColor: opaque.current().defaultButtonColor(),
|
accentColor: opaque.current().defaultButtonColor(),
|
||||||
buttonColor: opaque.current().defaultButtonColor(),
|
buttonColor: opaque.current().defaultButtonColor(),
|
||||||
textTheme: newTextTheme,
|
backgroundColor: opaque.current().backgroundMainColor(),
|
||||||
|
iconTheme: IconThemeData (
|
||||||
|
color: opaque.current().mainTextColor(),
|
||||||
|
),
|
||||||
|
cardColor: opaque.current().backgroundMainColor(),
|
||||||
|
textButtonTheme: TextButtonThemeData (
|
||||||
|
style: ButtonStyle(
|
||||||
|
backgroundColor: MaterialStateProperty.all(opaque.current().defaultButtonColor()),
|
||||||
|
foregroundColor: MaterialStateProperty.all(opaque.current().defaultButtonTextColor()),
|
||||||
|
overlayColor: MaterialStateProperty.all(opaque.current().defaultButtonActiveColor()),
|
||||||
|
padding: MaterialStateProperty.all(EdgeInsets.all(20))
|
||||||
|
),
|
||||||
|
),
|
||||||
|
dialogTheme: DialogTheme (
|
||||||
|
backgroundColor: opaque.current().backgroundPaneColor(),
|
||||||
|
titleTextStyle: TextStyle( color: opaque.current().mainTextColor()),
|
||||||
|
contentTextStyle: TextStyle( color: opaque.current().mainTextColor())
|
||||||
|
),
|
||||||
|
textTheme: TextTheme(
|
||||||
|
headline1: TextStyle( color: opaque.current().mainTextColor()),
|
||||||
|
headline2: TextStyle( color: opaque.current().mainTextColor()),
|
||||||
|
headline3: TextStyle( color: opaque.current().mainTextColor()),
|
||||||
|
headline4: TextStyle( color: opaque.current().mainTextColor()),
|
||||||
|
headline5: TextStyle( color: opaque.current().mainTextColor()),
|
||||||
|
headline6: TextStyle( color: opaque.current().mainTextColor()),
|
||||||
|
bodyText1: TextStyle( color: opaque.current().mainTextColor()),
|
||||||
|
bodyText2: TextStyle( color: opaque.current().mainTextColor()),
|
||||||
|
subtitle1: TextStyle( color: opaque.current().mainTextColor()),
|
||||||
|
subtitle2: TextStyle( color: opaque.current().mainTextColor()),
|
||||||
|
caption: TextStyle( color: opaque.current().mainTextColor()),
|
||||||
|
button: TextStyle( color: opaque.current().mainTextColor()),
|
||||||
|
overline: TextStyle( color: opaque.current().mainTextColor())
|
||||||
|
),
|
||||||
),
|
),
|
||||||
// from dan: home: cwtchInit == true ? ProfileMgrView(cwtch) : SplashView(),
|
// from dan: home: cwtchInit == true ? ProfileMgrView(cwtch) : SplashView(),
|
||||||
// from erinn: home: columns.length == 3 ? TripleColumnView() : ProfileMgrView(),
|
// from erinn: home: columns.length == 3 ? TripleColumnView() : ProfileMgrView(),
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
import 'dart:ui';
|
||||||
|
import 'dart:core';
|
||||||
|
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
|
|
||||||
|
class Settings extends ChangeNotifier {
|
||||||
|
Locale locale;
|
||||||
|
|
||||||
|
PackageInfo packageInfo;
|
||||||
|
|
||||||
|
initPackageInfo() {
|
||||||
|
PackageInfo.fromPlatform().then((PackageInfo newPackageInfo) {
|
||||||
|
packageInfo = newPackageInfo;
|
||||||
|
notifyListeners();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
switchLocale(Locale newLocale) {
|
||||||
|
locale = newLocale;
|
||||||
|
notifyListeners();
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings(this.locale);
|
||||||
|
}
|
|
@ -1,19 +1,21 @@
|
||||||
|
import 'dart:io';
|
||||||
|
import 'package:package_info_plus/package_info_plus.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_app/opaque.dart';
|
import 'package:flutter_app/opaque.dart';
|
||||||
|
import 'package:flutter_app/settings.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
import '../main.dart';
|
||||||
|
|
||||||
class GlobalSettingsView extends StatefulWidget {
|
class GlobalSettingsView extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
_GlobalSettingsViewState createState() => _GlobalSettingsViewState();
|
_GlobalSettingsViewState createState() => _GlobalSettingsViewState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
||||||
final myController = TextEditingController();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
myController.dispose();
|
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,40 +30,80 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildSettingsList() {
|
Widget _buildSettingsList() {
|
||||||
return Consumer<OpaqueTheme>(
|
return Consumer<OpaqueTheme>(builder: (context, theme, child) {
|
||||||
builder: (context, theme, child) {
|
return Center(
|
||||||
return Center(child: Column(
|
child: Column(children: [
|
||||||
children: [
|
ListTile(
|
||||||
Text(AppLocalizations.of(context).settingLanguage),
|
title: Text(AppLocalizations.of(context).settingLanguage, style: TextStyle(color: theme.current().mainTextColor())),
|
||||||
TextField(
|
leading: Icon(Icons.language, color: theme.current().mainTextColor()),
|
||||||
controller: myController,
|
trailing: DropdownButton(
|
||||||
onChanged: (text) {
|
value: Provider.of<Settings>(context).locale.languageCode,
|
||||||
print("First text field: $text");
|
onChanged: (String newValue) {
|
||||||
},
|
setState(() {
|
||||||
),
|
Provider.of<Settings>(context, listen: false).switchLocale(Locale(newValue, ''));
|
||||||
Text(AppLocalizations.of(context).settingInterfaceZoom),
|
});
|
||||||
SwitchListTile(
|
},
|
||||||
title: Text('Theme',
|
items: AppLocalizations.supportedLocales.map<DropdownMenuItem<String>>((Locale value) {
|
||||||
style: TextStyle(color: theme.current().mainTextColor())),
|
return DropdownMenuItem<String>(
|
||||||
value: theme.current() == Opaque.light,
|
value: value.languageCode,
|
||||||
onChanged: (bool value) {
|
child: Text(getLanguageFull(context, value.languageCode)),
|
||||||
if (value) {
|
);
|
||||||
theme.setLight();
|
}).toList())),
|
||||||
} else {
|
SwitchListTile(
|
||||||
theme.setDark();
|
title: Text(AppLocalizations.of(context).settingTheme, style: TextStyle(color: theme.current().mainTextColor())),
|
||||||
}
|
value: theme.current() == Opaque.light,
|
||||||
},
|
onChanged: (bool value) {
|
||||||
secondary: Icon(Icons.lightbulb_outline,
|
if (value) {
|
||||||
color: theme.current().mainTextColor()),
|
theme.setLight();
|
||||||
),
|
} else {
|
||||||
Text(AppLocalizations.of(context).experimentsEnabled),
|
theme.setDark();
|
||||||
Text("Text magnification reference"),//dev
|
}
|
||||||
Text("Acknowledgements"),//todo
|
},
|
||||||
Text(AppLocalizations.of(context).version),
|
secondary: Icon(Icons.lightbulb_outline, color: theme.current().mainTextColor()),
|
||||||
Text(AppLocalizations.of(context).builddate),
|
),
|
||||||
]
|
AboutListTile(
|
||||||
));
|
icon: Icon(Icons.info, color: theme.current().mainTextColor()),
|
||||||
}
|
applicationIcon: Padding(
|
||||||
);
|
padding: EdgeInsets.all(20),
|
||||||
|
child: Image(
|
||||||
|
image: AssetImage("assets/knott.png"),
|
||||||
|
width: 128,
|
||||||
|
height: 128,
|
||||||
|
)),
|
||||||
|
applicationName: "Cwtch (Flutter UI)",
|
||||||
|
applicationVersion: AppLocalizations.of(context).version.replaceAll("%1", constructVersionString(Provider.of<Settings>(context).packageInfo)),
|
||||||
|
applicationLegalese: '\u{a9} 2021 Open Privacy Research Society',
|
||||||
|
),
|
||||||
|
]));
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String constructVersionString(PackageInfo pinfo) {
|
||||||
|
if (pinfo == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
return pinfo.version + "." + pinfo.buildNumber;
|
||||||
|
}
|
||||||
|
|
||||||
|
String getLanguageFull(context, String languageCode) {
|
||||||
|
if (languageCode == "en") {
|
||||||
|
return AppLocalizations.of(context).localeEn;
|
||||||
|
}
|
||||||
|
if (languageCode == "es") {
|
||||||
|
return AppLocalizations.of(context).localeEs;
|
||||||
|
}
|
||||||
|
if (languageCode == "fr") {
|
||||||
|
return AppLocalizations.of(context).localeFr;
|
||||||
|
}
|
||||||
|
if (languageCode == "pt") {
|
||||||
|
return AppLocalizations.of(context).localePt;
|
||||||
|
}
|
||||||
|
if (languageCode == "de") {
|
||||||
|
return AppLocalizations.of(context).localeDe;
|
||||||
|
}
|
||||||
|
if (languageCode == "it") {
|
||||||
|
return AppLocalizations.of(context).localeIt;
|
||||||
|
}
|
||||||
|
return languageCode;
|
||||||
|
}
|
||||||
|
|
124
pubspec.lock
124
pubspec.lock
|
@ -21,42 +21,42 @@ packages:
|
||||||
name: async
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.5.0-nullsafety.3"
|
version: "2.5.0"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: boolean_selector
|
name: boolean_selector
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0-nullsafety.3"
|
version: "2.1.0"
|
||||||
characters:
|
characters:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: characters
|
name: characters
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0-nullsafety.5"
|
version: "1.1.0"
|
||||||
charcode:
|
charcode:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: charcode
|
name: charcode
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0-nullsafety.3"
|
version: "1.2.0"
|
||||||
clock:
|
clock:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: clock
|
name: clock
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0-nullsafety.3"
|
version: "1.1.0"
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: collection
|
name: collection
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.15.0-nullsafety.5"
|
version: "1.15.0"
|
||||||
convert:
|
convert:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -84,21 +84,21 @@ packages:
|
||||||
name: fake_async
|
name: fake_async
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0-nullsafety.3"
|
version: "1.2.0"
|
||||||
ffi:
|
ffi:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: ffi
|
name: ffi
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.3"
|
version: "1.0.0"
|
||||||
file:
|
file:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: file
|
name: file
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "6.0.0-nullsafety.4"
|
version: "6.1.0"
|
||||||
flutter:
|
flutter:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description: flutter
|
description: flutter
|
||||||
|
@ -115,12 +115,17 @@ packages:
|
||||||
name: flutter_lokalise
|
name: flutter_lokalise
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.1"
|
version: "0.1.3"
|
||||||
flutter_test:
|
flutter_test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_web_plugins:
|
||||||
|
dependency: transitive
|
||||||
|
description: flutter
|
||||||
|
source: sdk
|
||||||
|
version: "0.0.0"
|
||||||
freezed_annotation:
|
freezed_annotation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -134,21 +139,28 @@ packages:
|
||||||
name: http
|
name: http
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.2"
|
version: "0.13.0"
|
||||||
http_parser:
|
http_parser:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: http_parser
|
name: http_parser
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.4"
|
version: "4.0.0"
|
||||||
intl:
|
intl:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: intl
|
name: intl
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.17.0-nullsafety.2"
|
version: "0.17.0"
|
||||||
|
js:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: js
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "0.6.3"
|
||||||
json_annotation:
|
json_annotation:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -169,14 +181,14 @@ packages:
|
||||||
name: matcher
|
name: matcher
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.10-nullsafety.3"
|
version: "0.12.10"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0-nullsafety.6"
|
version: "1.3.0"
|
||||||
nested:
|
nested:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -184,48 +196,90 @@ packages:
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.0.4"
|
version: "0.0.4"
|
||||||
|
package_info_plus:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
name: package_info_plus
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
package_info_plus_linux:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: package_info_plus_linux
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
package_info_plus_macos:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: package_info_plus_macos
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
package_info_plus_platform_interface:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: package_info_plus_platform_interface
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
package_info_plus_web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: package_info_plus_web
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
|
package_info_plus_windows:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: package_info_plus_windows
|
||||||
|
url: "https://pub.dartlang.org"
|
||||||
|
source: hosted
|
||||||
|
version: "1.0.0"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path
|
name: path
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.0-nullsafety.3"
|
version: "1.8.0"
|
||||||
path_provider:
|
path_provider:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: path_provider
|
name: path_provider
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.6.27"
|
version: "2.0.1"
|
||||||
path_provider_linux:
|
path_provider_linux:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_linux
|
name: path_provider_linux
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.0.1+2"
|
version: "2.0.0"
|
||||||
path_provider_macos:
|
path_provider_macos:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_macos
|
name: path_provider_macos
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.0.4+8"
|
version: "2.0.0"
|
||||||
path_provider_platform_interface:
|
path_provider_platform_interface:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_platform_interface
|
name: path_provider_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.4"
|
version: "2.0.1"
|
||||||
path_provider_windows:
|
path_provider_windows:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path_provider_windows
|
name: path_provider_windows
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.0.4+3"
|
version: "2.0.0"
|
||||||
pedantic:
|
pedantic:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -246,14 +300,14 @@ packages:
|
||||||
name: plugin_platform_interface
|
name: plugin_platform_interface
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.3"
|
version: "2.0.0"
|
||||||
process:
|
process:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: process
|
name: process
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.0.0-nullsafety.4"
|
version: "4.1.0"
|
||||||
provider:
|
provider:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
@ -279,28 +333,28 @@ packages:
|
||||||
name: source_span
|
name: source_span
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.8.0-nullsafety.4"
|
version: "1.8.1"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stack_trace
|
name: stack_trace
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.10.0-nullsafety.6"
|
version: "1.10.0"
|
||||||
stream_channel:
|
stream_channel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stream_channel
|
name: stream_channel
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0-nullsafety.3"
|
version: "2.1.0"
|
||||||
string_scanner:
|
string_scanner:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: string_scanner
|
name: string_scanner
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0-nullsafety.3"
|
version: "1.1.0"
|
||||||
string_unescape:
|
string_unescape:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -314,42 +368,42 @@ packages:
|
||||||
name: term_glyph
|
name: term_glyph
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0-nullsafety.3"
|
version: "1.2.0"
|
||||||
test_api:
|
test_api:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.19-nullsafety.6"
|
version: "0.2.19"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: typed_data
|
name: typed_data
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.3.0-nullsafety.5"
|
version: "1.3.0"
|
||||||
vector_math:
|
vector_math:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vector_math
|
name: vector_math
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.0-nullsafety.5"
|
version: "2.1.0"
|
||||||
win32:
|
win32:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: win32
|
name: win32
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.7.4"
|
version: "2.0.0"
|
||||||
xdg_directories:
|
xdg_directories:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: xdg_directories
|
name: xdg_directories
|
||||||
url: "https://pub.dartlang.org"
|
url: "https://pub.dartlang.org"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.1.2"
|
version: "0.2.0"
|
||||||
yaml:
|
yaml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
|
@ -358,5 +412,5 @@ packages:
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.1"
|
version: "2.2.1"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.12.0-0.0 <3.0.0"
|
dart: ">=2.12.0-259.9.beta <3.0.0"
|
||||||
flutter: ">=1.16.0"
|
flutter: ">=1.20.0"
|
||||||
|
|
|
@ -24,6 +24,7 @@ dependencies:
|
||||||
flutter:
|
flutter:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
provider: "4.3.2+3"
|
provider: "4.3.2+3"
|
||||||
|
package_info_plus: ^1.0.0
|
||||||
#intl_translation: any
|
#intl_translation: any
|
||||||
flutter_localizations:
|
flutter_localizations:
|
||||||
sdk: flutter
|
sdk: flutter
|
||||||
|
@ -31,8 +32,9 @@ dependencies:
|
||||||
# The following adds the Cupertino Icons font to your application.
|
# The following adds the Cupertino Icons font to your application.
|
||||||
# Use with the CupertinoIcons class for iOS style icons.
|
# Use with the CupertinoIcons class for iOS style icons.
|
||||||
cupertino_icons: ^1.0.0
|
cupertino_icons: ^1.0.0
|
||||||
ffi: ^0.1.3
|
ffi: ^1.0.0
|
||||||
path_provider: ^1.6.27
|
path_provider: ^2.0.0
|
||||||
|
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
@ -75,6 +77,7 @@ flutter:
|
||||||
# https://flutter.dev/assets-and-images/#from-packages
|
# https://flutter.dev/assets-and-images/#from-packages
|
||||||
|
|
||||||
assets:
|
assets:
|
||||||
|
- assets/
|
||||||
- assets/profiles/
|
- assets/profiles/
|
||||||
|
|
||||||
# To add custom fonts to your application, add a fonts section here,
|
# To add custom fonts to your application, add a fonts section here,
|
||||||
|
|
Loading…
Reference in New Issue