1
0
Fork 0
mirror of https://github.com/Nioux/AideDeJeu.git synced 2025-10-29 06:26:02 +00:00

Localization + theme

This commit is contained in:
Yan Maniez 2020-03-03 16:03:31 +01:00
parent 622b6a3196
commit 1197df6527
13 changed files with 223 additions and 95 deletions

View file

@ -1,39 +1,57 @@
{
"@@locale": "en",
"app_title": "Hello World",
"@app_title": {
"appTitle": "Hello World",
"@appTitle": {
"description": "Title for the application",
"type": "text",
"placeholders": {}
},
"library_title": "Library",
"@library_title": {
"libraryTitle": "Library",
"@libraryTitle": {
"description": "Title for the Library page",
"type": "text",
"placeholders": {}
},
"pceditor_title": "Player Characters",
"@pceditor_title": {
"pceditorTitle": "Player Characters",
"@pceditorTitle": {
"description": "Title for the Player Characters page",
"type": "text",
"placeholders": {}
},
"about_title": "About...",
"@about_title": {
"aboutTitle": "About...",
"@aboutTitle": {
"description": "Title for the About page",
"type": "text",
"placeholders": {}
},
"bookmarks_title": "Bookmarks",
"@bookmarks_title": {
"bookmarksTitle": "Bookmarks",
"@bookmarksTitle": {
"description": "Title for the Bookmarks page",
"type": "text",
"placeholders": {}
},
"search_title": "Search",
"@search_title": {
"searchTitle": "Search",
"@searchTitle": {
"description": "Title for the Search page",
"type": "text",
"placeholders": {}
},
"raceTitle": "Race",
"@raceTitle": {
"description": "Title for the Race page",
"type": "text",
"placeholders": {}
},
"backgroundTitle": "Background",
"@backgroundTitle": {
"description": "Title for the Background page",
"type": "text",
"placeholders": {}
},
"classTitle": "Class",
"@classTitle": {
"description": "Title for the Class page",
"type": "text",
"placeholders": {}
}
}

View file

@ -1,39 +1,57 @@
{
"@@locale": "fr",
"app_title": "Bonjour Monde",
"@app_title": {
"appTitle": "Bonjour Monde",
"@appTitle": {
"description": "Title for the application",
"type": "text",
"placeholders": {}
},
"library_title": "Bibliothèque",
"@library_title": {
"libraryTitle": "Bibliothèque",
"@libraryTitle": {
"description": "Title for the Library page",
"type": "text",
"placeholders": {}
},
"pceditor_title": "Personnages",
"@pceditor_title": {
"pceditorTitle": "Personnages",
"@pceditorTitle": {
"description": "Title for the Player Characters page",
"type": "text",
"placeholders": {}
},
"about_title": "A propos de...",
"@about_title": {
"aboutTitle": "A propos de...",
"@aboutTitle": {
"description": "Title for the About page",
"type": "text",
"placeholders": {}
},
"bookmarks_title": "Favoris",
"@bookmarks_title": {
"bookmarksTitle": "Favoris",
"@bookmarksTitle": {
"description": "Title for the Bookmarks page",
"type": "text",
"placeholders": {}
},
"search_title": "Recherche",
"@search_title": {
"searchTitle": "Recherche",
"@searchTitle": {
"description": "Title for the Search page",
"type": "text",
"placeholders": {}
},
"raceTitle": "Race",
"@raceTitle": {
"description": "Title for the Race page",
"type": "text",
"placeholders": {}
},
"backgroundTitle": "Historique",
"@backgroundTitle": {
"description": "Title for the Background page",
"type": "text",
"placeholders": {}
},
"classTitle": "Classe",
"@classTitle": {
"description": "Title for the Class page",
"type": "text",
"placeholders": {}
}
}

View file

@ -1,39 +1,57 @@
{
"@@last_modified": "2020-03-02T17:41:08.588343",
"app_title": "Hello World",
"@app_title": {
"@@last_modified": "2020-03-03T11:00:06.908535",
"appTitle": "Hello World",
"@appTitle": {
"description": "Title for the application",
"type": "text",
"placeholders": {}
},
"library_title": "Library",
"@library_title": {
"libraryTitle": "Library",
"@libraryTitle": {
"description": "Title for the Library page",
"type": "text",
"placeholders": {}
},
"pceditor_title": "Player Characters",
"@pceditor_title": {
"pceditorTitle": "Player Characters",
"@pceditorTitle": {
"description": "Title for the Player Characters page",
"type": "text",
"placeholders": {}
},
"about_title": "About...",
"@about_title": {
"aboutTitle": "About...",
"@aboutTitle": {
"description": "Title for the About page",
"type": "text",
"placeholders": {}
},
"bookmarks_title": "Bookmarks",
"@bookmarks_title": {
"bookmarksTitle": "Bookmarks",
"@bookmarksTitle": {
"description": "Title for the Bookmarks page",
"type": "text",
"placeholders": {}
},
"search_title": "Search",
"@search_title": {
"searchTitle": "Search",
"@searchTitle": {
"description": "Title for the Search page",
"type": "text",
"placeholders": {}
},
"raceTitle": "Race",
"@raceTitle": {
"description": "Title for the Race page",
"type": "text",
"placeholders": {}
},
"backgroundTitle": "Background",
"@backgroundTitle": {
"description": "Title for the Background page",
"type": "text",
"placeholders": {}
},
"classTitle": "Class",
"@classTitle": {
"description": "Title for the Class page",
"type": "text",
"placeholders": {}
}
}

View file

@ -21,11 +21,14 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"about_title" : MessageLookupByLibrary.simpleMessage("About..."),
"app_title" : MessageLookupByLibrary.simpleMessage("Hello World"),
"bookmarks_title" : MessageLookupByLibrary.simpleMessage("Bookmarks"),
"library_title" : MessageLookupByLibrary.simpleMessage("Library"),
"pceditor_title" : MessageLookupByLibrary.simpleMessage("Player Characters"),
"search_title" : MessageLookupByLibrary.simpleMessage("Search")
"aboutTitle" : MessageLookupByLibrary.simpleMessage("About..."),
"appTitle" : MessageLookupByLibrary.simpleMessage("Hello World"),
"backgroundTitle" : MessageLookupByLibrary.simpleMessage("Background"),
"bookmarksTitle" : MessageLookupByLibrary.simpleMessage("Bookmarks"),
"classTitle" : MessageLookupByLibrary.simpleMessage("Class"),
"libraryTitle" : MessageLookupByLibrary.simpleMessage("Library"),
"pceditorTitle" : MessageLookupByLibrary.simpleMessage("Player Characters"),
"raceTitle" : MessageLookupByLibrary.simpleMessage("Race"),
"searchTitle" : MessageLookupByLibrary.simpleMessage("Search")
};
}

View file

@ -21,11 +21,14 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function> {
"about_title" : MessageLookupByLibrary.simpleMessage("A propos de..."),
"app_title" : MessageLookupByLibrary.simpleMessage("Bonjour Monde"),
"bookmarks_title" : MessageLookupByLibrary.simpleMessage("Favoris"),
"library_title" : MessageLookupByLibrary.simpleMessage("Bibliothèque"),
"pceditor_title" : MessageLookupByLibrary.simpleMessage("Personnages"),
"search_title" : MessageLookupByLibrary.simpleMessage("Recherche")
"aboutTitle" : MessageLookupByLibrary.simpleMessage("A propos de..."),
"appTitle" : MessageLookupByLibrary.simpleMessage("Bonjour Monde"),
"backgroundTitle" : MessageLookupByLibrary.simpleMessage("Historique"),
"bookmarksTitle" : MessageLookupByLibrary.simpleMessage("Favoris"),
"classTitle" : MessageLookupByLibrary.simpleMessage("Classe"),
"libraryTitle" : MessageLookupByLibrary.simpleMessage("Bibliothèque"),
"pceditorTitle" : MessageLookupByLibrary.simpleMessage("Personnages"),
"raceTitle" : MessageLookupByLibrary.simpleMessage("Race"),
"searchTitle" : MessageLookupByLibrary.simpleMessage("Recherche")
};
}

View file

@ -21,59 +21,106 @@ class AppLocalizations {
final String localeName;
String get app_title {
String get appTitle {
return Intl.message(
'Hello World',
name: 'app_title',
name: 'appTitle',
desc: 'Title for the application',
locale: localeName,
);
}
String get library_title {
String get libraryTitle {
return Intl.message(
'Library',
name: 'library_title',
name: 'libraryTitle',
desc: 'Title for the Library page',
locale: localeName,
);
}
String get pceditor_title {
String get pceditorTitle {
return Intl.message(
'Player Characters',
name: 'pceditor_title',
name: 'pceditorTitle',
desc: 'Title for the Player Characters page',
locale: localeName,
);
}
String get about_title {
String get aboutTitle {
return Intl.message(
'About...',
name: 'about_title',
name: 'aboutTitle',
desc: 'Title for the About page',
locale: localeName,
);
}
String get bookmarks_title {
String get bookmarksTitle {
return Intl.message(
'Bookmarks',
name: 'bookmarks_title',
name: 'bookmarksTitle',
desc: 'Title for the Bookmarks page',
locale: localeName,
);
}
String get search_title {
String get searchTitle {
return Intl.message(
'Search',
name: 'search_title',
name: 'searchTitle',
desc: 'Title for the Search page',
locale: localeName,
);
}
String get raceTitle {
return Intl.message(
'Race',
name: 'raceTitle',
desc: 'Title for the Race page',
locale: localeName,
);
}
String get backgroundTitle {
return Intl.message(
'Background',
name: 'backgroundTitle',
desc: 'Title for the Background page',
locale: localeName,
);
}
String get classTitle {
return Intl.message(
'Class',
name: 'classTitle',
desc: 'Title for the Class page',
locale: localeName,
);
}
String get abilitiesTitle {
return Intl.message(
'Abilities',
name: 'abilitiesTitle',
desc: 'Title for the Abilities page',
locale: localeName,
);
}
String get othersTitle {
return Intl.message(
'Others',
name: 'othersTitle',
desc: 'Title for the Others page',
locale: localeName,
);
}
}
class AppLocalizationsDelegate extends LocalizationsDelegate<AppLocalizations> {

View file

@ -10,9 +10,10 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
//title: AppLocalizations.of(context).appTitle,
//title: 'Haches & Dés',
onGenerateTitle: (BuildContext context) =>
AppLocalizations.of(context).app_title,
AppLocalizations.of(context).appTitle,
localizationsDelegates: [
const AppLocalizationsDelegate(),
GlobalMaterialLocalizations.delegate,

View file

@ -8,16 +8,21 @@ ThemeData mainTheme() {
color: Colors.white,
iconTheme: IconThemeData(color: Colors.black),
textTheme: TextTheme(
headline6: TextStyle(fontSize: 28.0, color: Colors.black, fontWeight: FontWeight.bold, fontFamily: 'Cinzel')),
title: TextStyle(
fontSize: 28.0,
color: Colors.black,
fontWeight: FontWeight.bold,
fontFamily: 'Cinzel')),
),
brightness: Brightness.light,
primaryColor: Colors.lightBlue[800],
accentColor: Colors.cyan[600],
fontFamily: 'LinuxLibertine',
textTheme: TextTheme(
headline5: TextStyle(fontSize: 28.0, fontWeight: FontWeight.bold, fontFamily: 'Cinzel'),
headline6: TextStyle(fontSize: 22.0, fontStyle: FontStyle.normal),
bodyText2: TextStyle(fontSize: 16.0),
headline: TextStyle(
fontSize: 28.0, fontWeight: FontWeight.bold, fontFamily: 'Cinzel'),
title: TextStyle(fontSize: 22.0, fontStyle: FontStyle.normal),
body1: TextStyle(fontSize: 16.0),
),
);
}
@ -27,4 +32,4 @@ MarkdownStyleSheet mainMarkdownStyleSheet(BuildContext context) {
tableColumnWidth: IntrinsicColumnWidth(),
tableCellsPadding: EdgeInsets.all(0.2),
);
}
}

View file

@ -12,14 +12,14 @@ class HomePage extends StatelessWidget {
return Scaffold(
appBar: AppBar(
title: Text(
AppLocalizations.of(context).app_title,
AppLocalizations.of(context).appTitle,
),
),
body: Column(
children: <Widget>[
FlatButton.icon(
label: Text(
AppLocalizations.of(context).library_title,
AppLocalizations.of(context).libraryTitle,
),
icon: SvgPicture.asset(
"assets/spell-book.svg",
@ -38,7 +38,7 @@ class HomePage extends StatelessWidget {
),
FlatButton.icon(
label: Text(
AppLocalizations.of(context).pceditor_title,
AppLocalizations.of(context).pceditorTitle,
),
icon: SvgPicture.asset(
"assets/swordman.svg",
@ -55,7 +55,7 @@ class HomePage extends StatelessWidget {
),
FlatButton.icon(
label: Text(
AppLocalizations.of(context).about_title,
AppLocalizations.of(context).aboutTitle,
),
icon: SvgPicture.asset(
"assets/wooden-sign.svg",

View file

@ -139,15 +139,15 @@ class _LibraryPageState extends State<LibraryPage> {
List _buildBottomNavigationBarItems() {
return <BottomNavigationBarItem>[
_buildBottomNavigationBarItem(
AppLocalizations.of(context).library_title,
AppLocalizations.of(context).libraryTitle,
"assets/spell-book.svg",
),
_buildBottomNavigationBarItem(
AppLocalizations.of(context).bookmarks_title,
AppLocalizations.of(context).bookmarksTitle,
"assets/stars-stack.svg",
),
_buildBottomNavigationBarItem(
AppLocalizations.of(context).search_title,
AppLocalizations.of(context).searchTitle,
"assets/crystal-ball.svg",
),
];

View file

@ -1,5 +1,7 @@
import 'package:aidedejeu_flutter/database.dart';
import 'package:aidedejeu_flutter/localization.dart';
import 'package:aidedejeu_flutter/models/items.dart';
import 'package:aidedejeu_flutter/theme.dart';
import 'package:aidedejeu_flutter/widgets/library.dart';
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
@ -7,15 +9,6 @@ import 'package:flutter_markdown/flutter_markdown.dart';
class PCEditorPage extends StatefulWidget {
PCEditorPage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Personnage"),
),
body: Column());
}
@override
State<StatefulWidget> createState() => _PCEditorPageState();
}
@ -164,20 +157,27 @@ class _PCEditorPageState extends State<PCEditorPage> {
Widget _loadRaceDetailsWidget() {
return _race != null
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Augmentation de caractéristiques"),
Text("Augmentation de caractéristiques", style: TextStyle(fontSize: 16, fontFamily: "Cinzel",)),
_loadMarkdown(_race?.abilityScoreIncrease),
_loadMarkdown(_subRace?.abilityScoreIncrease),
Text(""),
Text("Âge"),
_loadMarkdown(_race?.age),
Text(""),
Text("Alignement"),
_loadMarkdown(_race?.alignment),
Text(""),
Text("Taille"),
_loadMarkdown(_race?.size),
Text(""),
Text("Vitesse"),
_loadMarkdown(_race?.speed),
Text(""),
Text("Vision dans le noir"),
_loadMarkdown(_race?.darkvision),
Text(""),
Text("Langues"),
_loadMarkdown(_race?.languages),
],
@ -212,23 +212,35 @@ class _PCEditorPageState extends State<PCEditorPage> {
@override
Widget build(BuildContext context) {
return DefaultTabController(
length: 3,
length: 5,
child: Scaffold(
appBar: AppBar(
title: Text("Personnage"),
title: Text(AppLocalizations.of(context).pceditorTitle),
bottom: TabBar(
labelColor: Colors.black,
isScrollable: true,
indicatorColor: Theme.of(context).accentColor, // Colors.red,
indicatorSize: TabBarIndicatorSize.label,
tabs: <Widget>[
Text(
"Race",
style: TextStyle(color: Colors.black),
AppLocalizations.of(context).raceTitle,
style: TextStyle(fontSize: 25, fontFamily: "Cinzel",),
),
Text(
"Historique",
style: TextStyle(color: Colors.black),
AppLocalizations.of(context).backgroundTitle,
style: TextStyle(fontSize: 25, fontFamily: "Cinzel",),
),
Text(
"Classe",
style: TextStyle(color: Colors.black),
AppLocalizations.of(context).classTitle,
style: TextStyle(fontSize: 25, fontFamily: "Cinzel",),
),
Text(
AppLocalizations.of(context).abilitiesTitle,
style: TextStyle(fontSize: 25, fontFamily: "Cinzel",),
),
Text(
AppLocalizations.of(context).othersTitle,
style: TextStyle(fontSize: 25, fontFamily: "Cinzel",),
),
],
),
@ -248,7 +260,9 @@ class _PCEditorPageState extends State<PCEditorPage> {
_loadSubBackgroundsWidget(),
],
),
Text(""),
Text(AppLocalizations.of(context).classTitle),
Text(AppLocalizations.of(context).abilitiesTitle),
Text(AppLocalizations.of(context).othersTitle),
],
),
),

View file

@ -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:
@ -387,4 +387,4 @@ packages:
version: "2.2.0"
sdks:
dart: ">=2.7.0 <3.0.0"
flutter: ">=1.12.1 <2.0.0"
flutter: ">=1.12.13+hotfix.8 <2.0.0"

View file

@ -15,6 +15,7 @@ version: 1.0.0+1
environment:
sdk: ">=2.2.0 <3.0.0"
flutter: ^1.12.13+hotfix.8
dependencies:
flutter: