|
|
@ -3,30 +3,10 @@ import 'dart:io';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:jade_gui/classes/partition.dart';
|
|
|
|
import 'package:jade_gui/classes/partition.dart';
|
|
|
|
|
|
|
|
|
|
|
|
Future<void> getPartition(setState, runningPart, setRunningPart) async {
|
|
|
|
Widget partitionTemplate(partition, runningInfo, setRunningInfo, mountpoints,
|
|
|
|
if (!runningPart) {
|
|
|
|
setPartitionMountpoint) {
|
|
|
|
final String partitions =
|
|
|
|
|
|
|
|
await Process.run("/opt/jade_gui/scripts/getPartitions.sh", [])
|
|
|
|
|
|
|
|
.then((ProcessResult result) {
|
|
|
|
|
|
|
|
return result.stdout;
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
var parts = <Partition>[];
|
|
|
|
|
|
|
|
for (int i = 0; i < partitions.split("\n").length; i++) {
|
|
|
|
|
|
|
|
if (partitions.split("\n")[i] != "") {
|
|
|
|
|
|
|
|
parts.add(Partition(partition: partitions.split("\n")[i]));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(parts);
|
|
|
|
|
|
|
|
setRunningPart(true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Widget partitionTemplate(Partition partition, runningInfo, setRunningInfo,
|
|
|
|
|
|
|
|
mountpoints, setPartitionMountpoint) {
|
|
|
|
|
|
|
|
String mount = "none";
|
|
|
|
String mount = "none";
|
|
|
|
if (partition != "") {
|
|
|
|
if (partition().partition != "") {
|
|
|
|
print(partition.mountpoint);
|
|
|
|
|
|
|
|
print(partition.mountpoint);
|
|
|
|
|
|
|
|
return Column(
|
|
|
|
return Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
@ -41,7 +21,7 @@ Widget partitionTemplate(Partition partition, runningInfo, setRunningInfo,
|
|
|
|
child: Row(
|
|
|
|
child: Row(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Text(
|
|
|
|
Text(
|
|
|
|
partition.partition,
|
|
|
|
partition().partition,
|
|
|
|
style: const TextStyle(
|
|
|
|
style: const TextStyle(
|
|
|
|
fontWeight: FontWeight.bold, color: Colors.white),
|
|
|
|
fontWeight: FontWeight.bold, color: Colors.white),
|
|
|
|
),
|
|
|
|
),
|
|
|
@ -49,7 +29,7 @@ Widget partitionTemplate(Partition partition, runningInfo, setRunningInfo,
|
|
|
|
child: Container(),
|
|
|
|
child: Container(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
DropdownButton<String>(
|
|
|
|
DropdownButton<String>(
|
|
|
|
value: mount,
|
|
|
|
value: partition().mountpoint,
|
|
|
|
icon: const Icon(Icons.arrow_downward),
|
|
|
|
icon: const Icon(Icons.arrow_downward),
|
|
|
|
elevation: 16,
|
|
|
|
elevation: 16,
|
|
|
|
style: const TextStyle(color: Colors.deepPurple),
|
|
|
|
style: const TextStyle(color: Colors.deepPurple),
|
|
|
@ -59,8 +39,9 @@ Widget partitionTemplate(Partition partition, runningInfo, setRunningInfo,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
onChanged: (String? newValue) {
|
|
|
|
onChanged: (String? newValue) {
|
|
|
|
setPartitionMountpoint(
|
|
|
|
setPartitionMountpoint(
|
|
|
|
partition, newValue == "" ? "none" : newValue);
|
|
|
|
partition(), newValue == "" ? "none" : newValue);
|
|
|
|
mount = newValue == "" ? "none" : newValue!;
|
|
|
|
mount = newValue == "" ? "none" : newValue!;
|
|
|
|
|
|
|
|
print(partition().mountpoint);
|
|
|
|
},
|
|
|
|
},
|
|
|
|
items:
|
|
|
|
items:
|
|
|
|
mountpoints.map<DropdownMenuItem<String>>((String value) {
|
|
|
|
mountpoints.map<DropdownMenuItem<String>>((String value) {
|
|
|
@ -86,7 +67,6 @@ Widget manualPartitioning(partitions, setState, runningPart, setRunningPart,
|
|
|
|
"none",
|
|
|
|
"none",
|
|
|
|
"/",
|
|
|
|
"/",
|
|
|
|
"/boot",
|
|
|
|
"/boot",
|
|
|
|
"/efi",
|
|
|
|
|
|
|
|
"/boot/efi",
|
|
|
|
"/boot/efi",
|
|
|
|
"/home",
|
|
|
|
"/home",
|
|
|
|
"/opt",
|
|
|
|
"/opt",
|
|
|
@ -94,180 +74,174 @@ Widget manualPartitioning(partitions, setState, runningPart, setRunningPart,
|
|
|
|
"/usr",
|
|
|
|
"/usr",
|
|
|
|
"/var"
|
|
|
|
"/var"
|
|
|
|
];
|
|
|
|
];
|
|
|
|
return FutureBuilder(
|
|
|
|
return Column(
|
|
|
|
future: getPartition(setState, runningPart, setRunningPart),
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
|
|
|
children: [
|
|
|
|
return Column(
|
|
|
|
const Text(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
'Please select a disk to install to',
|
|
|
|
children: [
|
|
|
|
style: TextStyle(
|
|
|
|
const Text(
|
|
|
|
fontSize: 50,
|
|
|
|
'Please select a disk to install to',
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color.fromARGB(255, 169, 0, 255)),
|
|
|
|
fontSize: 50,
|
|
|
|
),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
color: Color.fromARGB(255, 169, 0, 255)),
|
|
|
|
Expanded(
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
Expanded(
|
|
|
|
children: [
|
|
|
|
child: Row(
|
|
|
|
const SizedBox(width: 100),
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
Expanded(
|
|
|
|
children: [
|
|
|
|
child: Container(
|
|
|
|
const SizedBox(width: 100),
|
|
|
|
padding: const EdgeInsets.all(10),
|
|
|
|
Expanded(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
child: Container(
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
padding: const EdgeInsets.all(10),
|
|
|
|
border: Border.all(color: Colors.black),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: const Color.fromARGB(255, 30, 30, 30),
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
boxShadow: const [
|
|
|
|
border: Border.all(color: Colors.black),
|
|
|
|
BoxShadow(
|
|
|
|
color: const Color.fromARGB(255, 30, 30, 30),
|
|
|
|
color: Colors.black,
|
|
|
|
boxShadow: const [
|
|
|
|
blurRadius: 2,
|
|
|
|
BoxShadow(
|
|
|
|
offset: Offset(-2, 3),
|
|
|
|
color: Colors.black,
|
|
|
|
|
|
|
|
blurRadius: 2,
|
|
|
|
|
|
|
|
offset: Offset(-2, 3),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
|
|
|
primary: false,
|
|
|
|
|
|
|
|
child: Column(
|
|
|
|
|
|
|
|
children: partitions
|
|
|
|
|
|
|
|
.map<Widget>(
|
|
|
|
|
|
|
|
(partition) => partitionTemplate(
|
|
|
|
|
|
|
|
partition,
|
|
|
|
|
|
|
|
runningInfo,
|
|
|
|
|
|
|
|
setRunningInfo,
|
|
|
|
|
|
|
|
mountpoints,
|
|
|
|
|
|
|
|
setPartitionMountpoint,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
.toList(),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(width: 100),
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
Column(
|
|
|
|
primary: false,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
child: Column(
|
|
|
|
children: [
|
|
|
|
children: partitions
|
|
|
|
Container(
|
|
|
|
.map<Widget>(
|
|
|
|
padding: const EdgeInsets.all(20),
|
|
|
|
(partition) => partitionTemplate(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
() {
|
|
|
|
borderRadius: BorderRadius.circular(10),
|
|
|
|
return partition;
|
|
|
|
border: Border.all(color: Colors.black),
|
|
|
|
},
|
|
|
|
color: const Color.fromARGB(255, 30, 30, 30),
|
|
|
|
runningInfo,
|
|
|
|
boxShadow: const [
|
|
|
|
setRunningInfo,
|
|
|
|
BoxShadow(
|
|
|
|
mountpoints,
|
|
|
|
color: Colors.black,
|
|
|
|
setPartitionMountpoint,
|
|
|
|
blurRadius: 2,
|
|
|
|
|
|
|
|
offset: Offset(-2, 3),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
|
|
|
|
.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(
|
|
|
|
child: Column(
|
|
|
|
'Currently chosen Disk: ',
|
|
|
|
children: [
|
|
|
|
style: TextStyle(
|
|
|
|
const Text(
|
|
|
|
fontSize: 20,
|
|
|
|
'Currently chosen Disk: ',
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color.fromARGB(255, 169, 0, 255),
|
|
|
|
fontSize: 20,
|
|
|
|
),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
),
|
|
|
|
color: Color.fromARGB(255, 169, 0, 255),
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
),
|
|
|
|
const Text(
|
|
|
|
),
|
|
|
|
"selectedPartition",
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
style: TextStyle(
|
|
|
|
const Text(
|
|
|
|
fontSize: 20,
|
|
|
|
"selectedPartition",
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
style: TextStyle(
|
|
|
|
color: Color.fromARGB(255, 169, 0, 255),
|
|
|
|
fontSize: 20,
|
|
|
|
),
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
|
|
|
color: Color.fromARGB(255, 169, 0, 255),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(height: 5),
|
|
|
|
|
|
|
|
const Text(
|
|
|
|
|
|
|
|
'Size: diskInfo',
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
|
|
fontSize: 20,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
|
|
|
color: Color.fromARGB(255, 169, 0, 255),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(height: 5),
|
|
|
|
|
|
|
|
const Image(image: AssetImage('assets/jade_logo.png')),
|
|
|
|
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
|
|
|
|
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: () {
|
|
|
|
|
|
|
|
setManual(false);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
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),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 5),
|
|
|
|
child: const Text(
|
|
|
|
const Text(
|
|
|
|
"Auto Partitioning",
|
|
|
|
'Size: diskInfo',
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 20,
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
color: Color.fromARGB(255, 169, 0, 255),
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 5),
|
|
|
|
),
|
|
|
|
const Image(
|
|
|
|
|
|
|
|
image: AssetImage('assets/jade_logo.png')),
|
|
|
|
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
|
|
|
|
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: () {
|
|
|
|
|
|
|
|
setManual(false);
|
|
|
|
|
|
|
|
},
|
|
|
|
|
|
|
|
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: const Text(
|
|
|
|
|
|
|
|
"Auto Partitioning",
|
|
|
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
],
|
|
|
|
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(width: 40),
|
|
|
|
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(width: 40),
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
],
|
|
|
|
const SizedBox(width: 60),
|
|
|
|
),
|
|
|
|
Column(
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
|
|
|
|
const SizedBox(width: 60),
|
|
|
|
|
|
|
|
Column(
|
|
|
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
|
|
|
|
Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Row(
|
|
|
|
Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.end,
|
|
|
|
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Column(
|
|
|
|
TextButton(
|
|
|
|
children: [
|
|
|
|
onPressed: () {
|
|
|
|
TextButton(
|
|
|
|
next();
|
|
|
|
onPressed: () {
|
|
|
|
},
|
|
|
|
next();
|
|
|
|
child: const Text(
|
|
|
|
},
|
|
|
|
'Next',
|
|
|
|
child: const Text(
|
|
|
|
),
|
|
|
|
'Next',
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
),
|
|
|
|
primary: Colors.white,
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
backgroundColor: const Color.fromARGB(255, 169, 0, 255),
|
|
|
|
primary: Colors.white,
|
|
|
|
minimumSize: const Size(100, 50),
|
|
|
|
backgroundColor:
|
|
|
|
padding: const EdgeInsets.all(10),
|
|
|
|
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: 10),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
const SizedBox(height: 7)
|
|
|
|
const SizedBox(width: 30),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
const SizedBox(height: 7)
|
|
|
|
],
|
|
|
|
],
|
|
|
|
);
|
|
|
|
),
|
|
|
|
},
|
|
|
|
],
|
|
|
|
);
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|