add summary screen, the ui is mostly done nowgit add --all (finally)

pull/2/head
axtlos 3 years ago
parent 745db5f3d2
commit 3f76ff7906

@ -30,4 +30,5 @@ package() {
mkdir -p ${pkgdir}/opt/jade_gui/scripts/ mkdir -p ${pkgdir}/opt/jade_gui/scripts/
mv ${srcdir}/scripts/* ${pkgdir}/opt/jade_gui/scripts/. mv ${srcdir}/scripts/* ${pkgdir}/opt/jade_gui/scripts/.
chmod +x ${pkgdir}/opt/jade_gui/scripts/*
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.8 KiB

@ -21,6 +21,7 @@ Future<void> getPartitions(setState) async {
} }
Widget partitionTemplate(partition, setPartition, setPartitionInfo) { Widget partitionTemplate(partition, setPartition, setPartitionInfo) {
if (partition != "") {
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.stretch, crossAxisAlignment: CrossAxisAlignment.stretch,
@ -54,6 +55,9 @@ Widget partitionTemplate(partition, setPartition, setPartitionInfo) {
const SizedBox(height: 10), const SizedBox(height: 10),
], ],
); );
} else {
return SizedBox(height: 0);
}
} }
Widget partitioning(partitions, setState, setPartition, next, setPartitionInfo, Widget partitioning(partitions, setState, setPartition, next, setPartitionInfo,

@ -0,0 +1,286 @@
import 'package:flutter/material.dart';
import 'package:jade_gui/classes/keymap.dart';
import 'package:jade_gui/classes/desktop.dart';
import 'package:jade_gui/classes/location.dart';
import 'dart:io';
Widget infoTextTemplate(infoSection, infoText) {
return Text(
'$infoSection: $infoText',
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
);
}
Future<void> getDiskType(setState, disk) async {
final String partitions =
await Process.run("/opt/jade_gui/scripts/getDiskType.sh", [disk])
.then((ProcessResult result) {
return result.stdout;
});
setState(partitions);
}
String diskType(String disk, String diskType) {
if (disk.contains("sd") && diskType.contains("0")) {
return 'SSD';
} else if (disk.contains("sd") && diskType.contains("1")) {
return 'HDD';
} else if (disk.contains("nvme") && diskType.contains("0")) {
return 'NVME SSD';
} else if (disk.contains("nvme") && diskType.contains("1")) {
return 'NVME HDD';
} else {
return 'Unknown, report at https://git.tar.black/crystal/jade-gui';
}
}
Widget summary(
String keymap,
String layout,
bool enableSudo,
bool enableRoot,
String username,
String disk,
String diskSize,
Desktop currDesktop,
Location locale,
nextPage,
setDiskType,
String rotational,
) {
getDiskType(setDiskType, disk);
return Column(
children: [
const Text(
'Installation Summary',
style: TextStyle(
fontSize: 50,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255)),
),
Expanded(
child: GridView.count(
crossAxisCount: 3,
padding: const EdgeInsets.all(20),
shrinkWrap: true,
crossAxisSpacing: 10,
mainAxisSpacing: 10,
//mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
//const SizedBox(height: 10),
Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.black),
color: const Color.fromARGB(255, 30, 30, 30),
boxShadow: const [
BoxShadow(
color: Colors.black,
blurRadius: 2,
offset: Offset(-2, 3),
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
"Location:",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
),
const SizedBox(height: 10),
infoTextTemplate("Region", locale.region),
const SizedBox(height: 10),
infoTextTemplate("Location", locale.location),
const SizedBox(height: 10),
infoTextTemplate("locale", locale.locale),
],
),
),
//const SizedBox(height: 10),
Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.black),
color: const Color.fromARGB(255, 30, 30, 30),
boxShadow: const [
BoxShadow(
color: Colors.black,
blurRadius: 2,
offset: Offset(-2, 3),
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
"Keyboard:",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
),
const SizedBox(height: 10),
infoTextTemplate("Keymap", keymap),
const SizedBox(height: 10),
infoTextTemplate("Layout", layout),
],
),
),
//const SizedBox(height: 0),
Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.black),
color: const Color.fromARGB(255, 30, 30, 30),
boxShadow: const [
BoxShadow(
color: Colors.black,
blurRadius: 2,
offset: Offset(-2, 3),
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
"User:",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
),
const SizedBox(height: 10),
infoTextTemplate("Username", username),
const SizedBox(height: 10),
infoTextTemplate("Enable sudo", enableSudo.toString()),
const SizedBox(height: 10),
infoTextTemplate("Enable root", enableRoot.toString()),
],
),
),
Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.black),
color: const Color.fromARGB(255, 30, 30, 30),
boxShadow: const [
BoxShadow(
color: Colors.black,
blurRadius: 2,
offset: Offset(-2, 3),
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
"Desktop:",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
),
const SizedBox(height: 10),
Text(
currDesktop.name,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
),
],
),
),
const SizedBox(height: 10),
Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(color: Colors.black),
color: const Color.fromARGB(255, 30, 30, 30),
boxShadow: const [
BoxShadow(
color: Colors.black,
blurRadius: 2,
offset: Offset(-2, 3),
),
],
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text(
"Disk:",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
),
const SizedBox(height: 10),
infoTextTemplate("Disk", disk),
const SizedBox(height: 10),
infoTextTemplate("Disk Size", diskSize),
const SizedBox(height: 10),
infoTextTemplate("Disk Type", diskType(disk, rotational)),
],
),
),
],
),
),
const SizedBox(width: 60),
Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Column(
children: [
TextButton(
onPressed: () {
nextPage();
},
child: const Text(
'Install',
),
style: TextButton.styleFrom(
primary: Colors.white,
backgroundColor: const Color.fromARGB(255, 169, 0, 255),
minimumSize: const Size(100, 50),
padding: const EdgeInsets.all(10),
),
),
const SizedBox(height: 10),
],
),
const SizedBox(width: 30),
],
),
const SizedBox(height: 7)
],
),
],
);
}

@ -84,6 +84,7 @@ Widget users(
labelText: 'Username', labelText: 'Username',
labelStyle: TextStyle(color: Colors.white), labelStyle: TextStyle(color: Colors.white),
hintText: 'Enter your username', hintText: 'Enter your username',
hintStyle: TextStyle(color: Colors.white),
iconColor: Colors.white, iconColor: Colors.white,
focusColor: Color.fromARGB(100, 169, 0, 255), focusColor: Color.fromARGB(100, 169, 0, 255),
hoverColor: Colors.blue, hoverColor: Colors.blue,
@ -93,8 +94,6 @@ Widget users(
style: const TextStyle(color: Colors.white), style: const TextStyle(color: Colors.white),
onChanged: (String? value) { onChanged: (String? value) {
setUsername(value); setUsername(value);
debugPrint(value);
debugPrint("Username: $username");
}, },
validator: (String? value) { validator: (String? value) {
return (value != "" && return (value != "" &&
@ -112,6 +111,7 @@ Widget users(
labelText: 'Password', labelText: 'Password',
labelStyle: TextStyle(color: Colors.white), labelStyle: TextStyle(color: Colors.white),
hintText: 'Enter your password', hintText: 'Enter your password',
hintStyle: TextStyle(color: Colors.white),
iconColor: Colors.white, iconColor: Colors.white,
focusColor: Color.fromARGB(100, 169, 0, 255), focusColor: Color.fromARGB(100, 169, 0, 255),
hoverColor: Colors.blue, hoverColor: Colors.blue,
@ -123,9 +123,6 @@ Widget users(
), ),
onChanged: (String? value) { onChanged: (String? value) {
setPass(value); setPass(value);
debugPrint(value);
debugPrint("Password: $password");
debugPrint("Confirm: $confirmPassword");
}, },
), ),
const SizedBox(height: 10), const SizedBox(height: 10),
@ -137,6 +134,7 @@ Widget users(
labelText: 'Repeat password', labelText: 'Repeat password',
labelStyle: TextStyle(color: Colors.white), labelStyle: TextStyle(color: Colors.white),
hintText: 'Repeat your password', hintText: 'Repeat your password',
hintStyle: TextStyle(color: Colors.white),
iconColor: Colors.white, iconColor: Colors.white,
focusColor: Color.fromARGB(100, 169, 0, 255), focusColor: Color.fromARGB(100, 169, 0, 255),
hoverColor: Colors.blue, hoverColor: Colors.blue,
@ -148,14 +146,8 @@ Widget users(
), ),
onChanged: (String? value) { onChanged: (String? value) {
setConfirmPass(value); setConfirmPass(value);
debugPrint(password);
debugPrint(confirmPassword);
debugPrint(value);
}, },
validator: (String? value) { validator: (String? value) {
debugPrint(value);
debugPrint("Password: $password");
debugPrint("Confirm: $confirmPassword");
return (value != password) return (value != password)
? 'Password does not match' ? 'Password does not match'
: null; : null;
@ -236,6 +228,7 @@ Widget users(
labelText: 'Password for root user', labelText: 'Password for root user',
labelStyle: TextStyle(color: Colors.white), labelStyle: TextStyle(color: Colors.white),
hintText: 'Password for the root user', hintText: 'Password for the root user',
hintStyle: TextStyle(color: Colors.white),
iconColor: Colors.white, iconColor: Colors.white,
focusColor: Color.fromARGB(100, 169, 0, 255), focusColor: Color.fromARGB(100, 169, 0, 255),
hoverColor: Colors.blue, hoverColor: Colors.blue,
@ -247,9 +240,6 @@ Widget users(
), ),
onChanged: (String? value) { onChanged: (String? value) {
setRootPass(value); setRootPass(value);
debugPrint(value);
debugPrint("Root Password: $rootPass");
debugPrint("Root Confirm: $confirmRootPass");
}, },
), ),
), ),
@ -265,6 +255,7 @@ Widget users(
labelText: 'Repeat root password', labelText: 'Repeat root password',
labelStyle: TextStyle(color: Colors.white), labelStyle: TextStyle(color: Colors.white),
hintText: 'Repeat root password', hintText: 'Repeat root password',
hintStyle: TextStyle(color: Colors.white),
iconColor: Colors.white, iconColor: Colors.white,
focusColor: Color.fromARGB(100, 169, 0, 255), focusColor: Color.fromARGB(100, 169, 0, 255),
hoverColor: Colors.blue, hoverColor: Colors.blue,
@ -276,14 +267,8 @@ Widget users(
), ),
onChanged: (String? value) { onChanged: (String? value) {
setConfirmRootPass(value); setConfirmRootPass(value);
debugPrint(password);
debugPrint(confirmPassword);
debugPrint(value);
}, },
validator: (String? value) { validator: (String? value) {
debugPrint(value);
debugPrint("Root Password: $rootPass");
debugPrint("Root Confirm: $confirmRootPass");
return (value != rootPass) return (value != rootPass)
? 'Password does not match' ? 'Password does not match'
: null; : null;

@ -2,14 +2,7 @@ import 'package:flutter/material.dart';
import 'dart:io'; import 'dart:io';
Widget welcome(next) { Widget welcome(next) {
return Container( return Column(
//decoration: const BoxDecoration(
// image: DecorationImage(
// fit: BoxFit.cover,
// image: AssetImage('assets/welcome-bg-alt.png'),
// ),
//),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
const SizedBox(height: 50), const SizedBox(height: 50),
@ -52,7 +45,6 @@ Widget welcome(next) {
), ),
], ],
), ),
child: Expanded(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const [ children: const [
@ -74,7 +66,6 @@ Widget welcome(next) {
), ),
), ),
), ),
),
const SizedBox(width: 20), const SizedBox(width: 20),
ElevatedButton( ElevatedButton(
style: TextButton.styleFrom( style: TextButton.styleFrom(
@ -100,7 +91,6 @@ Widget welcome(next) {
), ),
], ],
), ),
child: Expanded(
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const [ children: const [
@ -122,7 +112,6 @@ Widget welcome(next) {
), ),
), ),
), ),
),
], ],
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
@ -133,6 +122,5 @@ Widget welcome(next) {
"it's recommended to try that first to see if everything works", "it's recommended to try that first to see if everything works",
style: TextStyle(fontSize: 20, color: Colors.white)) style: TextStyle(fontSize: 20, color: Colors.white))
], ],
),
); );
} }

@ -5,10 +5,11 @@ import 'package:jade_gui/functions/locale.dart';
import 'package:jade_gui/functions/keyboard.dart'; import 'package:jade_gui/functions/keyboard.dart';
import 'package:jade_gui/functions/users.dart'; import 'package:jade_gui/functions/users.dart';
import 'package:jade_gui/functions/desktop.dart'; import 'package:jade_gui/functions/desktop.dart';
import 'package:jade_gui/functions/partition.dart';
import 'package:jade_gui/functions/summary.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:jade_gui/functions/partition.dart';
void main() => runApp( void main() => runApp(
const MaterialApp( const MaterialApp(
@ -36,15 +37,11 @@ class _JadeguiState extends State<Jadegui> {
String username = ""; String username = "";
String rootPass = ""; String rootPass = "";
String confirmRootPass = ""; String confirmRootPass = "";
String partitions = ""; String disks = "";
String selectedPartition = ""; String selectedDisk = "";
String partitionInfo = ""; String partitionInfo = "";
String _diskType = "";
Desktop currDesktop = desktops[0]; Desktop currDesktop = desktops[0];
void nextslide() {
setState(() {
_selectedIndex = _selectedIndex + 1;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -142,22 +139,6 @@ class _JadeguiState extends State<Jadegui> {
fontWeight: FontWeight.bold), fontWeight: FontWeight.bold),
), ),
), ),
NavigationRailDestination(
icon: Icon(
Icons.miscellaneous_services_outlined,
color: Color.fromARGB(255, 169, 0, 255),
),
selectedIcon: Icon(
Icons.miscellaneous_services,
color: Color.fromARGB(255, 169, 0, 255),
),
label: Text(
'Misc',
style: TextStyle(
color: Color.fromARGB(100, 255, 255, 255),
fontWeight: FontWeight.bold),
),
),
NavigationRailDestination( NavigationRailDestination(
icon: Icon( icon: Icon(
Icons.pie_chart_outline, Icons.pie_chart_outline,
@ -212,7 +193,7 @@ class _JadeguiState extends State<Jadegui> {
// This is the main content. // This is the main content.
Expanded( Expanded(
child: condition(), child: condition(),
) ),
], ],
), ),
); );
@ -220,7 +201,6 @@ class _JadeguiState extends State<Jadegui> {
bool loadnextpage(region) { bool loadnextpage(region) {
bool next = false; bool next = false;
print("here");
if (region != "") { if (region != "") {
setState(() { setState(() {
next = true; next = true;
@ -266,9 +246,6 @@ class _JadeguiState extends State<Jadegui> {
}, nextpage); }, nextpage);
break; break;
case 2: case 2:
print(
"${getSelectedLocPack().region}/${getSelectedLocPack().location}");
print(getSelectedLocPack().locale);
widget = keyboard( widget = keyboard(
() { () {
setState(() { setState(() {
@ -290,7 +267,6 @@ class _JadeguiState extends State<Jadegui> {
); );
break; break;
case 3: case 3:
print("${getChosenLayout()} - ${getChosenVariant()}");
widget = users( widget = users(
(value) { (value) {
setState(() { setState(() {
@ -300,7 +276,6 @@ class _JadeguiState extends State<Jadegui> {
enableSudo, enableSudo,
(String? value) { (String? value) {
setState(() { setState(() {
debugPrint(value);
if (value != null) { if (value != null) {
password = value; password = value;
} }
@ -327,7 +302,6 @@ class _JadeguiState extends State<Jadegui> {
enableRoot, enableRoot,
(String? value) { (String? value) {
setState(() { setState(() {
debugPrint(value);
if (value != null) { if (value != null) {
rootPass = value; rootPass = value;
} }
@ -348,10 +322,6 @@ class _JadeguiState extends State<Jadegui> {
); );
break; break;
case 4: case 4:
print("Username: $username");
print("Password: $password");
print("Confirm Password: $confirmPassword");
print("Enable Root: $enableSudo");
widget = desktopView( widget = desktopView(
currDesktop, currDesktop,
(selectedDesktop) { (selectedDesktop) {
@ -367,23 +337,13 @@ class _JadeguiState extends State<Jadegui> {
); );
break; break;
case 5: case 5:
widget = const Text( widget = partitioning(disks, (value) {
'Showing Misc screen',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
);
break;
case 6:
widget = partitioning(partitions, (value) {
setState(() { setState(() {
partitions = value; disks = value;
}); });
}, (value) { }, (value) {
setState(() { setState(() {
selectedPartition = value; selectedDisk = value;
}); });
}, () { }, () {
setState(() { setState(() {
@ -393,19 +353,33 @@ class _JadeguiState extends State<Jadegui> {
setState(() { setState(() {
partitionInfo = value; partitionInfo = value;
}); });
}, selectedPartition, partitionInfo); }, selectedDisk, partitionInfo);
break; break;
case 7: case 6:
widget = const Text( widget = summary(
'Showing Summary screen', getChosenLayout(),
style: TextStyle( getChosenVariant(),
fontSize: 18, enableSudo,
fontWeight: FontWeight.bold, enableRoot,
color: Color.fromARGB(255, 169, 0, 255), username,
), selectedDisk,
partitionInfo,
currDesktop,
getSelectedLocPack(),
() {
setState(() {
_selectedIndex = _selectedIndex + 1;
});
},
(value) {
setState(() {
_diskType = value;
});
},
_diskType,
); );
break; break;
case 8: case 7:
widget = const Text( widget = const Text(
'Showing Installing screen', 'Showing Installing screen',
style: TextStyle( style: TextStyle(

@ -0,0 +1,2 @@
#!/usr/bin/bash
lsblk -d -o rota $1 | grep -v ROTA
Loading…
Cancel
Save