1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 14:35:45 +00:00

Localisations

This commit is contained in:
Yan Maniez 2020-03-05 16:50:31 +01:00
parent 512adf99d8
commit bc8bb68a28
15 changed files with 1002 additions and 73 deletions

View file

@ -1,6 +1,7 @@
import 'dart:io';
import 'package:aidedejeu_flutter/models/items.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:path/path.dart';
import 'package:sqflite/sqflite.dart';
@ -40,7 +41,7 @@ Future<Database> getDatabaseInstance() async {
return await openDatabase(path, readOnly: true);
}
Future<Item> getItemWithId(String id) async {
Future<Item> getItemWithId(BuildContext context, String id) async {
print("getItemWithId " + id);
final db = await database;
var response = await db.query(
@ -51,10 +52,10 @@ Future<Item> getItemWithId(String id) async {
if (response.isEmpty) {
print("Id not found");
}
return response.isNotEmpty ? itemFromMap(response.first) : null;
return response.isNotEmpty ? itemFromMap(context, response.first) : null;
}
Future<Item> loadChildrenItems(Item item, List<Filter> filters) async {
Future<Item> loadChildrenItems(BuildContext context, Item item, List<Filter> filters) async {
print("getChildrenItems " + (item?.itemType ?? ""));
if (item.itemType.endsWith("Items")) {
String itemType =
@ -86,13 +87,13 @@ Future<Item> loadChildrenItems(Item item, List<Filter> filters) async {
print("Children not found");
}
item.children = response.isNotEmpty
? itemsFromMapList(response)
? itemsFromMapList(context, response)
: null;
}
return item;
}
Future<List<RaceItem>> loadRaces() async {
Future<List<RaceItem>> loadRaces(BuildContext context) async {
final db = await database;
var response = await db.query(
"Items",
@ -100,12 +101,12 @@ Future<List<RaceItem>> loadRaces() async {
orderBy: "NormalizedName"
);
if (response.isNotEmpty) {
return itemsFromMapList(response);
return itemsFromMapList(context, response);
}
return null;
}
Future<List<SubRaceItem>> loadSubRaces(RaceItem race) async {
Future<List<SubRaceItem>> loadSubRaces(BuildContext context, RaceItem race) async {
final db = await database;
var response = await db.query(
"Items",
@ -114,12 +115,12 @@ Future<List<SubRaceItem>> loadSubRaces(RaceItem race) async {
orderBy: "NormalizedName"
);
if (response.isNotEmpty) {
return itemsFromMapList(response);
return itemsFromMapList(context, response);
}
return null;
}
Future<List<T>> loadTypedItems<T extends Item>({String itemType, Item item = null}) async {
Future<List<T>> loadTypedItems<T extends Item>(BuildContext context, {String itemType, Item item = null}) async {
final db = await database;
var response = await db.query(
"Items",
@ -128,16 +129,16 @@ Future<List<T>> loadTypedItems<T extends Item>({String itemType, Item item = nul
orderBy: "NormalizedName"
);
if (response.isNotEmpty) {
return itemsFromMapList(response);
return itemsFromMapList(context, response);
}
return null;
}
Future<List<BackgroundItem>> loadBackgrounds() async {
return loadTypedItems<BackgroundItem>(itemType: "BackgroundItem");
Future<List<BackgroundItem>> loadBackgrounds(BuildContext context) async {
return loadTypedItems<BackgroundItem>(context, itemType: "BackgroundItem");
}
Future<List<SubBackgroundItem>> loadSubBackgrounds(Item item) async {
return loadTypedItems<SubBackgroundItem>(itemType: "SubBackgroundItem", item: item);
Future<List<SubBackgroundItem>> loadSubBackgrounds(BuildContext context, Item item) async {
return loadTypedItems<SubBackgroundItem>(context, itemType: "SubBackgroundItem", item: item);
}

View file

@ -1,6 +1,6 @@
{
"@@locale": "en",
"appTitle": "Hello World",
"appTitle": "Axes & Dices",
"@appTitle": {
"description": "Title for the application",
"type": "text",
@ -53,5 +53,161 @@
"description": "Title for the Class page",
"type": "text",
"placeholders": {}
},
"abilitiesTitle": "Abilities",
"@abilitiesTitle": {
"description": "Title for the Abilities page",
"type": "text",
"placeholders": {}
},
"othersTitle": "Others",
"@othersTitle": {
"description": "Title for the Others page",
"type": "text",
"placeholders": {}
},
"raceAbilityScoreIncrease": "Ability Score Increase",
"@raceAbilityScoreIncrease": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceAge": "Age",
"@raceAge": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceAlignment": "Alignment",
"@raceAlignment": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceSize": "Size",
"@raceSize": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceSpeed": "Speed",
"@raceSpeed": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceDarkvision": "Darkvision",
"@raceDarkvision": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceLanguages": "Languages",
"@raceLanguages": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersTypes": "Types",
"@monstersTypes": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersChallenges": "Challenges",
"@monstersChallenges": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersSizes": "Sizes",
"@monstersSizes": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersSources": "Sources",
"@monstersSources": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersTerrains": "Terrains",
"@monstersTerrains": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsClasses": "Classes",
"@spellsClasses": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsLevels": "Levels",
"@spellsLevels": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsSchools": "Schools",
"@spellsSchools": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsRituals": "Rituals",
"@spellsRituals": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsCastingTimes": "Casting Times",
"@spellsCastingTimes": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsRanges": "Ranges",
"@spellsRanges": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsVerbalComponents": "Verbal Components",
"@spellsVerbalComponents": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsSomaticComponents": "Somatic Components",
"@spellsSomaticComponents": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsMaterialComponents": "Material Components",
"@spellsMaterialComponents": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsConcentrations": "Concentrations",
"@spellsConcentrations": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsDurations": "Durations",
"@spellsDurations": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsSources": "Sources",
"@spellsSources": {
"description": "",
"type": "text",
"placeholders": {}
}
}

View file

@ -1,6 +1,6 @@
{
"@@locale": "fr",
"appTitle": "Bonjour Monde",
"appTitle": "Haches & Dés",
"@appTitle": {
"description": "Title for the application",
"type": "text",
@ -53,5 +53,161 @@
"description": "Title for the Class page",
"type": "text",
"placeholders": {}
},
"abilitiesTitle": "Caractéristiques",
"@abilitiesTitle": {
"description": "Title for the Abilities page",
"type": "text",
"placeholders": {}
},
"othersTitle": "Autres",
"@othersTitle": {
"description": "Title for the Others page",
"type": "text",
"placeholders": {}
},
"raceAbilityScoreIncrease": "Augmentation de caractéristiques",
"@raceAbilityScoreIncrease": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceAge": "Âge",
"@raceAge": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceAlignment": "Alignement",
"@raceAlignment": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceSize": "Taille",
"@raceSize": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceSpeed": "Vitesse",
"@raceSpeed": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceDarkvision": "Vision dans le noir",
"@raceDarkvision": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceLanguages": "Langues",
"@raceLanguages": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersTypes": "Types",
"@monstersTypes": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersChallenges": "Dangerosités",
"@monstersChallenges": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersSizes": "Tailles",
"@monstersSizes": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersSources": "Sources",
"@monstersSources": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersTerrains": "Terrains",
"@monstersTerrains": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsClasses": "Classes",
"@spellsClasses": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsLevels": "Niveaux",
"@spellsLevels": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsSchools": "Écoles",
"@spellsSchools": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsRituals": "Rituels",
"@spellsRituals": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsCastingTimes": "Temps d'incantation",
"@spellsCastingTimes": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsRanges": "Portées",
"@spellsRanges": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsVerbalComponents": "Composantes Verbales",
"@spellsVerbalComponents": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsSomaticComponents": "Composantes Somatiques",
"@spellsSomaticComponents": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsMaterialComponents": "Composantes Matérielles",
"@spellsMaterialComponents": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsConcentrations": "Concentrations",
"@spellsConcentrations": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsDurations": "Durées",
"@spellsDurations": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsSources": "Sources",
"@spellsSources": {
"description": "",
"type": "text",
"placeholders": {}
}
}

View file

@ -1,6 +1,6 @@
{
"@@last_modified": "2020-03-03T11:00:06.908535",
"appTitle": "Hello World",
"@@last_modified": "2020-03-05T15:58:18.683548",
"appTitle": "Axes & Dices",
"@appTitle": {
"description": "Title for the application",
"type": "text",
@ -53,5 +53,161 @@
"description": "Title for the Class page",
"type": "text",
"placeholders": {}
},
"abilitiesTitle": "Abilities",
"@abilitiesTitle": {
"description": "Title for the Abilities page",
"type": "text",
"placeholders": {}
},
"othersTitle": "Others",
"@othersTitle": {
"description": "Title for the Others page",
"type": "text",
"placeholders": {}
},
"raceAbilityScoreIncrease": "Ability Score Increase",
"@raceAbilityScoreIncrease": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceAge": "Age",
"@raceAge": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceAlignment": "Alignment",
"@raceAlignment": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceSize": "Size",
"@raceSize": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceSpeed": "Speed",
"@raceSpeed": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceDarkvision": "Darkvision",
"@raceDarkvision": {
"description": "",
"type": "text",
"placeholders": {}
},
"raceLanguages": "Languages",
"@raceLanguages": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersTypes": "Types",
"@monstersTypes": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersChallenges": "Challenges",
"@monstersChallenges": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersSizes": "Sizes",
"@monstersSizes": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersSources": "Sources",
"@monstersSources": {
"description": "",
"type": "text",
"placeholders": {}
},
"monstersTerrains": "Terrains",
"@monstersTerrains": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsClasses": "Classes",
"@spellsClasses": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsLevels": "Levels",
"@spellsLevels": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsSchools": "Schools",
"@spellsSchools": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsRituals": "Rituals",
"@spellsRituals": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsCastingTimes": "Casting Times",
"@spellsCastingTimes": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsRanges": "Ranges",
"@spellsRanges": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsVerbalComponents": "Verbal Components",
"@spellsVerbalComponents": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsSomaticComponents": "Somatic Components",
"@spellsSomaticComponents": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsMaterialComponents": "Material Components",
"@spellsMaterialComponents": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsConcentrations": "Concentrations",
"@spellsConcentrations": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsDurations": "Durations",
"@spellsDurations": {
"description": "",
"type": "text",
"placeholders": {}
},
"spellsSources": "Sources",
"@spellsSources": {
"description": "",
"type": "text",
"placeholders": {}
}
}

View file

@ -21,14 +21,40 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"abilitiesTitle" : MessageLookupByLibrary.simpleMessage("Abilities"),
"aboutTitle" : MessageLookupByLibrary.simpleMessage("About..."),
"appTitle" : MessageLookupByLibrary.simpleMessage("Hello World"),
"appTitle" : MessageLookupByLibrary.simpleMessage("Axes & Dices"),
"backgroundTitle" : MessageLookupByLibrary.simpleMessage("Background"),
"bookmarksTitle" : MessageLookupByLibrary.simpleMessage("Bookmarks"),
"classTitle" : MessageLookupByLibrary.simpleMessage("Class"),
"libraryTitle" : MessageLookupByLibrary.simpleMessage("Library"),
"monstersChallenges" : MessageLookupByLibrary.simpleMessage("Challenges"),
"monstersSizes" : MessageLookupByLibrary.simpleMessage("Sizes"),
"monstersSources" : MessageLookupByLibrary.simpleMessage("Sources"),
"monstersTerrains" : MessageLookupByLibrary.simpleMessage("Terrains"),
"monstersTypes" : MessageLookupByLibrary.simpleMessage("Types"),
"othersTitle" : MessageLookupByLibrary.simpleMessage("Others"),
"pceditorTitle" : MessageLookupByLibrary.simpleMessage("Player Characters"),
"raceAbilityScoreIncrease" : MessageLookupByLibrary.simpleMessage("Ability Score Increase"),
"raceAge" : MessageLookupByLibrary.simpleMessage("Age"),
"raceAlignment" : MessageLookupByLibrary.simpleMessage("Alignment"),
"raceDarkvision" : MessageLookupByLibrary.simpleMessage("Darkvision"),
"raceLanguages" : MessageLookupByLibrary.simpleMessage("Languages"),
"raceSize" : MessageLookupByLibrary.simpleMessage("Size"),
"raceSpeed" : MessageLookupByLibrary.simpleMessage("Speed"),
"raceTitle" : MessageLookupByLibrary.simpleMessage("Race"),
"searchTitle" : MessageLookupByLibrary.simpleMessage("Search")
"searchTitle" : MessageLookupByLibrary.simpleMessage("Search"),
"spellsCastingTimes" : MessageLookupByLibrary.simpleMessage("Casting Times"),
"spellsClasses" : MessageLookupByLibrary.simpleMessage("Classes"),
"spellsConcentrations" : MessageLookupByLibrary.simpleMessage("Concentrations"),
"spellsDurations" : MessageLookupByLibrary.simpleMessage("Durations"),
"spellsLevels" : MessageLookupByLibrary.simpleMessage("Levels"),
"spellsMaterialComponents" : MessageLookupByLibrary.simpleMessage("Material Components"),
"spellsRanges" : MessageLookupByLibrary.simpleMessage("Ranges"),
"spellsRituals" : MessageLookupByLibrary.simpleMessage("Rituals"),
"spellsSchools" : MessageLookupByLibrary.simpleMessage("Schools"),
"spellsSomaticComponents" : MessageLookupByLibrary.simpleMessage("Somatic Components"),
"spellsSources" : MessageLookupByLibrary.simpleMessage("Sources"),
"spellsVerbalComponents" : MessageLookupByLibrary.simpleMessage("Verbal Components")
};
}

View file

@ -21,14 +21,40 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"abilitiesTitle" : MessageLookupByLibrary.simpleMessage("Caractéristiques"),
"aboutTitle" : MessageLookupByLibrary.simpleMessage("A propos de..."),
"appTitle" : MessageLookupByLibrary.simpleMessage("Bonjour Monde"),
"appTitle" : MessageLookupByLibrary.simpleMessage("Haches & Dés"),
"backgroundTitle" : MessageLookupByLibrary.simpleMessage("Historique"),
"bookmarksTitle" : MessageLookupByLibrary.simpleMessage("Favoris"),
"classTitle" : MessageLookupByLibrary.simpleMessage("Classe"),
"libraryTitle" : MessageLookupByLibrary.simpleMessage("Bibliothèque"),
"monstersChallenges" : MessageLookupByLibrary.simpleMessage("Dangerosités"),
"monstersSizes" : MessageLookupByLibrary.simpleMessage("Tailles"),
"monstersSources" : MessageLookupByLibrary.simpleMessage("Sources"),
"monstersTerrains" : MessageLookupByLibrary.simpleMessage("Terrains"),
"monstersTypes" : MessageLookupByLibrary.simpleMessage("Types"),
"othersTitle" : MessageLookupByLibrary.simpleMessage("Autres"),
"pceditorTitle" : MessageLookupByLibrary.simpleMessage("Personnages"),
"raceAbilityScoreIncrease" : MessageLookupByLibrary.simpleMessage("Augmentation de caractéristiques"),
"raceAge" : MessageLookupByLibrary.simpleMessage("Âge"),
"raceAlignment" : MessageLookupByLibrary.simpleMessage("Alignement"),
"raceDarkvision" : MessageLookupByLibrary.simpleMessage("Vision dans le noir"),
"raceLanguages" : MessageLookupByLibrary.simpleMessage("Langues"),
"raceSize" : MessageLookupByLibrary.simpleMessage("Taille"),
"raceSpeed" : MessageLookupByLibrary.simpleMessage("Vitesse"),
"raceTitle" : MessageLookupByLibrary.simpleMessage("Race"),
"searchTitle" : MessageLookupByLibrary.simpleMessage("Recherche")
"searchTitle" : MessageLookupByLibrary.simpleMessage("Recherche"),
"spellsCastingTimes" : MessageLookupByLibrary.simpleMessage("Temps d\'incantation"),
"spellsClasses" : MessageLookupByLibrary.simpleMessage("Classes"),
"spellsConcentrations" : MessageLookupByLibrary.simpleMessage("Concentrations"),
"spellsDurations" : MessageLookupByLibrary.simpleMessage("Durées"),
"spellsLevels" : MessageLookupByLibrary.simpleMessage("Niveaux"),
"spellsMaterialComponents" : MessageLookupByLibrary.simpleMessage("Composantes Matérielles"),
"spellsRanges" : MessageLookupByLibrary.simpleMessage("Portées"),
"spellsRituals" : MessageLookupByLibrary.simpleMessage("Rituels"),
"spellsSchools" : MessageLookupByLibrary.simpleMessage("Écoles"),
"spellsSomaticComponents" : MessageLookupByLibrary.simpleMessage("Composantes Somatiques"),
"spellsSources" : MessageLookupByLibrary.simpleMessage("Sources"),
"spellsVerbalComponents" : MessageLookupByLibrary.simpleMessage("Composantes Verbales")
};
}

View file

@ -23,7 +23,7 @@ class AppLocalizations {
String get appTitle {
return Intl.message(
'Hello World',
'Axes & Dices',
name: 'appTitle',
desc: 'Title for the application',
locale: localeName,
@ -120,6 +120,219 @@ class AppLocalizations {
);
}
String get raceAbilityScoreIncrease {
return Intl.message(
'Ability Score Increase',
name: 'raceAbilityScoreIncrease',
desc: '',
locale: localeName,
);
}
String get raceAge {
return Intl.message(
'Age',
name: 'raceAge',
desc: '',
locale: localeName,
);
}
String get raceAlignment {
return Intl.message(
'Alignment',
name: 'raceAlignment',
desc: '',
locale: localeName,
);
}
String get raceSize {
return Intl.message(
'Size',
name: 'raceSize',
desc: '',
locale: localeName,
);
}
String get raceSpeed {
return Intl.message(
'Speed',
name: 'raceSpeed',
desc: '',
locale: localeName,
);
}
String get raceDarkvision {
return Intl.message(
'Darkvision',
name: 'raceDarkvision',
desc: '',
locale: localeName,
);
}
String get raceLanguages {
return Intl.message(
'Languages',
name: 'raceLanguages',
desc: '',
locale: localeName,
);
}
String get monstersTypes {
return Intl.message(
'Types',
name: 'monstersTypes',
desc: '',
locale: localeName,
);
}
String get monstersChallenges {
return Intl.message(
'Challenges',
name: 'monstersChallenges',
desc: '',
locale: localeName,
);
}
String get monstersSizes {
return Intl.message(
'Sizes',
name: 'monstersSizes',
desc: '',
locale: localeName,
);
}
String get monstersSources {
return Intl.message(
'Sources',
name: 'monstersSources',
desc: '',
locale: localeName,
);
}
String get monstersTerrains {
return Intl.message(
'Terrains',
name: 'monstersTerrains',
desc: '',
locale: localeName,
);
}
String get spellsClasses {
return Intl.message(
'Classes',
name: 'spellsClasses',
desc: '',
locale: localeName,
);
}
String get spellsLevels {
return Intl.message(
'Levels',
name: 'spellsLevels',
desc: '',
locale: localeName,
);
}
String get spellsSchools {
return Intl.message(
'Schools',
name: 'spellsSchools',
desc: '',
locale: localeName,
);
}
String get spellsRituals {
return Intl.message(
'Rituals',
name: 'spellsRituals',
desc: '',
locale: localeName,
);
}
String get spellsCastingTimes {
return Intl.message(
'Casting Times',
name: 'spellsCastingTimes',
desc: '',
locale: localeName,
);
}
String get spellsRanges {
return Intl.message(
'Ranges',
name: 'spellsRanges',
desc: '',
locale: localeName,
);
}
String get spellsVerbalComponents {
return Intl.message(
'Verbal Components',
name: 'spellsVerbalComponents',
desc: '',
locale: localeName,
);
}
String get spellsSomaticComponents {
return Intl.message(
'Somatic Components',
name: 'spellsSomaticComponents',
desc: '',
locale: localeName,
);
}
String get spellsMaterialComponents {
return Intl.message(
'Material Components',
name: 'spellsMaterialComponents',
desc: '',
locale: localeName,
);
}
String get spellsConcentrations {
return Intl.message(
'Concentrations',
name: 'spellsConcentrations',
desc: '',
locale: localeName,
);
}
String get spellsDurations {
return Intl.message(
'Durations',
name: 'spellsDurations',
desc: '',
locale: localeName,
);
}
String get spellsSources {
return Intl.message(
'Sources',
name: 'spellsSources',
desc: '',
locale: localeName,
);
}
}

View file

@ -1,4 +1,6 @@
import 'package:aidedejeu_flutter/localization.dart';
import 'package:aidedejeu_flutter/models/filters.dart';
import 'package:flutter/cupertino.dart';
class Item {
String id;
@ -84,6 +86,38 @@ class MonsterItem extends Item {
}
}
class SpellItem extends Item {
String family;
String level;
String type;
String ritual;
String castingTime;
String range;
String components;
String verbalComponent;
String somaticComponent;
String materialComponent;
String concentration;
String duration;
String classes;
SpellItem(Map<String, dynamic> map) : super(map) {
this.family = map["Family"];
this.level = map["Level"];
this.type = map["Type"];
this.ritual = map["Ritual"];
this.castingTime = map["CastingTime"];
this.range = map["Range"];
this.components = map["Components"];
this.verbalComponent = map["VerbalComponent"];
this.somaticComponent = map["SomaticComponent"];
this.materialComponent = map["MaterialComponent"];
this.concentration = map["Concentration"];
this.duration = map["Duration"];
this.classes = map["Classes"];
}
}
class Items extends Item {
Items(Map<String, dynamic> map) : super(map) {}
}
@ -105,26 +139,25 @@ class MonsterItems extends FilteredItems {
Filter sources;
Filter terrains;
MonsterItems(Map<String, dynamic> map) : super(map) {
MonsterItems(BuildContext context, Map<String, dynamic> map) : super(map) {
this.types = Filter(
name: "Type",
name: AppLocalizations.of(context).monstersTypes,
type: FilterType.Choices,
values: map["Types"].toString().split("|"));
this.challenges = Filter(
name: "Challenge",
name: AppLocalizations.of(context).monstersChallenges,
type: FilterType.Range,
values: map["Challenges"].toString().split("|"));
this.sizes = Filter(
name: "Size",
name: AppLocalizations.of(context).monstersSizes,
type: FilterType.Range,
values: map["Sizes"].toString().split("|"));
;
this.sources = Filter(
name: "Source",
name: AppLocalizations.of(context).monstersSources,
type: FilterType.Choices,
values: map["Sources"].toString().split("|"));
this.terrains = Filter(
name: "Terrain",
name: AppLocalizations.of(context).monstersTerrains,
type: FilterType.Choices,
values: map["Terrains"].toString().split("|"));
}
@ -138,6 +171,87 @@ class MonsterItems extends FilteredItems {
}.toList();
}
class SpellItems extends FilteredItems {
Filter classes;
Filter levels;
Filter schools;
Filter rituals;
Filter castingTimes;
Filter ranges;
Filter verbalComponents;
Filter somaticComponents;
Filter materialComponents;
Filter concentrations;
Filter durations;
Filter sources;
SpellItems(BuildContext context, Map<String, dynamic> map) : super(map) {
this.classes = Filter(
name: AppLocalizations.of(context).spellsClasses,
type: FilterType.Choices,
values: map["Classes"].toString().split("|"));
this.levels = Filter(
name: AppLocalizations.of(context).spellsLevels,
type: FilterType.Choices,
values: map["Levels"].toString().split("|"));
this.schools = Filter(
name: AppLocalizations.of(context).spellsSchools,
type: FilterType.Choices,
values: map["Schools"].toString().split("|"));
this.rituals = Filter(
name: AppLocalizations.of(context).spellsRituals,
type: FilterType.Choices,
values: map["Rituals"].toString().split("|"));
this.castingTimes = Filter(
name: AppLocalizations.of(context).spellsCastingTimes,
type: FilterType.Choices,
values: map["CastingTimes"].toString().split("|"));
this.ranges = Filter(
name: AppLocalizations.of(context).spellsRanges,
type: FilterType.Choices,
values: map["Ranges"].toString().split("|"));
this.verbalComponents = Filter(
name: AppLocalizations.of(context).spellsVerbalComponents,
type: FilterType.Choices,
values: map["VerbalComponents"].toString().split("|"));
this.somaticComponents = Filter(
name: AppLocalizations.of(context).spellsSomaticComponents,
type: FilterType.Choices,
values: map["SomaticComponents"].toString().split("|"));
this.materialComponents = Filter(
name: AppLocalizations.of(context).spellsMaterialComponents,
type: FilterType.Choices,
values: map["MaterialComponents"].toString().split("|"));
this.concentrations = Filter(
name: AppLocalizations.of(context).spellsConcentrations,
type: FilterType.Choices,
values: map["Concentrations"].toString().split("|"));
this.durations = Filter(
name: AppLocalizations.of(context).spellsDurations,
type: FilterType.Choices,
values: map["Durations"].toString().split("|"));
this.sources = Filter(
name: AppLocalizations.of(context).spellsSources,
type: FilterType.Choices,
values: map["Sources"].toString().split("|"));
}
List<Filter> toFilterList() => {
classes,
levels,
schools,
rituals,
castingTimes,
ranges,
verbalComponents,
somaticComponents,
materialComponents,
concentrations,
durations,
sources,
}.toList();
}
class RaceItem extends Item {
String fullName;
bool hasSubRaces;
@ -205,9 +319,7 @@ class RaceItems extends FilteredItems {
}
}
class BackgroundItem extends Item {
String skillProficiencies;
String masteredTools;
String masteredLanguages;
@ -225,7 +337,7 @@ class SubBackgroundItem extends BackgroundItem {
SubBackgroundItem(Map<String, dynamic> map) : super(map);
}
Item itemFromMap(Map<String, dynamic> map) {
Item itemFromMap(BuildContext context, Map<String, dynamic> map) {
switch (map["ItemType"]) {
case "RaceItem":
return RaceItem(map);
@ -240,13 +352,17 @@ Item itemFromMap(Map<String, dynamic> map) {
case "MonsterItem":
return MonsterItem(map);
case "MonsterItems":
return MonsterItems(map);
return MonsterItems(context, map);
case "SpellItem":
return SpellItem(map);
case "SpellItems":
return SpellItems(context, map);
}
return Item(map);
}
List<T> itemsFromMapList<T extends Item>(List<Map<String, dynamic>> mapList) {
List<T> itemsFromMapList<T extends Item>(BuildContext context, List<Map<String, dynamic>> mapList) {
return List.generate(mapList.length, (i) {
return itemFromMap(mapList[i]);
return itemFromMap(context, mapList[i]);
});
}

View file

@ -1,6 +1,17 @@
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
const Color colorHDRed = Color(0xFF9B1C47);
const Color colorHDBlue = Color(0xFF5B61FF);
const Color colorHDGrey = Color(0xFF563F5A);
const Color colorHDMidGrey = Color(0xFF6F5B73);
const Color colorHDLightGrey = Color(0xFF7C7B7B);
const Color colorHDLightBlack = Color(0xFF3A213C);
const Color colorHDBackMidGrey = Color(0xFFB5AAB9);
const Color colorHDBackLightGrey = Color(0xFFEDEDED);
const Color colorHDWhite = Color(0xFFFFFFFF);
const Color colorHDBlack = Color(0xFF000000);
ThemeData mainTheme() {
return ThemeData(
primarySwatch: Colors.deepOrange,
@ -15,21 +26,53 @@ ThemeData mainTheme() {
fontFamily: 'Cinzel')),
),
brightness: Brightness.light,
primaryColor: Colors.lightBlue[800],
accentColor: Colors.cyan[600],
primaryColor: colorHDBlack,
accentColor: colorHDRed,
fontFamily: 'LinuxLibertine',
textTheme: TextTheme(
// p
body1: TextStyle(
fontSize: 15.0,
color: Colors.black,
fontFamily: 'LinuxLibertine',
),
// h1
headline: TextStyle(
fontSize: 28.0, fontWeight: FontWeight.bold, fontFamily: 'Cinzel'),
title: TextStyle(fontSize: 22.0, fontStyle: FontStyle.normal),
body1: TextStyle(fontSize: 16.0),
fontSize: 30.0,
color: colorHDRed,
fontWeight: FontWeight.bold,
fontFamily: 'Cinzel-Bold',
),
// h2
title: TextStyle(
fontSize: 25.0,
color: Colors.black,
fontWeight: FontWeight.bold,
fontFamily: 'Cinzel-Regular',
),
// h3
subhead: TextStyle(
fontSize: 20.0,
color: Colors.black,
fontWeight: FontWeight.bold,
fontFamily: 'Cinzel-Regular',
),
// h4, h5, h6
body2: TextStyle(
fontSize: 18.0,
color: Colors.black,
fontWeight: FontWeight.bold,
fontFamily: 'Cinzel-Regular',
),
),
);
}
MarkdownStyleSheet mainMarkdownStyleSheet(BuildContext context) {
return MarkdownStyleSheet.fromTheme(Theme.of(context)).copyWith(
a: const TextStyle(color: colorHDBlue),
tableColumnWidth: IntrinsicColumnWidth(),
tableCellsPadding: EdgeInsets.all(0.2),
tableCellsPadding: EdgeInsets.all(1.0),
tableHeadAlign: TextAlign.center,
);
}

View file

@ -1,4 +1,5 @@
import 'package:aidedejeu_flutter/models/items.dart';
import 'package:aidedejeu_flutter/theme.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -20,6 +21,8 @@ class _RangeFilterState extends State<RangeFilter> {
@override
Widget build(BuildContext context) {
return RangeSlider(
activeColor: colorHDRed,
inactiveColor: colorHDLightGrey,
min: 0,
max: widget.values.length.toDouble() - 1,
divisions: widget.values.length,
@ -57,11 +60,18 @@ class _ChipListFilterState extends State<ChipListFilter> {
@override
Widget build(BuildContext context) {
return Wrap(
spacing: 0.0,
crossAxisAlignment: WrapCrossAlignment.start,
alignment: WrapAlignment.spaceEvenly,
direction: Axis.horizontal,
runAlignment: WrapAlignment.start,
verticalDirection: VerticalDirection.down,
children: widget.choices
.map((choice) => Padding(
padding: const EdgeInsets.all(4.0),
padding: const EdgeInsets.fromLTRB(2,0,2,0),
child: FilterChip(
label: Text(choice),
label: Text(choice, style: TextStyle(fontSize: 10.0),),
backgroundColor: Colors.transparent,
shape: StadiumBorder(side: BorderSide()),
selected: widget.selectedChoices.contains(choice),

View file

@ -20,6 +20,7 @@ class HomePage extends StatelessWidget {
FlatButton.icon(
label: Text(
AppLocalizations.of(context).libraryTitle,
style: Theme.of(context).textTheme.headline,
),
icon: SvgPicture.asset(
"assets/spell-book.svg",
@ -39,6 +40,7 @@ class HomePage extends StatelessWidget {
FlatButton.icon(
label: Text(
AppLocalizations.of(context).pceditorTitle,
style: Theme.of(context).textTheme.headline,
),
icon: SvgPicture.asset(
"assets/swordman.svg",
@ -56,6 +58,7 @@ class HomePage extends StatelessWidget {
FlatButton.icon(
label: Text(
AppLocalizations.of(context).aboutTitle,
style: Theme.of(context).textTheme.headline,
),
icon: SvgPicture.asset(
"assets/wooden-sign.svg",

View file

@ -54,8 +54,8 @@ class _LibraryPageState extends State<LibraryPage> {
}
Future<Item> _loadItem() async {
var item = await getItemWithId(this.widget.id);
var items = await loadChildrenItems(item, filters);
var item = await getItemWithId(context, this.widget.id);
var items = await loadChildrenItems(context, item, filters);
//setItem(item);
return item;
}
@ -86,8 +86,22 @@ class _LibraryPageState extends State<LibraryPage> {
Widget _buildChildTile(BuildContext context, Item item) {
return ListTile(
title: Text(item.name),
subtitle: Text(item.aliasText ?? ""),
title: Text(
item.name,
style: TextStyle(
fontSize: 25.0,
color: colorHDBlue,
fontWeight: FontWeight.bold,
fontFamily: 'Cinzel-Regular',
),
),
subtitle: Text(item.aliasText ?? "",
style: TextStyle(
fontSize: 18.0,
color: colorHDLightGrey,
fontWeight: FontWeight.bold,
fontFamily: 'Cinzel-Regular',
),),
onTap: () => Navigator.push(
context,
MaterialPageRoute(builder: (context) => LibraryPage(id: item.id)),
@ -126,7 +140,9 @@ class _LibraryPageState extends State<LibraryPage> {
width: 30.0,
allowDrawingOutsideViewBox: true,
),
title: Text(title),
title: Text(title, style: TextStyle(fontSize: 16.0,
fontWeight: FontWeight.bold,
fontFamily: 'Cinzel-Regular',),),
activeIcon: SvgPicture.asset(
assetName,
height: 40.0,
@ -161,7 +177,7 @@ class _LibraryPageState extends State<LibraryPage> {
setState(() {
filter.selectedValues = choices;
});
loadChildrenItems(item, filters).then((value) => {
loadChildrenItems(context, item, filters).then((value) => {
setState(() {
this.item = item;
this.filters = filters;
@ -179,7 +195,7 @@ class _LibraryPageState extends State<LibraryPage> {
setState(() {
filter.rangeValues = values;
});
loadChildrenItems(item, filters).then((value) => {
loadChildrenItems(context, item, filters).then((value) => {
setState(() {
this.item = item;
this.filters = filters;
@ -192,13 +208,13 @@ class _LibraryPageState extends State<LibraryPage> {
return Column(children: <Widget>[
Divider(
color: Colors.blueGrey,
height: 10.0,
height: 0.0,
),
Align(
alignment: Alignment.centerLeft,
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text(filter.name),
padding: const EdgeInsets.fromLTRB(8.0,1.0,8.0,1.0),
child: Text(filter.name, style: TextStyle(fontFamily: "Cinzel"),),
),
),
Container(
@ -242,6 +258,7 @@ class _LibraryPageState extends State<LibraryPage> {
this.indexPage = index;
});
},
selectedItemColor: colorHDRed,
items: _buildBottomNavigationBarItems(),
),
endDrawer: filters != null
@ -253,7 +270,7 @@ class _LibraryPageState extends State<LibraryPage> {
)
: null,
appBar: AppBar(
title: Text(widget.id),
title: Text(item?.name ?? widget.id),
actions: filters != null
? [
Builder(

View file

@ -34,31 +34,31 @@ class _PCEditorPageState extends State<PCEditorPage> {
}
void _initRaces() async {
var races = await loadRaces();
var races = await loadRaces(context);
setState(() {
_races = races.map((e) => e as RaceItem).toList();
_races = races.toList();
});
}
void _initSubRaces(RaceItem race) async {
var subRaces = await loadSubRaces(race);
var subRaces = await loadSubRaces(context, race);
setState(() {
_subRaces = subRaces.map((e) => e as SubRaceItem).toList();
_subRaces = subRaces;
});
}
void _initBackgrounds() async {
var backgrounds = await loadBackgrounds();
var backgrounds = await loadBackgrounds(context);
setState(() {
_backgrounds = backgrounds.map((e) => e as BackgroundItem).toList();
_backgrounds = backgrounds;
});
}
void _initSubBackgrounds(BackgroundItem background) async {
var subBackgrounds = await loadSubBackgrounds(background);
var subBackgrounds = await loadSubBackgrounds(context, background);
setState(() {
_subBackgrounds =
subBackgrounds.map((e) => e as SubBackgroundItem).toList();
subBackgrounds;
});
}
@ -168,26 +168,26 @@ class _PCEditorPageState extends State<PCEditorPage> {
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildSubTitle("Augmentation de caractéristiques"),
_buildSubTitle(AppLocalizations.of(context).raceAbilityScoreIncrease),
_buildMarkdown(_race?.abilityScoreIncrease),
_buildMarkdown(_subRace?.abilityScoreIncrease),
Text(""),
_buildSubTitle("Âge"),
_buildSubTitle(AppLocalizations.of(context).raceAge),
_buildMarkdown(_race?.age),
Text(""),
_buildSubTitle("Alignement"),
_buildSubTitle(AppLocalizations.of(context).raceAlignment),
_buildMarkdown(_race?.alignment),
Text(""),
_buildSubTitle("Taille"),
_buildSubTitle(AppLocalizations.of(context).raceSize),
_buildMarkdown(_race?.size),
Text(""),
_buildSubTitle("Vitesse"),
_buildSubTitle(AppLocalizations.of(context).raceSpeed),
_buildMarkdown(_race?.speed),
_race?.darkvision != null ? Text("") : SizedBox.shrink(),
_race?.darkvision != null ? _buildSubTitle(AppLocalizations.of(context).raceDarkvision) : SizedBox.shrink(),
_race?.darkvision != null ? _buildMarkdown(_race?.darkvision) : SizedBox.shrink(),
Text(""),
_buildSubTitle("Vision dans le noir"),
_buildMarkdown(_race?.darkvision),
Text(""),
_buildSubTitle("Langues"),
_buildSubTitle(AppLocalizations.of(context).raceLanguages),
_buildMarkdown(_race?.languages),
],
)