add locale chooser, next step is to add the locales and timezones (pain)
parent
08e8657393
commit
5ccc39c7cb
@ -0,0 +1,121 @@
|
||||
{
|
||||
"Europe": [
|
||||
"Amsterdam",
|
||||
"Andorra",
|
||||
"Astrakhan",
|
||||
"Athens",
|
||||
"Belfast",
|
||||
"Belgrade",
|
||||
"Berlin",
|
||||
"Bratislava",
|
||||
"Brussels",
|
||||
"Bucharest",
|
||||
"Budapest",
|
||||
"Busingen",
|
||||
"Chisinau",
|
||||
"Copenhagen",
|
||||
"Dublin",
|
||||
"Gibraltar",
|
||||
"Guernsey",
|
||||
"Helsinki",
|
||||
"Isle_of_Man",
|
||||
"Istanbul",
|
||||
"Jersey",
|
||||
"Kaliningrad",
|
||||
"Kiev",
|
||||
"Lisbon",
|
||||
"Ljubljana",
|
||||
"London",
|
||||
"Luxemburg",
|
||||
"Madrid",
|
||||
"Malta",
|
||||
"Mariehamn",
|
||||
"Minsk",
|
||||
"Monaco",
|
||||
"Moscow",
|
||||
"Oslo",
|
||||
"Paris",
|
||||
"Podgorica",
|
||||
"Prague",
|
||||
"Riga",
|
||||
"Rome",
|
||||
"Samara",
|
||||
"San_Marino",
|
||||
"Sarajevo",
|
||||
"Saratov",
|
||||
"Simferopol",
|
||||
"Skopje",
|
||||
"Sofia",
|
||||
"Stockholm",
|
||||
"Tallinn",
|
||||
"Tirane",
|
||||
"Tiraspol",
|
||||
"Ulyanovsk",
|
||||
"Uzhgorod",
|
||||
"Vaduz",
|
||||
"Vatican",
|
||||
"Vienna",
|
||||
"Vilnius",
|
||||
"Volgograd",
|
||||
"Warsaw",
|
||||
"Zagreb",
|
||||
"Zaporozhye",
|
||||
"Zurich"
|
||||
],
|
||||
"Africa": [
|
||||
"Abidjan",
|
||||
"Accra",
|
||||
"Addis_Ababa",
|
||||
"Algiers",
|
||||
"Asmara",
|
||||
"Asmera",
|
||||
"Bamako",
|
||||
"Bangui",
|
||||
"Banjul",
|
||||
"Bissau",
|
||||
"Blantyre",
|
||||
"Brazzaville",
|
||||
"Bujumbura",
|
||||
"Cairo",
|
||||
"Casablanca",
|
||||
"Ceuta",
|
||||
"Conakry",
|
||||
"Dakar",
|
||||
"Dar_es_Salaam",
|
||||
"Djibouti",
|
||||
"Douala",
|
||||
"El_Aaiun",
|
||||
"Freetown",
|
||||
"Gaborone",
|
||||
"Harare",
|
||||
"Johannesburg",
|
||||
"Juba",
|
||||
"Kampala",
|
||||
"Khartoum",
|
||||
"Kigali",
|
||||
"Kinshasa",
|
||||
"Lagos",
|
||||
"Libreville",
|
||||
"Lome",
|
||||
"Luanda",
|
||||
"Lubumbashi",
|
||||
"Lusaka",
|
||||
"Malabo",
|
||||
"Maputo",
|
||||
"Maseru",
|
||||
"Mbabane",
|
||||
"Mogadishu",
|
||||
"Monrovia",
|
||||
"Nairobi",
|
||||
"Ndjamena",
|
||||
"Niamey",
|
||||
"Nouakchott",
|
||||
"Ouagadougou",
|
||||
"Porto-Novo",
|
||||
"Sao_Tome",
|
||||
"Timbuktu",
|
||||
"Tripoli",
|
||||
"Tunis",
|
||||
"Windhoek"
|
||||
]
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
import '../classes/location.dart';
|
||||
|
||||
List<Location> africa = [];
|
@ -0,0 +1,19 @@
|
||||
import '../classes/location.dart';
|
||||
|
||||
List<Location> europe = [
|
||||
Location(
|
||||
region: 'Europe',
|
||||
location: 'Berlin',
|
||||
locale: 'de_DE.UTF-8 UTF-8',
|
||||
),
|
||||
Location(
|
||||
region: 'Europe',
|
||||
location: 'Brussels',
|
||||
locale: 'fr_BE.UTF-8 UTF-8',
|
||||
),
|
||||
Location(
|
||||
region: 'Europe',
|
||||
location: 'Copenhagen',
|
||||
locale: 'da_DK.UTF-8 UTF-8',
|
||||
),
|
||||
];
|
@ -0,0 +1,15 @@
|
||||
export 'Africa.dart';
|
||||
export 'America.dart';
|
||||
export 'Antarctica.dart';
|
||||
export 'Asia.dart';
|
||||
export 'Atlantic.dart';
|
||||
export 'Australia.dart';
|
||||
export 'Brazil.dart';
|
||||
export 'Canada.dart';
|
||||
export 'Chile.dart';
|
||||
export 'Europe.dart';
|
||||
export 'Indian.dart';
|
||||
export 'Mexico.dart';
|
||||
export 'Pacific.dart';
|
||||
export 'US.dart';
|
||||
export 'Other.dart';
|
@ -0,0 +1,13 @@
|
||||
class Location {
|
||||
String region = "";
|
||||
String location = "";
|
||||
String locale = "";
|
||||
String image = "";
|
||||
|
||||
Location({
|
||||
this.region = "",
|
||||
this.location = "",
|
||||
this.locale = "",
|
||||
this.image = "assets/default.png",
|
||||
});
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
String selectedRegion = "";
|
||||
Widget region(next) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: const [
|
||||
Text(
|
||||
'Please choose your Locale',
|
||||
style: TextStyle(
|
||||
fontSize: 50,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color.fromARGB(255, 169, 0, 255)),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
GridView.count(
|
||||
primary: false,
|
||||
padding: const EdgeInsets.all(20),
|
||||
shrinkWrap: true,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
crossAxisCount: 3,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {
|
||||
next();
|
||||
selectedRegion = "Europe";
|
||||
},
|
||||
child: Text('Europe'),
|
||||
),
|
||||
//color: Colors.teal[100],
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: Text('English'),
|
||||
),
|
||||
//color: Colors.teal[100],
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: Text('English'),
|
||||
),
|
||||
//color: Colors.teal[100],
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: Text('English'),
|
||||
),
|
||||
//color: Colors.teal[100],
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: Text('English'),
|
||||
),
|
||||
//color: Colors.teal[100],
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: Text('English'),
|
||||
),
|
||||
//color: Colors.teal[100],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String getSelectedRegion() {
|
||||
return selectedRegion;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'Region.dart';
|
||||
import 'location.dart';
|
||||
|
||||
Widget locale(next, nextPage, selectlocation, isnextpage, Europe) {
|
||||
Widget widget;
|
||||
selectlocation(getSelectedRegion());
|
||||
String selectedregion = getSelectedRegion();
|
||||
if (isnextpage == false) {
|
||||
widget = region(nextPage);
|
||||
} else {
|
||||
widget = location(selectedregion, Europe);
|
||||
}
|
||||
return widget;
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../classes/location.dart';
|
||||
|
||||
Widget locationTemplate(location) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: ElevatedButton(
|
||||
onPressed: () {},
|
||||
child: Text(location),
|
||||
),
|
||||
//color: Colors.teal[100],
|
||||
);
|
||||
}
|
||||
|
||||
Widget location(region, europe) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(height: 20),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Text(
|
||||
'Please choose your Locale',
|
||||
style: TextStyle(
|
||||
fontSize: 50,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Color.fromARGB(255, 169, 0, 255)),
|
||||
),
|
||||
Text(
|
||||
'$region/',
|
||||
style: const TextStyle(
|
||||
fontSize: 30, color: Color.fromARGB(255, 169, 0, 255)),
|
||||
)
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
GridView.count(
|
||||
primary: false,
|
||||
padding: const EdgeInsets.all(20),
|
||||
shrinkWrap: true,
|
||||
crossAxisSpacing: 10,
|
||||
mainAxisSpacing: 10,
|
||||
crossAxisCount: 3,
|
||||
children: options(region, europe),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
List<Widget> options(region, europe) {
|
||||
List<Widget> widget;
|
||||
|
||||
switch (region) {
|
||||
case "Europe":
|
||||
{
|
||||
widget = europe
|
||||
.map<Widget>((location) => locationTemplate(location.location))
|
||||
.toList();
|
||||
break;
|
||||
}
|
||||
case "Asia":
|
||||
{
|
||||
widget = europe
|
||||
.map<Widget>((location) => locationTemplate(location.location))
|
||||
.toList();
|
||||
break;
|
||||
}
|
||||
case "Africa":
|
||||
{
|
||||
widget = europe
|
||||
.map<Widget>((location) => locationTemplate(location.location))
|
||||
.toList();
|
||||
break;
|
||||
}
|
||||
case "North America":
|
||||
{
|
||||
widget = europe
|
||||
.map<Widget>((location) => locationTemplate(location.location))
|
||||
.toList();
|
||||
break;
|
||||
}
|
||||
case "South America":
|
||||
{
|
||||
widget = europe
|
||||
.map<Widget>((location) => locationTemplate(location.location))
|
||||
.toList();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
widget = const [
|
||||
Text(
|
||||
'You should not see this, report this at git.tar.black/crystal/jade_gui',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
];
|
||||
}
|
||||
// Finally returning a Widget
|
||||
return widget;
|
||||
}
|
Loading…
Reference in New Issue