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

Theme + localize

This commit is contained in:
Yan Maniez 2020-03-01 19:04:48 +01:00
parent ba33b7dbd7
commit 28fd23b2d1
7 changed files with 257 additions and 96 deletions

1
.gitignore vendored
View file

@ -265,3 +265,4 @@ __pycache__/
/Ignore /Ignore
/AideDeJeu/AideDeJeuWeb/Properties/PublishProfiles/AideDeJeuWeb - Web Deploy.pubxml /AideDeJeu/AideDeJeuWeb/Properties/PublishProfiles/AideDeJeuWeb - Web Deploy.pubxml
*.lock *.lock
*.lock

View file

@ -1,3 +1,4 @@
import 'package:aidedejeu_flutter/theme.dart';
import 'package:aidedejeu_flutter/widgets/homepage.dart'; import 'package:aidedejeu_flutter/widgets/homepage.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -8,24 +9,7 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return MaterialApp( return MaterialApp(
title: 'Haches & Dés', title: 'Haches & Dés',
theme: ThemeData( theme: mainTheme(),
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),
),
),
home: HomePage(), home: HomePage(),
); );
} }

View 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),
);
}

View file

@ -7,6 +7,8 @@ import 'package:flutter/services.dart';
import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_svg/flutter_svg.dart';
import '../theme.dart';
class LibraryPage extends StatefulWidget { class LibraryPage extends StatefulWidget {
LibraryPage({Key key, @required this.id}) : super(key: key); LibraryPage({Key key, @required this.id}) : super(key: key);
@ -48,10 +50,8 @@ class _LibraryPageState extends State<LibraryPage> {
@protected @protected
@mustCallSuper @mustCallSuper
void didChangeDependencies() { void didChangeDependencies() {
styleSheet = MarkdownStyleSheet.fromTheme(Theme.of(context)).copyWith( super.didChangeDependencies();
tableColumnWidth: IntrinsicColumnWidth(), styleSheet = mainMarkdownStyleSheet(context);
tableCellsPadding: EdgeInsets.all(0.2),
);
} }
Future<Item> _loadItem() async { Future<Item> _loadItem() async {

View file

@ -81,7 +81,8 @@ class _PCEditorPageState extends State<PCEditorPage> {
} }
Widget _loadRaceSubRaceWidget() { Widget _loadRaceSubRaceWidget() {
return _race != null ? Column( return _race != null
? Column(
children: [ children: [
Text("Augmentation de caractéristiques"), Text("Augmentation de caractéristiques"),
MarkdownBody( MarkdownBody(
@ -90,7 +91,8 @@ class _PCEditorPageState extends State<PCEditorPage> {
(_subRace?.abilityScoreIncrease ?? ""), (_subRace?.abilityScoreIncrease ?? ""),
onTapLink: (link) => Navigator.push( onTapLink: (link) => Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => LibraryPage(id: link)), MaterialPageRoute(
builder: (context) => LibraryPage(id: link)),
), ),
), ),
Text("Âge"), Text("Âge"),
@ -98,7 +100,8 @@ class _PCEditorPageState extends State<PCEditorPage> {
data: _race?.age ?? "", data: _race?.age ?? "",
onTapLink: (link) => Navigator.push( onTapLink: (link) => Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => LibraryPage(id: link)), MaterialPageRoute(
builder: (context) => LibraryPage(id: link)),
), ),
), ),
Text("Alignement"), Text("Alignement"),
@ -106,7 +109,8 @@ class _PCEditorPageState extends State<PCEditorPage> {
data: _race?.alignment ?? "", data: _race?.alignment ?? "",
onTapLink: (link) => Navigator.push( onTapLink: (link) => Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => LibraryPage(id: link)), MaterialPageRoute(
builder: (context) => LibraryPage(id: link)),
), ),
), ),
Text("Taille"), Text("Taille"),
@ -114,7 +118,8 @@ class _PCEditorPageState extends State<PCEditorPage> {
data: _race?.size ?? "", data: _race?.size ?? "",
onTapLink: (link) => Navigator.push( onTapLink: (link) => Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => LibraryPage(id: link)), MaterialPageRoute(
builder: (context) => LibraryPage(id: link)),
), ),
), ),
Text("Vitesse"), Text("Vitesse"),
@ -122,7 +127,8 @@ class _PCEditorPageState extends State<PCEditorPage> {
data: _race?.speed ?? "", data: _race?.speed ?? "",
onTapLink: (link) => Navigator.push( onTapLink: (link) => Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => LibraryPage(id: link)), MaterialPageRoute(
builder: (context) => LibraryPage(id: link)),
), ),
), ),
Text("Vision dans le noir"), Text("Vision dans le noir"),
@ -130,7 +136,8 @@ class _PCEditorPageState extends State<PCEditorPage> {
data: _race?.darkvision ?? "", data: _race?.darkvision ?? "",
onTapLink: (link) => Navigator.push( onTapLink: (link) => Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => LibraryPage(id: link)), MaterialPageRoute(
builder: (context) => LibraryPage(id: link)),
), ),
), ),
Text("Langues"), Text("Langues"),
@ -138,11 +145,13 @@ class _PCEditorPageState extends State<PCEditorPage> {
data: _race?.languages ?? "", data: _race?.languages ?? "",
onTapLink: (link) => Navigator.push( onTapLink: (link) => Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => LibraryPage(id: link)), MaterialPageRoute(
builder: (context) => LibraryPage(id: link)),
), ),
), ),
], ],
): SizedBox.shrink(); )
: SizedBox.shrink();
} }
Widget _loadSubRacesWidget() { Widget _loadSubRacesWidget() {
@ -167,18 +176,42 @@ class _PCEditorPageState extends State<PCEditorPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return DefaultTabController(
length: 3,
child: Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text("Personnage"), title: Text("Personnage"),
bottom: TabBar(
tabs: <Widget>[
Text(
"Race",
style: TextStyle(color: Colors.black),
), ),
body: ListView( Text(
"Historique",
style: TextStyle(color: Colors.black),
),
Text(
"Classe",
style: TextStyle(color: Colors.black),
),
],
),
),
body: TabBarView(
children: [
ListView(
children: <Widget>[ children: <Widget>[
_loadRacesWidget(), _loadRacesWidget(),
_loadSubRacesWidget(), _loadSubRacesWidget(),
_loadRaceSubRaceWidget() _loadRaceSubRaceWidget(),
], ],
), ),
Text(""),
Text(""),
],
),
),
); );
} }
} }

View file

@ -1,6 +1,20 @@
# Generated by pub # Generated by pub
# See https://dart.dev/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
_fe_analyzer_shared:
dependency: transitive
description:
name: _fe_analyzer_shared
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.dartlang.org"
source: hosted
version: "0.39.4"
archive: archive:
dependency: transitive dependency: transitive
description: description:
@ -64,6 +78,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.3" version: "2.1.3"
csslib:
dependency: transitive
description:
name: csslib
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
cupertino_icons: cupertino_icons:
dependency: "direct main" dependency: "direct main"
description: description:
@ -71,6 +92,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.1.3" version: "0.1.3"
dart_style:
dependency: transitive
description:
name: dart_style
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.3"
flutter: flutter:
dependency: "direct main" dependency: "direct main"
description: flutter description: flutter
@ -83,6 +111,11 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.2.0" version: "3.2.0"
flutter_localizations:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_markdown: flutter_markdown:
dependency: "direct main" dependency: "direct main"
description: description:
@ -102,6 +135,20 @@ packages:
description: flutter description: flutter
source: sdk source: sdk
version: "0.0.0" version: "0.0.0"
glob:
dependency: transitive
description:
name: glob
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
html:
dependency: transitive
description:
name: html
url: "https://pub.dartlang.org"
source: hosted
version: "0.14.0+3"
image: image:
dependency: transitive dependency: transitive
description: description:
@ -109,6 +156,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.4" version: "2.1.4"
intl:
dependency: transitive
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
intl_translation:
dependency: "direct dev"
description:
name: intl_translation
url: "https://pub.dartlang.org"
source: hosted
version: "0.17.9"
js:
dependency: transitive
description:
name: js
url: "https://pub.dartlang.org"
source: hosted
version: "0.6.1+1"
markdown: markdown:
dependency: transitive dependency: transitive
description: description:
@ -137,6 +205,27 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.0.4" version: "0.0.4"
node_interop:
dependency: transitive
description:
name: node_interop
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.3"
node_io:
dependency: transitive
description:
name: node_io
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.1+2"
package_config:
dependency: transitive
description:
name: package_config
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.1"
path: path:
dependency: "direct main" dependency: "direct main"
description: description:
@ -179,6 +268,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.0.4" version: "4.0.4"
pub_semver:
dependency: transitive
description:
name: pub_semver
url: "https://pub.dartlang.org"
source: hosted
version: "1.4.3"
quiver: quiver:
dependency: transitive dependency: transitive
description: description:
@ -268,6 +364,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.0.8" version: "2.0.8"
watcher:
dependency: transitive
description:
name: watcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.9.7+13"
xml: xml:
dependency: transitive dependency: transitive
description: description:
@ -275,6 +378,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.5.0" version: "3.5.0"
yaml:
dependency: transitive
description:
name: yaml
url: "https://pub.dartlang.org"
source: hosted
version: "2.2.0"
sdks: sdks:
dart: ">=2.6.0 <3.0.0" dart: ">=2.7.0 <3.0.0"
flutter: ">=1.12.1 <2.0.0" flutter: ">=1.12.1 <2.0.0"

View file

@ -19,6 +19,8 @@ environment:
dependencies: dependencies:
flutter: flutter:
sdk: flutter sdk: flutter
flutter_localizations:
sdk: flutter
flutter_markdown: ^0.3.3 flutter_markdown: ^0.3.3
sqflite: sqflite:
path: path:
@ -32,6 +34,7 @@ dependencies:
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
sdk: flutter sdk: flutter
intl_translation:
# For information on the generic Dart part of this file, see the # For information on the generic Dart part of this file, see the