redo locale select screen and fix logging for it

pull/2/head
axtlos 3 years ago
parent 3e4b13f50d
commit 5a4994ae01
No known key found for this signature in database
GPG Key ID: A468AFD71DD51D4A

@ -1,21 +1,3 @@
Chosen layout: us
Chosen variant: colemak
Username: u
Username: us
Username: use
Username: user
Enable sudo: true
Enable root: true
Hostname: h
Hostname: ho
Hostname: hos
Hostname: host
Disks: /dev/sda
/dev/nvme0n1
Selected disk: /dev/sda
Partition info: 238.5G
Selected disk: /dev/nvme0n1
Is efi: true
Chosen location: Africa
Chosen Region: Johannesburg

@ -1,16 +1,159 @@
import 'package:flutter/material.dart';
import 'package:jade_gui/functions/location/region.dart';
import 'package:jade_gui/functions/location/location.dart';
import 'package:jade_gui/locales/locales.dart';
import 'package:jade_gui/classes/location.dart';
Widget locale(next, nextPage, selectlocation, isnextpage, writeToLog) {
Widget widget;
selectlocation(getSelectedRegion());
String selectedregion = getSelectedRegion();
if (isnextpage == false) {
widget = region(nextPage, locations);
} else {
widget = location(selectedregion, next);
}
return widget;
Local chosenLocation = locations[0];
Location chosenRegion = locations[0].location[0];
Widget regionTemplate(variant, chosenLayout, nextPage, writeToLog) {
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: () {
chosenRegion = variant;
writeToLog("Chosen Region: ${chosenRegion.location}");
nextPage();
},
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(
variant.location,
style: const TextStyle(
fontWeight: FontWeight.bold,
),
),
),
),
const SizedBox(height: 10),
],
);
}
Widget locationTemplate(location, setChosenLocation, writeToLog) {
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: () {
setChosenLocation(location);
writeToLog("Chosen location: ${location.name}");
},
style: TextButton.styleFrom(
primary: Colors.white,
backgroundColor: const Color.fromARGB(255, 30, 30, 30),
shadowColor: const Color.fromARGB(100, 30, 30, 30),
padding: const EdgeInsets.all(10),
),
child: Text(
location.name,
style: const TextStyle(
fontWeight: FontWeight.bold,
),
),
),
),
const SizedBox(height: 10),
],
);
}
Widget locale(nextPage, showRegion, choseLocation, setChosenLocation,
Local chosenLocation, writeToLog) {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
const Text(
'Please select a Time zone',
style: TextStyle(
fontSize: 50,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 169, 0, 255)),
),
const SizedBox(height: 20),
Expanded(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
const SizedBox(width: 40),
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: locations
.map<Widget>((keymap) => locationTemplate(
keymap, setChosenLocation, writeToLog))
.toList(),
),
),
),
),
const SizedBox(width: 50),
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: chosenLocation.location
.map<Widget>((map) => regionTemplate(
map, chosenLocation, nextPage, writeToLog))
.toList(),
),
),
),
),
const SizedBox(width: 40),
],
),
),
const SizedBox(height: 20),
],
);
}

@ -70,6 +70,7 @@ class _JadeguiState extends State<Jadegui> {
int _selectedIndex = 0;
bool nextpage = false;
bool choseLayout = false;
bool choseRegion = false;
bool enableSudo = false;
bool enableRoot = false;
bool isEfi = false;
@ -301,21 +302,16 @@ class _JadeguiState extends State<Jadegui> {
},
() {
setState(() {
nextpage = true;
choseRegion = true;
});
},
(region) {
if (region != "") {
choseRegion,
(location) {
setState(() {
nextpage = false;
chosenLocation = location;
});
} else {
setState(() {
nextpage = true;
});
}
},
nextpage,
chosenLocation,
(value) {
writeToLog(value);
},

Loading…
Cancel
Save