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/
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) {
if (partition != "") {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.stretch,
@ -54,6 +55,9 @@ Widget partitionTemplate(partition, setPartition, setPartitionInfo) {
const SizedBox(height: 10),
],
);
} else {
return SizedBox(height: 0);
}
}
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',
labelStyle: TextStyle(color: Colors.white),
hintText: 'Enter your username',
hintStyle: TextStyle(color: Colors.white),
iconColor: Colors.white,
focusColor: Color.fromARGB(100, 169, 0, 255),
hoverColor: Colors.blue,
@ -93,8 +94,6 @@ Widget users(
style: const TextStyle(color: Colors.white),
onChanged: (String? value) {
setUsername(value);
debugPrint(value);
debugPrint("Username: $username");
},
validator: (String? value) {
return (value != "" &&
@ -112,6 +111,7 @@ Widget users(
labelText: 'Password',
labelStyle: TextStyle(color: Colors.white),
hintText: 'Enter your password',
hintStyle: TextStyle(color: Colors.white),
iconColor: Colors.white,
focusColor: Color.fromARGB(100, 169, 0, 255),
hoverColor: Colors.blue,
@ -123,9 +123,6 @@ Widget users(
),
onChanged: (String? value) {
setPass(value);
debugPrint(value);
debugPrint("Password: $password");
debugPrint("Confirm: $confirmPassword");
},
),
const SizedBox(height: 10),
@ -137,6 +134,7 @@ Widget users(
labelText: 'Repeat password',
labelStyle: TextStyle(color: Colors.white),
hintText: 'Repeat your password',
hintStyle: TextStyle(color: Colors.white),
iconColor: Colors.white,
focusColor: Color.fromARGB(100, 169, 0, 255),
hoverColor: Colors.blue,
@ -148,14 +146,8 @@ Widget users(
),
onChanged: (String? value) {
setConfirmPass(value);
debugPrint(password);
debugPrint(confirmPassword);
debugPrint(value);
},
validator: (String? value) {
debugPrint(value);
debugPrint("Password: $password");
debugPrint("Confirm: $confirmPassword");
return (value != password)
? 'Password does not match'
: null;
@ -236,6 +228,7 @@ Widget users(
labelText: 'Password for root user',
labelStyle: TextStyle(color: Colors.white),
hintText: 'Password for the root user',
hintStyle: TextStyle(color: Colors.white),
iconColor: Colors.white,
focusColor: Color.fromARGB(100, 169, 0, 255),
hoverColor: Colors.blue,
@ -247,9 +240,6 @@ Widget users(
),
onChanged: (String? value) {
setRootPass(value);
debugPrint(value);
debugPrint("Root Password: $rootPass");
debugPrint("Root Confirm: $confirmRootPass");
},
),
),
@ -265,6 +255,7 @@ Widget users(
labelText: 'Repeat root password',
labelStyle: TextStyle(color: Colors.white),
hintText: 'Repeat root password',
hintStyle: TextStyle(color: Colors.white),
iconColor: Colors.white,
focusColor: Color.fromARGB(100, 169, 0, 255),
hoverColor: Colors.blue,
@ -276,14 +267,8 @@ Widget users(
),
onChanged: (String? value) {
setConfirmRootPass(value);
debugPrint(password);
debugPrint(confirmPassword);
debugPrint(value);
},
validator: (String? value) {
debugPrint(value);
debugPrint("Root Password: $rootPass");
debugPrint("Root Confirm: $confirmRootPass");
return (value != rootPass)
? 'Password does not match'
: null;

@ -2,14 +2,7 @@ import 'package:flutter/material.dart';
import 'dart:io';
Widget welcome(next) {
return Container(
//decoration: const BoxDecoration(
// image: DecorationImage(
// fit: BoxFit.cover,
// image: AssetImage('assets/welcome-bg-alt.png'),
// ),
//),
child: Column(
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 50),
@ -52,7 +45,6 @@ Widget welcome(next) {
),
],
),
child: Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const [
@ -74,7 +66,6 @@ Widget welcome(next) {
),
),
),
),
const SizedBox(width: 20),
ElevatedButton(
style: TextButton.styleFrom(
@ -100,7 +91,6 @@ Widget welcome(next) {
),
],
),
child: Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: const [
@ -122,7 +112,6 @@ Widget welcome(next) {
),
),
),
),
],
),
const SizedBox(height: 20),
@ -133,6 +122,5 @@ Widget welcome(next) {
"it's recommended to try that first to see if everything works",
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/users.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/desktop.dart';
import 'package:jade_gui/desktops/desktops.dart';
import 'package:jade_gui/functions/partition.dart';
void main() => runApp(
const MaterialApp(
@ -36,15 +37,11 @@ class _JadeguiState extends State<Jadegui> {
String username = "";
String rootPass = "";
String confirmRootPass = "";
String partitions = "";
String selectedPartition = "";
String disks = "";
String selectedDisk = "";
String partitionInfo = "";
String _diskType = "";
Desktop currDesktop = desktops[0];
void nextslide() {
setState(() {
_selectedIndex = _selectedIndex + 1;
});
}
@override
Widget build(BuildContext context) {
@ -142,22 +139,6 @@ class _JadeguiState extends State<Jadegui> {
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(
icon: Icon(
Icons.pie_chart_outline,
@ -212,7 +193,7 @@ class _JadeguiState extends State<Jadegui> {
// This is the main content.
Expanded(
child: condition(),
)
),
],
),
);
@ -220,7 +201,6 @@ class _JadeguiState extends State<Jadegui> {
bool loadnextpage(region) {
bool next = false;
print("here");
if (region != "") {
setState(() {
next = true;
@ -266,9 +246,6 @@ class _JadeguiState extends State<Jadegui> {
}, nextpage);
break;
case 2:
print(
"${getSelectedLocPack().region}/${getSelectedLocPack().location}");
print(getSelectedLocPack().locale);
widget = keyboard(
() {
setState(() {
@ -290,7 +267,6 @@ class _JadeguiState extends State<Jadegui> {
);
break;
case 3:
print("${getChosenLayout()} - ${getChosenVariant()}");
widget = users(
(value) {
setState(() {
@ -300,7 +276,6 @@ class _JadeguiState extends State<Jadegui> {
enableSudo,
(String? value) {
setState(() {
debugPrint(value);
if (value != null) {
password = value;
}
@ -327,7 +302,6 @@ class _JadeguiState extends State<Jadegui> {
enableRoot,
(String? value) {
setState(() {
debugPrint(value);
if (value != null) {
rootPass = value;
}
@ -348,10 +322,6 @@ class _JadeguiState extends State<Jadegui> {
);
break;
case 4:
print("Username: $username");
print("Password: $password");
print("Confirm Password: $confirmPassword");
print("Enable Root: $enableSudo");
widget = desktopView(
currDesktop,
(selectedDesktop) {
@ -367,23 +337,13 @@ class _JadeguiState extends State<Jadegui> {
);
break;
case 5:
widget = const Text(
'Showing Misc screen',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
);
break;
case 6:
widget = partitioning(partitions, (value) {
widget = partitioning(disks, (value) {
setState(() {
partitions = value;
disks = value;
});
}, (value) {
setState(() {
selectedPartition = value;
selectedDisk = value;
});
}, () {
setState(() {
@ -393,19 +353,33 @@ class _JadeguiState extends State<Jadegui> {
setState(() {
partitionInfo = value;
});
}, selectedPartition, partitionInfo);
}, selectedDisk, partitionInfo);
break;
case 7:
widget = const Text(
'Showing Summary screen',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
case 6:
widget = summary(
getChosenLayout(),
getChosenVariant(),
enableSudo,
enableRoot,
username,
selectedDisk,
partitionInfo,
currDesktop,
getSelectedLocPack(),
() {
setState(() {
_selectedIndex = _selectedIndex + 1;
});
},
(value) {
setState(() {
_diskType = value;
});
},
_diskType,
);
break;
case 8:
case 7:
widget = const Text(
'Showing Installing screen',
style: TextStyle(

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