diff --git a/aidedejeu_flutter/lib/database.dart b/aidedejeu_flutter/lib/database.dart index f04c3cb6..78178c66 100644 --- a/aidedejeu_flutter/lib/database.dart +++ b/aidedejeu_flutter/lib/database.dart @@ -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 getDatabaseInstance() async { return await openDatabase(path, readOnly: true); } -Future getItemWithId(String id) async { +Future getItemWithId(BuildContext context, String id) async { print("getItemWithId " + id); final db = await database; var response = await db.query( @@ -51,10 +52,10 @@ Future 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 loadChildrenItems(Item item, List filters) async { +Future loadChildrenItems(BuildContext context, Item item, List filters) async { print("getChildrenItems " + (item?.itemType ?? "")); if (item.itemType.endsWith("Items")) { String itemType = @@ -86,13 +87,13 @@ Future loadChildrenItems(Item item, List filters) async { print("Children not found"); } item.children = response.isNotEmpty - ? itemsFromMapList(response) + ? itemsFromMapList(context, response) : null; } return item; } -Future> loadRaces() async { +Future> loadRaces(BuildContext context) async { final db = await database; var response = await db.query( "Items", @@ -100,12 +101,12 @@ Future> loadRaces() async { orderBy: "NormalizedName" ); if (response.isNotEmpty) { - return itemsFromMapList(response); + return itemsFromMapList(context, response); } return null; } -Future> loadSubRaces(RaceItem race) async { +Future> loadSubRaces(BuildContext context, RaceItem race) async { final db = await database; var response = await db.query( "Items", @@ -114,12 +115,12 @@ Future> loadSubRaces(RaceItem race) async { orderBy: "NormalizedName" ); if (response.isNotEmpty) { - return itemsFromMapList(response); + return itemsFromMapList(context, response); } return null; } -Future> loadTypedItems({String itemType, Item item = null}) async { +Future> loadTypedItems(BuildContext context, {String itemType, Item item = null}) async { final db = await database; var response = await db.query( "Items", @@ -128,16 +129,16 @@ Future> loadTypedItems({String itemType, Item item = nul orderBy: "NormalizedName" ); if (response.isNotEmpty) { - return itemsFromMapList(response); + return itemsFromMapList(context, response); } return null; } -Future> loadBackgrounds() async { - return loadTypedItems(itemType: "BackgroundItem"); +Future> loadBackgrounds(BuildContext context) async { + return loadTypedItems(context, itemType: "BackgroundItem"); } -Future> loadSubBackgrounds(Item item) async { - return loadTypedItems(itemType: "SubBackgroundItem", item: item); +Future> loadSubBackgrounds(BuildContext context, Item item) async { + return loadTypedItems(context, itemType: "SubBackgroundItem", item: item); } diff --git a/aidedejeu_flutter/lib/l10n/intl_en.arb b/aidedejeu_flutter/lib/l10n/intl_en.arb index b267be07..9e7412c9 100644 --- a/aidedejeu_flutter/lib/l10n/intl_en.arb +++ b/aidedejeu_flutter/lib/l10n/intl_en.arb @@ -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": {} } } \ No newline at end of file diff --git a/aidedejeu_flutter/lib/l10n/intl_fr.arb b/aidedejeu_flutter/lib/l10n/intl_fr.arb index f717ff3b..b3230a84 100644 --- a/aidedejeu_flutter/lib/l10n/intl_fr.arb +++ b/aidedejeu_flutter/lib/l10n/intl_fr.arb @@ -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": {} } } \ No newline at end of file diff --git a/aidedejeu_flutter/lib/l10n/intl_messages.arb b/aidedejeu_flutter/lib/l10n/intl_messages.arb index 1c829142..7a743f33 100644 --- a/aidedejeu_flutter/lib/l10n/intl_messages.arb +++ b/aidedejeu_flutter/lib/l10n/intl_messages.arb @@ -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": {} } } \ No newline at end of file diff --git a/aidedejeu_flutter/lib/l10n/messages_en.dart b/aidedejeu_flutter/lib/l10n/messages_en.dart index be7e643c..67a08887 100644 --- a/aidedejeu_flutter/lib/l10n/messages_en.dart +++ b/aidedejeu_flutter/lib/l10n/messages_en.dart @@ -21,14 +21,40 @@ class MessageLookup extends MessageLookupByLibrary { final messages = _notInlinedMessages(_notInlinedMessages); static _notInlinedMessages(_) => { + "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") }; } diff --git a/aidedejeu_flutter/lib/l10n/messages_fr.dart b/aidedejeu_flutter/lib/l10n/messages_fr.dart index 1df08253..ea85a1bb 100644 --- a/aidedejeu_flutter/lib/l10n/messages_fr.dart +++ b/aidedejeu_flutter/lib/l10n/messages_fr.dart @@ -21,14 +21,40 @@ class MessageLookup extends MessageLookupByLibrary { final messages = _notInlinedMessages(_notInlinedMessages); static _notInlinedMessages(_) => { + "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") }; } diff --git a/aidedejeu_flutter/lib/localization.dart b/aidedejeu_flutter/lib/localization.dart index 5aa6ccec..6e98dd9c 100644 --- a/aidedejeu_flutter/lib/localization.dart +++ b/aidedejeu_flutter/lib/localization.dart @@ -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, + ); + } } diff --git a/aidedejeu_flutter/lib/models/items.dart b/aidedejeu_flutter/lib/models/items.dart index 2c18d3d9..b394e1e0 100644 --- a/aidedejeu_flutter/lib/models/items.dart +++ b/aidedejeu_flutter/lib/models/items.dart @@ -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 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 map) : super(map) {} } @@ -105,26 +139,25 @@ class MonsterItems extends FilteredItems { Filter sources; Filter terrains; - MonsterItems(Map map) : super(map) { + MonsterItems(BuildContext context, Map 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 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 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 map) : super(map); } -Item itemFromMap(Map map) { +Item itemFromMap(BuildContext context, Map map) { switch (map["ItemType"]) { case "RaceItem": return RaceItem(map); @@ -240,13 +352,17 @@ Item itemFromMap(Map 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 itemsFromMapList(List> mapList) { +List itemsFromMapList(BuildContext context, List> mapList) { return List.generate(mapList.length, (i) { - return itemFromMap(mapList[i]); + return itemFromMap(context, mapList[i]); }); } diff --git a/aidedejeu_flutter/lib/theme.dart b/aidedejeu_flutter/lib/theme.dart index c42e31c8..cf4637e2 100644 --- a/aidedejeu_flutter/lib/theme.dart +++ b/aidedejeu_flutter/lib/theme.dart @@ -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, ); } diff --git a/aidedejeu_flutter/lib/widgets/filters.dart b/aidedejeu_flutter/lib/widgets/filters.dart index 5a23a42a..79d12732 100644 --- a/aidedejeu_flutter/lib/widgets/filters.dart +++ b/aidedejeu_flutter/lib/widgets/filters.dart @@ -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 { @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 { @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), diff --git a/aidedejeu_flutter/lib/widgets/homepage.dart b/aidedejeu_flutter/lib/widgets/homepage.dart index 75aeb711..9de25646 100644 --- a/aidedejeu_flutter/lib/widgets/homepage.dart +++ b/aidedejeu_flutter/lib/widgets/homepage.dart @@ -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", diff --git a/aidedejeu_flutter/lib/widgets/library.dart b/aidedejeu_flutter/lib/widgets/library.dart index 858064d0..b77a1ced 100644 --- a/aidedejeu_flutter/lib/widgets/library.dart +++ b/aidedejeu_flutter/lib/widgets/library.dart @@ -54,8 +54,8 @@ class _LibraryPageState extends State { } Future _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 { 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 { 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 { 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 { 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 { return Column(children: [ 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 { this.indexPage = index; }); }, + selectedItemColor: colorHDRed, items: _buildBottomNavigationBarItems(), ), endDrawer: filters != null @@ -253,7 +270,7 @@ class _LibraryPageState extends State { ) : null, appBar: AppBar( - title: Text(widget.id), + title: Text(item?.name ?? widget.id), actions: filters != null ? [ Builder( diff --git a/aidedejeu_flutter/lib/widgets/pceditor.dart b/aidedejeu_flutter/lib/widgets/pceditor.dart index e8236c8c..d91c04e6 100644 --- a/aidedejeu_flutter/lib/widgets/pceditor.dart +++ b/aidedejeu_flutter/lib/widgets/pceditor.dart @@ -34,31 +34,31 @@ class _PCEditorPageState extends State { } 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 { ? 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), ], ) diff --git a/aidedejeu_flutter/pubspec.lock b/aidedejeu_flutter/pubspec.lock index 110e5852..4927dd75 100644 --- a/aidedejeu_flutter/pubspec.lock +++ b/aidedejeu_flutter/pubspec.lock @@ -162,7 +162,7 @@ packages: name: intl url: "https://pub.dartlang.org" source: hosted - version: "0.16.1" + version: "0.16.0" intl_translation: dependency: "direct main" description: diff --git a/aidedejeu_flutter/pubspec.yaml b/aidedejeu_flutter/pubspec.yaml index 82fd8e29..baa5452e 100644 --- a/aidedejeu_flutter/pubspec.yaml +++ b/aidedejeu_flutter/pubspec.yaml @@ -87,6 +87,12 @@ flutter: - asset: assets/Cinzel-Bold.otf weight: 700 - asset: assets/Cinzel-Regular.otf + - family: Cinzel-Regular + fonts: + - asset: assets/Cinzel-Regular.otf + - family: Cinzel-Bold + fonts: + - asset: assets/Cinzel-Bold.otf - family: LinuxLibertine fonts: - asset: assets/LinLibertine_R.ttf