somewhat finish partitioning screen, only supports autopartitioning for now

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

@ -21,10 +21,13 @@ build() {
}
package() {
mkdir ${pkgdir}/opt/jade_gui/
install -dm755 ${pkgdir}/opt
mv ${srcdir}/gui/build/linux/x64/release/bundle ${pkgdir}/opt/jade_gui
install -dm755 ${pkgdir}/usr/bin
ln -s /opt/jade_gui/jade_gui ${pkgdir}/usr/bin/jade_gui
mkdir -p ${pkgdir}/opt/jade_gui/scripts/
mv ${srcdir}/scripts/* ${pkgdir}/opt/jade_gui/scripts/.
}

@ -0,0 +1,202 @@
import 'dart:async';
import 'dart:io';
import 'package:flutter/material.dart';
Future<void> getPartitionInfo(currPartition, setState) async {
final String partitionInfo = await Process.run(
"/opt/jade_gui/scripts/getPartitionInfo.sh", ['$currPartition'])
.then((ProcessResult results) {
return results.stdout;
});
setState(partitionInfo);
}
Future<void> getPartitions(setState) async {
final String partitions =
await Process.run("/opt/jade_gui/scripts/getPartitions.sh", [])
.then((ProcessResult result) {
return result.stdout;
});
setState(partitions);
}
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),
),
child: Text(
partition,
style: const TextStyle(
fontWeight: FontWeight.bold,
),
),
),
),
const SizedBox(height: 10),
],
);
}
Widget partitioning(partitions, setState, setPartition, next, setPartitionInfo,
selectedPartition, partitionInfo) {
return FutureBuilder(
future: getPartitions(setState),
builder: (BuildContext context, AsyncSnapshot snapshot) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'Please select a disk to install to',
style: TextStyle(
fontSize: 50,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255)),
),
const SizedBox(height: 20),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const SizedBox(width: 100),
Expanded(
child: 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: SingleChildScrollView(
primary: false,
child: Column(
children: partitions
.split('\n')
.map<Widget>((partition) => partitionTemplate(
partition, setPartition, setPartitionInfo))
.toList(),
),
),
),
),
const SizedBox(width: 100),
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Container(
padding: const EdgeInsets.all(20),
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(
children: [
const Text(
'Currently chosen Disk: ',
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
),
const SizedBox(height: 10),
Text(
selectedPartition,
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
),
const SizedBox(height: 5),
Text(
'Size: $partitionInfo',
style: const TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
),
const SizedBox(height: 5),
Image(image: AssetImage('assets/jade_logo.png')),
],
),
),
],
),
const SizedBox(width: 40),
],
),
),
const SizedBox(height: 20),
const SizedBox(width: 60),
Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Column(
children: [
TextButton(
onPressed: () {
next();
},
child: const Text(
'Next',
),
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)
],
),
],
);
},
);
}

@ -8,6 +8,7 @@ import 'package:jade_gui/functions/desktop.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(
@ -35,6 +36,9 @@ class _JadeguiState extends State<Jadegui> {
String username = "";
String rootPass = "";
String confirmRootPass = "";
String partitions = "";
String selectedPartition = "";
String partitionInfo = "";
Desktop currDesktop = desktops[0];
void nextslide() {
setState(() {
@ -373,14 +377,23 @@ class _JadeguiState extends State<Jadegui> {
);
break;
case 6:
widget = const Text(
'Showing Partitioning screen',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255),
),
);
widget = partitioning(partitions, (value) {
setState(() {
partitions = value;
});
}, (value) {
setState(() {
selectedPartition = value;
});
}, () {
setState(() {
_selectedIndex = _selectedIndex + 1;
});
}, (value) {
setState(() {
partitionInfo = value;
});
}, selectedPartition, partitionInfo);
break;
case 7:
widget = const Text(

@ -1,6 +1,13 @@
# Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile
packages:
args:
dependency: transitive
description:
name: args
url: "https://pub.dartlang.org"
source: hosted
version: "2.3.0"
async:
dependency: transitive
description:
@ -42,7 +49,7 @@ packages:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.16.0"
cupertino_icons:
dependency: "direct main"
description:
@ -57,6 +64,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
ffi:
dependency: transitive
description:
name: ffi
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
file:
dependency: transitive
description:
name: file
url: "https://pub.dartlang.org"
source: hosted
version: "6.1.2"
flutter:
dependency: "direct main"
description: flutter
@ -109,6 +130,90 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
path_provider:
dependency: "direct main"
description:
name: path_provider
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.9"
path_provider_android:
dependency: transitive
description:
name: path_provider_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.12"
path_provider_ios:
dependency: transitive
description:
name: path_provider_ios
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
path_provider_linux:
dependency: transitive
description:
name: path_provider_linux
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.5"
path_provider_macos:
dependency: transitive
description:
name: path_provider_macos
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
path_provider_platform_interface:
dependency: transitive
description:
name: path_provider_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.3"
path_provider_windows:
dependency: transitive
description:
name: path_provider_windows
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.5"
platform:
dependency: transitive
description:
name: platform
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
process:
dependency: transitive
description:
name: process
url: "https://pub.dartlang.org"
source: hosted
version: "4.2.4"
process_run:
dependency: "direct main"
description:
name: process_run
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.3+2"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
sky_engine:
dependency: transitive
description: flutter
@ -142,6 +247,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
synchronized:
dependency: transitive
description:
name: synchronized
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0+2"
term_glyph:
dependency: transitive
description:
@ -156,19 +268,34 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.4.9"
typed_data:
vector_math:
dependency: transitive
description:
name: typed_data
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
vector_math:
version: "2.1.2"
win32:
dependency: transitive
description:
name: vector_math
name: win32
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.2"
version: "2.4.4"
xdg_directories:
dependency: transitive
description:
name: xdg_directories
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.0+1"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.0"
sdks:
dart: ">=2.15.1 <3.0.0"
flutter: ">=2.8.0"

@ -34,6 +34,8 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
process_run: ^0.12.3+2
path_provider: ^2.0.9
dev_dependencies:
flutter_test:

@ -0,0 +1,2 @@
#!/usr/bin/bash
lsblk -pdo SIZE $1 | grep -v SIZE

@ -0,0 +1,2 @@
#!/usr/bin/bash
lsblk -pdo name | grep -v zram | grep -v NAME
Loading…
Cancel
Save