From 3f76ff7906c0539ee6db6297ac16b3791cf7c36e Mon Sep 17 00:00:00 2001 From: axtlos Date: Mon, 28 Mar 2022 23:07:24 +0200 Subject: [PATCH] add summary screen, the ui is mostly done nowgit add --all (finally) --- PKGBUILD | 1 + assets/scuffednvme.png | Bin 0 -> 8020 bytes lib/functions/partition.dart | 62 ++++---- lib/functions/summary.dart | 286 +++++++++++++++++++++++++++++++++++ lib/functions/users.dart | 25 +-- lib/functions/welcome.dart | 230 +++++++++++++--------------- lib/main.dart | 92 ++++------- scripts/getDiskType.sh | 2 + 8 files changed, 469 insertions(+), 229 deletions(-) create mode 100644 assets/scuffednvme.png create mode 100644 lib/functions/summary.dart create mode 100644 scripts/getDiskType.sh diff --git a/PKGBUILD b/PKGBUILD index b2834cf..8ff2a2a 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -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/* } diff --git a/assets/scuffednvme.png b/assets/scuffednvme.png new file mode 100644 index 0000000000000000000000000000000000000000..3b4da60eb99fa463c101a4f25927c70a589e2d7f GIT binary patch literal 8020 zcmds6c~n#Pwgv%>7iEwts0@M!;zTH5g)mx#;!%XQ)&UtcBDKr}2!Sw&QKTZsi4rM+ zIJ9bI6a_>;L~7uOBq%Zu0SQE9lB5tq2)rMyuU@P7*7xpx@2&OzV6o0gvd{kQ{e63X zd!M8)ogJ6{ZPnjoWMr1Y+wH%Wk&)Gvk&$1HSqSb(*_1`#-{Royu0$CbrJDIa+1jA% zhr!L2VGjGlb_X2^BOMI&ks*;txTAr7M8d&fA6!tVZ|11gDj6B=KG^>AZz35Z-O+`4 zBoFR5XDk@m9%`3>x!(KJf`qSERe!zNLGk-j=dw#J6yUOsW2i%jzOQls1<+#Fr8s*^LxRzAs z(4&YV&Ao6!qV6x1WZ;}bL*@9k-#Z_f5Y<$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($${9!}gV&+JR>&Pg;p|&n>`_YB zt4$0w^NUv4KP^)~s15!rH4aop(6t*)5U01=;PdJhAeA?DT8M_6J@o!k|M~TGu(AmjQVXqO)C)1LrrqT0GR`#~6-v zwdUUbQTVj%c7=IPRlR;zm&Mpq+>X%M2YjnE9&&<{0jVFExY4732BPCAY^W?~uaS1w z?Iu|JY%_Pj3+xOa+w(jjtt*Z4di6eAuo$AvfZ~z1=O(Uey0R2YuES@~RDw5|wI{}! zwOk#-kD3{j5&MWeW#K(Pbu)OACphGN7M6Fe(Yi`r<9(4T_bCP(x)X5|^+|ft_AGM7 iiiJ?z-SB*oWG-}z@SM_YrUbkZmw_Fe?ep!t6aE9~rvz~T literal 0 HcmV?d00001 diff --git a/lib/functions/partition.dart b/lib/functions/partition.dart index de616ff..474393d 100644 --- a/lib/functions/partition.dart +++ b/lib/functions/partition.dart @@ -21,39 +21,43 @@ Future getPartitions(setState) async { } Widget partitionTemplate(partition, setPartition, setPartitionInfo) { - return Column( - mainAxisAlignment: MainAxisAlignment.spaceEvenly, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - Container( - padding: const EdgeInsets.all(2), - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(5), - border: Border.all(color: Colors.black45), - color: const Color.fromARGB(255, 30, 30, 30), - ), - child: ElevatedButton( - onPressed: () { - setPartition(partition); - getPartitionInfo(partition, setPartitionInfo); - }, - style: TextButton.styleFrom( - primary: Colors.white, - backgroundColor: const Color.fromARGB(0, 169, 0, 255), - shadowColor: const Color.fromARGB(0, 169, 0, 255), - padding: const EdgeInsets.all(10), + if (partition != "") { + return Column( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Container( + padding: const EdgeInsets.all(2), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(5), + border: Border.all(color: Colors.black45), + color: const Color.fromARGB(255, 30, 30, 30), ), - child: Text( - partition, - style: const TextStyle( - fontWeight: FontWeight.bold, + child: ElevatedButton( + onPressed: () { + setPartition(partition); + getPartitionInfo(partition, setPartitionInfo); + }, + style: TextButton.styleFrom( + primary: Colors.white, + backgroundColor: const Color.fromARGB(0, 169, 0, 255), + shadowColor: const Color.fromARGB(0, 169, 0, 255), + padding: const EdgeInsets.all(10), + ), + child: Text( + partition, + style: const TextStyle( + fontWeight: FontWeight.bold, + ), ), ), ), - ), - const SizedBox(height: 10), - ], - ); + const SizedBox(height: 10), + ], + ); + } else { + return SizedBox(height: 0); + } } Widget partitioning(partitions, setState, setPartition, next, setPartitionInfo, diff --git a/lib/functions/summary.dart b/lib/functions/summary.dart new file mode 100644 index 0000000..f05aa13 --- /dev/null +++ b/lib/functions/summary.dart @@ -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 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) + ], + ), + ], + ); +} diff --git a/lib/functions/users.dart b/lib/functions/users.dart index 7280bc2..1bbf49f 100644 --- a/lib/functions/users.dart +++ b/lib/functions/users.dart @@ -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; diff --git a/lib/functions/welcome.dart b/lib/functions/welcome.dart index 70513c5..81e933b 100644 --- a/lib/functions/welcome.dart +++ b/lib/functions/welcome.dart @@ -2,137 +2,125 @@ 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( - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - const SizedBox(height: 50), - const Text( - 'Welcome to Crystal Linux', - style: TextStyle( - fontSize: 30, - fontWeight: FontWeight.bold, - color: Color.fromARGB(255, 169, 0, 255), - ), + return Column( + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + const SizedBox(height: 50), + const Text( + 'Welcome to Crystal Linux', + style: TextStyle( + fontSize: 30, + fontWeight: FontWeight.bold, + color: Color.fromARGB(255, 169, 0, 255), ), - const SizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.center, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - ElevatedButton( - style: TextButton.styleFrom( - primary: const Color.fromARGB(0, 23, 23, 23), - backgroundColor: const Color.fromARGB(0, 23, 23, 23), - elevation: 0, - padding: EdgeInsets.zero, + ), + const SizedBox(height: 20), + Row( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + ElevatedButton( + style: TextButton.styleFrom( + primary: const Color.fromARGB(0, 23, 23, 23), + backgroundColor: const Color.fromARGB(0, 23, 23, 23), + elevation: 0, + padding: EdgeInsets.zero, + ), + onPressed: () { + exit(0); + }, + child: Container( + width: 500, + height: 500, + 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), + ), + ], ), - onPressed: () { - exit(0); - }, - child: Container( - width: 500, - height: 500, - 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.spaceAround, + children: const [ + SizedBox(height: 20), + Text("Try Crystal Linux without installing", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: Colors.white)), + SizedBox(height: 5), + Image( + image: AssetImage( + 'assets/crystal-logo-minimal.png', ), - ], - ), - child: Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: const [ - SizedBox(height: 20), - Text("Try Crystal Linux without installing", - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: Colors.white)), - SizedBox(height: 5), - Image( - image: AssetImage( - 'assets/crystal-logo-minimal.png', - ), - height: 400, - fit: BoxFit.scaleDown, - ), - ], + height: 400, + fit: BoxFit.scaleDown, ), - ), + ], ), ), - const SizedBox(width: 20), - ElevatedButton( - style: TextButton.styleFrom( - primary: const Color.fromARGB(0, 23, 23, 23), - backgroundColor: const Color.fromARGB(0, 23, 23, 23), - elevation: 0, - padding: EdgeInsets.zero, + ), + const SizedBox(width: 20), + ElevatedButton( + style: TextButton.styleFrom( + primary: const Color.fromARGB(0, 23, 23, 23), + backgroundColor: const Color.fromARGB(0, 23, 23, 23), + elevation: 0, + padding: EdgeInsets.zero, + ), + onPressed: next, + child: Container( + width: 500, + height: 500, + 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), + ), + ], ), - onPressed: next, - child: Container( - width: 500, - height: 500, - 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.spaceAround, + children: const [ + SizedBox(height: 20), + Text("Start the installation", + style: TextStyle( + fontSize: 20, + fontWeight: FontWeight.bold, + color: Colors.white)), + SizedBox(height: 5), + Image( + image: AssetImage( + 'assets/jade_logo.png', ), - ], - ), - child: Expanded( - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - children: const [ - SizedBox(height: 20), - Text("Start the installation", - style: TextStyle( - fontSize: 20, - fontWeight: FontWeight.bold, - color: Colors.white)), - SizedBox(height: 5), - Image( - image: AssetImage( - 'assets/jade_logo.png', - ), - height: 400, - fit: BoxFit.scaleDown, - ), - ], + height: 400, + fit: BoxFit.scaleDown, ), - ), + ], ), ), - ], - ), - const SizedBox(height: 20), - const Text( - "Starting Crystal linux without installing will not change anything on your computer,", - style: TextStyle(fontSize: 20, color: Colors.white)), - const Text( - "it's recommended to try that first to see if everything works", - style: TextStyle(fontSize: 20, color: Colors.white)) - ], - ), + ), + ], + ), + const SizedBox(height: 20), + const Text( + "Starting Crystal linux without installing will not change anything on your computer,", + style: TextStyle(fontSize: 20, color: Colors.white)), + const Text( + "it's recommended to try that first to see if everything works", + style: TextStyle(fontSize: 20, color: Colors.white)) + ], ); } diff --git a/lib/main.dart b/lib/main.dart index 3012730..439b37c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -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 { 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 { 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 { // This is the main content. Expanded( child: condition(), - ) + ), ], ), ); @@ -220,7 +201,6 @@ class _JadeguiState extends State { bool loadnextpage(region) { bool next = false; - print("here"); if (region != "") { setState(() { next = true; @@ -266,9 +246,6 @@ class _JadeguiState extends State { }, nextpage); break; case 2: - print( - "${getSelectedLocPack().region}/${getSelectedLocPack().location}"); - print(getSelectedLocPack().locale); widget = keyboard( () { setState(() { @@ -290,7 +267,6 @@ class _JadeguiState extends State { ); break; case 3: - print("${getChosenLayout()} - ${getChosenVariant()}"); widget = users( (value) { setState(() { @@ -300,7 +276,6 @@ class _JadeguiState extends State { enableSudo, (String? value) { setState(() { - debugPrint(value); if (value != null) { password = value; } @@ -327,7 +302,6 @@ class _JadeguiState extends State { enableRoot, (String? value) { setState(() { - debugPrint(value); if (value != null) { rootPass = value; } @@ -348,10 +322,6 @@ class _JadeguiState extends State { ); 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 { ); 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 { 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( diff --git a/scripts/getDiskType.sh b/scripts/getDiskType.sh new file mode 100644 index 0000000..01f6376 --- /dev/null +++ b/scripts/getDiskType.sh @@ -0,0 +1,2 @@ +#!/usr/bin/bash +lsblk -d -o rota $1 | grep -v ROTA \ No newline at end of file