Add scaling, fix #15

pull/2/head
axtlos 3 years ago
parent f045a651f4
commit 5cc16d00fa
No known key found for this signature in database
GPG Key ID: A468AFD71DD51D4A

@ -1,9 +1,2 @@
Chosen location: Asia Desktop: gnome
Chosen Region: Aqtau
Chosen layout: at
Chosen variant: normal
Username: e
Username:
Username: u
Enable sudo: true

@ -11,6 +11,7 @@ import 'package:jade_gui/functions/install.dart';
import 'package:jade_gui/classes/keymap.dart'; import 'package:jade_gui/classes/keymap.dart';
import 'package:jade_gui/classes/desktop.dart'; import 'package:jade_gui/classes/desktop.dart';
import 'package:jade_gui/desktops/desktops.dart'; import 'package:jade_gui/desktops/desktops.dart';
import 'package:window_size/window_size.dart';
import 'dart:io'; import 'dart:io';
@ -44,6 +45,11 @@ Future<void> writeToLog(String message) async {
}); });
} }
void setWindowSize() {
setWindowMinSize(Size(0, 0));
setWindowMaxSize(Size(1300, 870));
}
void main() => runApp( void main() => runApp(
const MaterialApp( const MaterialApp(
debugShowCheckedModeBanner: false, debugShowCheckedModeBanner: false,
@ -69,7 +75,7 @@ class Jadegui extends StatefulWidget {
} }
class _JadeguiState extends State<Jadegui> { class _JadeguiState extends State<Jadegui> {
var file = File("jade_log.txt").writeAsString(""); var file = File('${env["HOME"]}/jade_log.txt').writeAsString("");
int _selectedIndex = 0; int _selectedIndex = 0;
bool nextpage = false; bool nextpage = false;
bool choseLayout = false; bool choseLayout = false;
@ -101,6 +107,7 @@ class _JadeguiState extends State<Jadegui> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
setWindowSize();
return Scaffold( return Scaffold(
backgroundColor: const Color.fromARGB(255, 23, 23, 23), backgroundColor: const Color.fromARGB(255, 23, 23, 23),
body: Row( body: Row(
@ -287,14 +294,25 @@ class _JadeguiState extends State<Jadegui> {
Widget condition() { Widget condition() {
Widget widget; Widget widget;
double logicWidth = 1300;
double logicHeight = 870;
switch (_selectedIndex) { switch (_selectedIndex) {
case 0: case 0:
widget = welcome(() { widget = SizedBox(
setState(() { child: FittedBox(
_selectedIndex = _selectedIndex + 1; fit: BoxFit.contain,
}); alignment: Alignment.center,
}); child: SizedBox(
width: logicWidth,
height: logicHeight,
child: welcome(() {
setState(() {
_selectedIndex = _selectedIndex + 1;
});
}),
),
),
);
break; break;
case 1: case 1:
widget = locale( widget = locale(
@ -323,179 +341,228 @@ class _JadeguiState extends State<Jadegui> {
break; break;
case 2: case 2:
widget = keyboard( widget = SizedBox.expand(
() { child: FittedBox(
setState(() { fit: BoxFit.contain,
_selectedIndex = _selectedIndex + 1; alignment: Alignment.center,
}); child: SizedBox(
}, width: logicWidth,
() { height: logicHeight,
setState(() { child: keyboard(
choseLayout = true; () {
}); setState(() {
}, _selectedIndex = _selectedIndex + 1;
choseLayout, });
(layout) { },
setState(() { () {
chosenLayout = layout; setState(() {
}); choseLayout = true;
}, });
chosenLayout, },
(value) { choseLayout,
writeToLog(value); (layout) {
}, setState(() {
chosenLayout = layout;
});
},
chosenLayout,
(value) {
writeToLog(value);
},
),
),
),
); );
break; break;
case 3: case 3:
widget = users( widget = SizedBox.expand(
(value) { child: FittedBox(
setState(() { fit: BoxFit.contain,
enableSudo = value; alignment: Alignment.center,
writeToLog("Enable sudo: $enableSudo"); child: SizedBox(
}); width: logicWidth,
}, height: logicHeight,
enableSudo, child: users(
(String? value) { (value) {
setState(() {
if (value != null) {
setPassword(value, (String encPass) {
setState(() { setState(() {
password = encPass; enableSudo = value;
clearPass = value; writeToLog("Enable sudo: $enableSudo");
}); });
}); },
} enableSudo,
}); (String? value) {
}, setState(() {
(value) { if (value != null) {
setState(() { setPassword(value, (String encPass) {
confirmPassword = value; setState(() {
}); password = encPass;
}, clearPass = value;
clearPass, });
confirmPassword, });
(value) { }
setState(() { });
username = value; },
writeToLog("Username: $username"); (value) {
}); setState(() {
}, confirmPassword = value;
username, });
(value) { },
setState(() { clearPass,
enableRoot = value; confirmPassword,
writeToLog("Enable root: $enableRoot"); (value) {
}); setState(() {
}, username = value;
enableRoot, writeToLog("Username: $username");
(String? value) { });
setState(() { },
if (value != null) { username,
rootPass = value; (value) {
} setState(() {
}); enableRoot = value;
}, writeToLog("Enable root: $enableRoot");
(value) { });
setState(() { },
confirmRootPass = value; enableRoot,
}); (String? value) {
}, setState(() {
rootPass, if (value != null) {
confirmRootPass, rootPass = value;
() { }
setState(() { });
_selectedIndex = _selectedIndex + 1; },
}); (value) {
}, setState(() {
confirmRootPass = value;
});
},
rootPass,
confirmRootPass,
() {
setState(() {
_selectedIndex = _selectedIndex + 1;
});
},
),
),
),
); );
break; break;
case 4: case 4:
debugPrint(password); widget = SizedBox.expand(
widget = desktopView( child: FittedBox(
currDesktop, fit: BoxFit.contain,
(selectedDesktop) { alignment: Alignment.center,
setState(() { child: SizedBox(
currDesktop = selectedDesktop; width: logicWidth,
writeToLog("Desktop: ${selectedDesktop.name}"); height: logicHeight,
}); child: desktopView(
}, currDesktop,
() { (selectedDesktop) {
setState(() { setState(() {
_selectedIndex = _selectedIndex + 1; currDesktop = selectedDesktop;
}); writeToLog("Desktop: ${selectedDesktop.name}");
}, });
},
() {
setState(() {
_selectedIndex = _selectedIndex + 1;
});
},
),
),
),
); );
break; break;
case 5: case 5:
widget = misc( widget = SizedBox.expand(
(value) { child: FittedBox(
setState(() { fit: BoxFit.contain,
ipv6 = value; alignment: Alignment.center,
writeToLog("IPv6: $ipv6"); child: SizedBox(
}); width: logicWidth,
}, height: logicHeight,
(value) { child: misc(
setState(() { (value) {
hostname = value; setState(() {
writeToLog("Hostname: $hostname"); ipv6 = value;
}); writeToLog("IPv6: $ipv6");
}, });
(value) { },
setState(() { (value) {
enableTimeshift = value; setState(() {
writeToLog("Enable timeshift: $enableTimeshift"); hostname = value;
}); writeToLog("Hostname: $hostname");
}, });
ipv6, },
hostname, (value) {
enableTimeshift, setState(() {
() { enableTimeshift = value;
setState(() { writeToLog("Enable timeshift: $enableTimeshift");
_selectedIndex = _selectedIndex + 1; });
}); },
}, ipv6,
hostname,
enableTimeshift,
() {
setState(() {
_selectedIndex = _selectedIndex + 1;
});
},
),
),
),
); );
break; break;
case 6: case 6:
widget = partitioning( widget = SizedBox.expand(
disks, child: FittedBox(
(value) { fit: BoxFit.contain,
setState(() { alignment: Alignment.center,
disks = value; child: SizedBox(
writeToLog("Disks: $disks"); width: logicWidth,
}); height: logicHeight,
}, child: partitioning(
(value) { disks,
setState(() { (value) {
selectedDisk = value; setState(() {
writeToLog("Selected disk: $selectedDisk"); disks = value;
}); writeToLog("Disks:widget $disks");
}, });
() { },
setState(() { (value) {
_selectedIndex = _selectedIndex + 1; setState(() {
}); selectedDisk = value;
}, writeToLog("Selected disk: $selectedDisk");
(value) { });
setState(() { },
partitionInfo = value; () {
writeToLog("Partition info: $partitionInfo"); setState(() {
}); _selectedIndex = _selectedIndex + 1;
}, });
selectedDisk, },
partitionInfo, (value) {
runningPart, setState(() {
() { partitionInfo = value;
setState(() { writeToLog("Partition info: $partitionInfo");
runningPart = true; });
}); },
}, selectedDisk,
runningInfo, partitionInfo,
() { runningPart,
setState(() { () {
runningInfo = true; setState(() {
}); runningPart = true;
}, });
},
runningInfo,
() {
setState(() {
runningInfo = true;
});
},
),
),
),
); );
break; break;
case 7: case 7:
@ -512,73 +579,93 @@ class _JadeguiState extends State<Jadegui> {
runningEfi = true; runningEfi = true;
}); });
}); });
widget = summary( widget = SizedBox.expand(
getSelectedLocPack(), child: FittedBox(
getChosenLayout(), fit: BoxFit.contain,
getChosenVariant(), alignment: Alignment.center,
username, child: SizedBox(
enableSudo, width: logicWidth,
enableRoot, height: logicHeight,
currDesktop, child: summary(
selectedDisk, getSelectedLocPack(),
isEfi, getChosenLayout(),
"grub-efi", getChosenVariant(),
hostname, username,
ipv6, enableSudo,
enableTimeshift, enableRoot,
_diskType, currDesktop,
partitionInfo, selectedDisk,
(value) { isEfi,
setState(() { "grub-efi",
_diskType = value; hostname,
//writeToLog("diskType: $_diskType"); ipv6,
}); enableTimeshift,
}, _diskType,
() { partitionInfo,
setState(() { (value) {
_selectedIndex = _selectedIndex + 1; setState(() {
}); _diskType = value;
}, //writeToLog("diskType: $_diskType");
runningSum, });
() { },
setState(() { () {
runningSum = true; setState(() {
}); _selectedIndex = _selectedIndex + 1;
}, });
},
runningSum,
() {
setState(() {
runningSum = true;
});
},
),
),
),
); );
break; break;
case 8: case 8:
widget = install( widget = SizedBox.expand(
getSelectedLocPack(), child: FittedBox(
getChosenLayout(), fit: BoxFit.contain,
getChosenVariant(), alignment: Alignment.center,
username, child: SizedBox(
password, width: logicWidth,
enableSudo, height: logicHeight,
rootPass, child: install(
currDesktop, getSelectedLocPack(),
selectedDisk, getChosenLayout(),
isEfi, getChosenVariant(),
isEfi ? "grub-efi" : "grub-legacy", username,
hostname, password,
ipv6, enableSudo,
enableTimeshift, rootPass,
(value) { currDesktop,
setState(() { selectedDisk,
if (value.compareTo(output) == 1) { isEfi,
writeToLog(value.replaceAll(output, "")); isEfi ? "grub-efi" : "grub-legacy",
} hostname,
output = output + "\n" + value; ipv6,
}); enableTimeshift,
}, (value) {
output, setState(() {
running, if (value.compareTo(output) == 1) {
(value) { writeToLog(value.replaceAll(output, ""));
setState(() { }
running = value; output = output + "\n" + value;
}); });
}, },
writeToLog, output,
running,
(value) {
setState(() {
running = value;
});
},
writeToLog,
),
),
),
); );
break; break;
default: default:

@ -6,6 +6,10 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <window_size/window_size_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) window_size_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "WindowSizePlugin");
window_size_plugin_register_with_registrar(window_size_registrar);
} }

@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
window_size
) )
set(PLUGIN_BUNDLED_LIBRARIES) set(PLUGIN_BUNDLED_LIBRARIES)

@ -289,6 +289,15 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.4.4" version: "2.4.4"
window_size:
dependency: "direct main"
description:
path: "plugins/window_size"
ref: a738913c8ce2c9f47515382d40827e794a334274
resolved-ref: a738913c8ce2c9f47515382d40827e794a334274
url: "https://github.com/google/flutter-desktop-embedding.git"
source: git
version: "0.1.0"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:

@ -36,6 +36,12 @@ dependencies:
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2
process_run: ^0.12.3+2 process_run: ^0.12.3+2
path_provider: ^2.0.9 path_provider: ^2.0.9
window_size:
git:
url: https://github.com/google/flutter-desktop-embedding.git
path: plugins/window_size
ref: a738913c8ce2c9f47515382d40827e794a334274
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save