Compare commits

...

3 Commits

Author SHA1 Message Date
Felix Bruns 6060abb73e remove platform specific actions from android app
10 months ago
Felix Bruns 7d93039ed7 require internet access for android
10 months ago
Felix Bruns 1db1657de3 Delay execution of settings loading
10 months ago

@ -1,4 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:label="proxmox-dash"
android:name="${applicationName}"

@ -7,7 +7,7 @@ import 'src/settings/settings_service.dart';
void main() async {
final settingsController = SettingsController(SettingsService());
await settingsController.loadSettings();
Future<void>.delayed(Duration.zero, () => settingsController.loadSettings());
Log().info("Application started");
runApp(MyApp(settingsController: settingsController));

@ -8,6 +8,7 @@ import 'package:pi_dashboard/src/screen_helper.dart';
import 'package:pi_dashboard/src/settings/settings_controller.dart';
import '../settings/settings_view.dart';
import 'vm_card.dart';
import 'dart:io' show Platform;
class ProxmoxListerView extends StatefulWidget {
const ProxmoxListerView({
@ -76,34 +77,34 @@ class _ProxmoxListerState extends State<ProxmoxListerView> {
@override
Widget build(BuildContext context) {
// infinite touch container to turn screen back on
return IdleTurnOff(
timeout: const Duration(seconds: 60),
onExpire: () async {
await turnOffScreen();
Log().info("No input for 60 seconds. Screen turned off");
},
child: Stack(
children: [
Scaffold(
appBar: appbar(context),
body: bodyBuilder(context),
),
screenActivator(),
],
),
var widget = Stack(
children: [
Scaffold(
appBar: appbar(context),
body: bodyBuilder(context),
),
],
);
if (Platform.isLinux) {
widget.children.add(screenActivator());
return IdleTurnOff(
timeout: const Duration(seconds: 60),
onExpire: () async {
await turnOffScreen();
Log().info("No input for 60 seconds. Screen turned off");
},
child: widget,
);
} else {
return widget;
}
}
PreferredSizeWidget? appbar(BuildContext context) {
return AppBar(
var app = AppBar(
title: const Text("Proxmox VMs"),
actions: [
IconButton(
icon: const Icon(Icons.nightlight),
onPressed: () {
toggleScreen();
},
),
IconButton(
icon: const Icon(Icons.sync),
onPressed: () {
@ -127,6 +128,20 @@ class _ProxmoxListerState extends State<ProxmoxListerView> {
),
],
);
if (Platform.isLinux) {
app.actions?.insert(
0,
IconButton(
icon: const Icon(Icons.nightlight),
onPressed: () {
toggleScreen();
},
),
);
}
return app;
}
Widget bodyBuilder(BuildContext context) {

Loading…
Cancel
Save