mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-30 15:06:06 +00:00
Localisations
This commit is contained in:
parent
512adf99d8
commit
bc8bb68a28
15 changed files with 1002 additions and 73 deletions
|
|
@ -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),
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
],
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue