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 location: Africa
Chosen variant: colemak Chosen Region: Johannesburg
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

@ -1,16 +1,159 @@
import 'package:flutter/material.dart'; 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/locales/locales.dart';
import 'package:jade_gui/classes/location.dart';
Widget locale(next, nextPage, selectlocation, isnextpage, writeToLog) { Local chosenLocation = locations[0];
Widget widget; Location chosenRegion = locations[0].location[0];
selectlocation(getSelectedRegion());
String selectedregion = getSelectedRegion(); Widget regionTemplate(variant, chosenLayout, nextPage, writeToLog) {
if (isnextpage == false) { return Column(
widget = region(nextPage, locations); mainAxisAlignment: MainAxisAlignment.spaceEvenly,
} else { crossAxisAlignment: CrossAxisAlignment.stretch,
widget = location(selectedregion, next); children: [
} Container(
return widget; 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; int _selectedIndex = 0;
bool nextpage = false; bool nextpage = false;
bool choseLayout = false; bool choseLayout = false;
bool choseRegion = false;
bool enableSudo = false; bool enableSudo = false;
bool enableRoot = false; bool enableRoot = false;
bool isEfi = false; bool isEfi = false;
@ -301,21 +302,16 @@ class _JadeguiState extends State<Jadegui> {
}, },
() { () {
setState(() { setState(() {
nextpage = true; choseRegion = true;
}); });
}, },
(region) { choseRegion,
if (region != "") { (location) {
setState(() { setState(() {
nextpage = false; chosenLocation = location;
}); });
} else {
setState(() {
nextpage = true;
});
}
}, },
nextpage, chosenLocation,
(value) { (value) {
writeToLog(value); writeToLog(value);
}, },

Loading…
Cancel
Save