|
|
|
@ -1,52 +1,92 @@
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:jade_gui/Keymaps/keymaps.dart';
|
|
|
|
|
import 'package:jade_gui/classes/keymap.dart';
|
|
|
|
|
import 'package:jade_gui/functions/keymap/variant.dart';
|
|
|
|
|
|
|
|
|
|
Keymap chosenLayout = Keymap();
|
|
|
|
|
Keymap chosenLayout = keymaps[0];
|
|
|
|
|
String chosenVariant = "none";
|
|
|
|
|
|
|
|
|
|
String getChosenVariant() {
|
|
|
|
|
return chosenVariant;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getChosenLayout() {
|
|
|
|
|
return chosenLayout.backLayout;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget layoutOrVariant(showVariant, keymap, choseLayout, nextPage) {
|
|
|
|
|
if (choseLayout && keymap == chosenLayout) {
|
|
|
|
|
return variant(chosenLayout, nextPage);
|
|
|
|
|
} else {
|
|
|
|
|
return Container(
|
|
|
|
|
color: const Color.fromARGB(100, 169, 0, 255),
|
|
|
|
|
padding: const EdgeInsets.all(8),
|
|
|
|
|
Widget variantTemplate(variant, chosenLayout, nextPage) {
|
|
|
|
|
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: () {
|
|
|
|
|
chosenLayout = keymap;
|
|
|
|
|
showVariant();
|
|
|
|
|
chosenVariant = variant;
|
|
|
|
|
nextPage();
|
|
|
|
|
},
|
|
|
|
|
style: TextButton.styleFrom(
|
|
|
|
|
primary: Colors.white,
|
|
|
|
|
backgroundColor: const Color.fromARGB(100, 169, 0, 255),
|
|
|
|
|
backgroundColor: const Color.fromARGB(0, 169, 0, 255),
|
|
|
|
|
shadowColor: const Color.fromARGB(0, 169, 0, 255),
|
|
|
|
|
padding: const EdgeInsets.all(10),
|
|
|
|
|
),
|
|
|
|
|
child: Text(
|
|
|
|
|
keymap.layout,
|
|
|
|
|
variant,
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget layoutTemplate(Keymap keymap, showVariant, choseLayout, nextPage) {
|
|
|
|
|
return Container(
|
|
|
|
|
color: const Color.fromARGB(100, 169, 0, 255),
|
|
|
|
|
padding: const EdgeInsets.all(8),
|
|
|
|
|
child: layoutOrVariant(showVariant, keymap, choseLayout, nextPage));
|
|
|
|
|
Widget layoutTemplate(keymap, setChosenLayout) {
|
|
|
|
|
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: () {
|
|
|
|
|
setChosenLayout(keymap);
|
|
|
|
|
},
|
|
|
|
|
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(
|
|
|
|
|
keymap.layout,
|
|
|
|
|
style: const TextStyle(
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 10),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Widget keyboard(nextPage, showVariant, choseLayout) {
|
|
|
|
|
return SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
Widget keyboard(
|
|
|
|
|
nextPage, showVariant, choseLayout, setChosenLayout, chosenLayout) {
|
|
|
|
|
return Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
|
children: [
|
|
|
|
|
const Text(
|
|
|
|
@ -56,19 +96,79 @@ Widget keyboard(nextPage, showVariant, choseLayout) {
|
|
|
|
|
fontWeight: FontWeight.bold,
|
|
|
|
|
color: Color.fromARGB(255, 169, 0, 255)),
|
|
|
|
|
),
|
|
|
|
|
GridView.count(
|
|
|
|
|
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: Expanded(
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
primary: false,
|
|
|
|
|
padding: const EdgeInsets.all(20),
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
crossAxisSpacing: 10,
|
|
|
|
|
mainAxisSpacing: 10,
|
|
|
|
|
crossAxisCount: 3,
|
|
|
|
|
child: Column(
|
|
|
|
|
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
|
//crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: keymaps
|
|
|
|
|
.map<Widget>((keymap) =>
|
|
|
|
|
layoutTemplate(keymap, showVariant, choseLayout, nextPage))
|
|
|
|
|
layoutTemplate(keymap, setChosenLayout))
|
|
|
|
|
.toList(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 50),
|
|
|
|
|
//Expanded(child: layouts()),
|
|
|
|
|
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: Expanded(
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
primary: false,
|
|
|
|
|
child: Column(
|
|
|
|
|
//mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
|
//crossAxisAlignment: CrossAxisAlignment.stretch,
|
|
|
|
|
children: chosenLayout.variant
|
|
|
|
|
.map<Widget>((map) =>
|
|
|
|
|
variantTemplate(map, chosenLayout, nextPage))
|
|
|
|
|
.toList(),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(width: 40),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
const SizedBox(height: 20),
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|