mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-12-16 15:19:56 +00:00
Theme + localize
This commit is contained in:
parent
ba33b7dbd7
commit
28fd23b2d1
7 changed files with 257 additions and 96 deletions
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:aidedejeu_flutter/theme.dart';
|
||||
import 'package:aidedejeu_flutter/widgets/homepage.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
|
@ -8,24 +9,7 @@ class MyApp extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
return MaterialApp(
|
||||
title: 'Haches & Dés',
|
||||
theme: ThemeData(
|
||||
primarySwatch: Colors.deepOrange,
|
||||
appBarTheme: AppBarTheme(
|
||||
color: Colors.white,
|
||||
iconTheme: IconThemeData(color: Colors.black),
|
||||
textTheme: TextTheme(
|
||||
headline6: 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),
|
||||
),
|
||||
),
|
||||
theme: mainTheme(),
|
||||
home: HomePage(),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
30
aidedejeu_flutter/lib/theme.dart
Normal file
30
aidedejeu_flutter/lib/theme.dart
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
|
||||
ThemeData mainTheme() {
|
||||
return ThemeData(
|
||||
primarySwatch: Colors.deepOrange,
|
||||
appBarTheme: AppBarTheme(
|
||||
color: Colors.white,
|
||||
iconTheme: IconThemeData(color: Colors.black),
|
||||
textTheme: TextTheme(
|
||||
headline6: 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),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
MarkdownStyleSheet mainMarkdownStyleSheet(BuildContext context) {
|
||||
return MarkdownStyleSheet.fromTheme(Theme.of(context)).copyWith(
|
||||
tableColumnWidth: IntrinsicColumnWidth(),
|
||||
tableCellsPadding: EdgeInsets.all(0.2),
|
||||
);
|
||||
}
|
||||
|
|
@ -7,6 +7,8 @@ import 'package:flutter/services.dart';
|
|||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
|
||||
import '../theme.dart';
|
||||
|
||||
class LibraryPage extends StatefulWidget {
|
||||
LibraryPage({Key key, @required this.id}) : super(key: key);
|
||||
|
||||
|
|
@ -48,10 +50,8 @@ class _LibraryPageState extends State<LibraryPage> {
|
|||
@protected
|
||||
@mustCallSuper
|
||||
void didChangeDependencies() {
|
||||
styleSheet = MarkdownStyleSheet.fromTheme(Theme.of(context)).copyWith(
|
||||
tableColumnWidth: IntrinsicColumnWidth(),
|
||||
tableCellsPadding: EdgeInsets.all(0.2),
|
||||
);
|
||||
super.didChangeDependencies();
|
||||
styleSheet = mainMarkdownStyleSheet(context);
|
||||
}
|
||||
|
||||
Future<Item> _loadItem() async {
|
||||
|
|
|
|||
|
|
@ -81,68 +81,77 @@ class _PCEditorPageState extends State<PCEditorPage> {
|
|||
}
|
||||
|
||||
Widget _loadRaceSubRaceWidget() {
|
||||
return _race != null ? Column(
|
||||
children: [
|
||||
Text("Augmentation de caractéristiques"),
|
||||
MarkdownBody(
|
||||
data: (_race?.abilityScoreIncrease ?? "") +
|
||||
"\n\n" +
|
||||
(_subRace?.abilityScoreIncrease ?? ""),
|
||||
onTapLink: (link) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => LibraryPage(id: link)),
|
||||
),
|
||||
),
|
||||
Text("Âge"),
|
||||
MarkdownBody(
|
||||
data: _race?.age ?? "",
|
||||
onTapLink: (link) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => LibraryPage(id: link)),
|
||||
),
|
||||
),
|
||||
Text("Alignement"),
|
||||
MarkdownBody(
|
||||
data: _race?.alignment ?? "",
|
||||
onTapLink: (link) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => LibraryPage(id: link)),
|
||||
),
|
||||
),
|
||||
Text("Taille"),
|
||||
MarkdownBody(
|
||||
data: _race?.size ?? "",
|
||||
onTapLink: (link) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => LibraryPage(id: link)),
|
||||
),
|
||||
),
|
||||
Text("Vitesse"),
|
||||
MarkdownBody(
|
||||
data: _race?.speed ?? "",
|
||||
onTapLink: (link) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => LibraryPage(id: link)),
|
||||
),
|
||||
),
|
||||
Text("Vision dans le noir"),
|
||||
MarkdownBody(
|
||||
data: _race?.darkvision ?? "",
|
||||
onTapLink: (link) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => LibraryPage(id: link)),
|
||||
),
|
||||
),
|
||||
Text("Langues"),
|
||||
MarkdownBody(
|
||||
data: _race?.languages ?? "",
|
||||
onTapLink: (link) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(builder: (context) => LibraryPage(id: link)),
|
||||
),
|
||||
),
|
||||
],
|
||||
): SizedBox.shrink();
|
||||
return _race != null
|
||||
? Column(
|
||||
children: [
|
||||
Text("Augmentation de caractéristiques"),
|
||||
MarkdownBody(
|
||||
data: (_race?.abilityScoreIncrease ?? "") +
|
||||
"\n\n" +
|
||||
(_subRace?.abilityScoreIncrease ?? ""),
|
||||
onTapLink: (link) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => LibraryPage(id: link)),
|
||||
),
|
||||
),
|
||||
Text("Âge"),
|
||||
MarkdownBody(
|
||||
data: _race?.age ?? "",
|
||||
onTapLink: (link) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => LibraryPage(id: link)),
|
||||
),
|
||||
),
|
||||
Text("Alignement"),
|
||||
MarkdownBody(
|
||||
data: _race?.alignment ?? "",
|
||||
onTapLink: (link) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => LibraryPage(id: link)),
|
||||
),
|
||||
),
|
||||
Text("Taille"),
|
||||
MarkdownBody(
|
||||
data: _race?.size ?? "",
|
||||
onTapLink: (link) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => LibraryPage(id: link)),
|
||||
),
|
||||
),
|
||||
Text("Vitesse"),
|
||||
MarkdownBody(
|
||||
data: _race?.speed ?? "",
|
||||
onTapLink: (link) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => LibraryPage(id: link)),
|
||||
),
|
||||
),
|
||||
Text("Vision dans le noir"),
|
||||
MarkdownBody(
|
||||
data: _race?.darkvision ?? "",
|
||||
onTapLink: (link) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => LibraryPage(id: link)),
|
||||
),
|
||||
),
|
||||
Text("Langues"),
|
||||
MarkdownBody(
|
||||
data: _race?.languages ?? "",
|
||||
onTapLink: (link) => Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => LibraryPage(id: link)),
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
: SizedBox.shrink();
|
||||
}
|
||||
|
||||
Widget _loadSubRacesWidget() {
|
||||
|
|
@ -167,18 +176,42 @@ class _PCEditorPageState extends State<PCEditorPage> {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Personnage"),
|
||||
return DefaultTabController(
|
||||
length: 3,
|
||||
child: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("Personnage"),
|
||||
bottom: TabBar(
|
||||
tabs: <Widget>[
|
||||
Text(
|
||||
"Race",
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
Text(
|
||||
"Historique",
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
Text(
|
||||
"Classe",
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: TabBarView(
|
||||
children: [
|
||||
ListView(
|
||||
children: <Widget>[
|
||||
_loadRacesWidget(),
|
||||
_loadSubRacesWidget(),
|
||||
_loadRaceSubRaceWidget(),
|
||||
],
|
||||
),
|
||||
Text(""),
|
||||
Text(""),
|
||||
],
|
||||
),
|
||||
),
|
||||
body: ListView(
|
||||
children: <Widget>[
|
||||
_loadRacesWidget(),
|
||||
_loadSubRacesWidget(),
|
||||
_loadRaceSubRaceWidget()
|
||||
],
|
||||
),
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue