mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-30 23:16:09 +00:00 
			
		
		
		
	Theme + localize
This commit is contained in:
		
							parent
							
								
									ba33b7dbd7
								
							
						
					
					
						commit
						28fd23b2d1
					
				
					 7 changed files with 257 additions and 96 deletions
				
			
		
							
								
								
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
										
									
									
										vendored
									
									
								
							|  | @ -265,3 +265,4 @@ __pycache__/ | |||
| /Ignore | ||||
| /AideDeJeu/AideDeJeuWeb/Properties/PublishProfiles/AideDeJeuWeb - Web Deploy.pubxml | ||||
| *.lock | ||||
| *.lock | ||||
|  |  | |||
|  | @ -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() | ||||
|         ], | ||||
|       ), | ||||
| 
 | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -1,6 +1,20 @@ | |||
| # Generated by pub | ||||
| # See https://dart.dev/tools/pub/glossary#lockfile | ||||
| 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: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|  | @ -64,6 +78,13 @@ packages: | |||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "2.1.3" | ||||
|   csslib: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: csslib | ||||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "0.16.1" | ||||
|   cupertino_icons: | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
|  | @ -71,6 +92,13 @@ packages: | |||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "0.1.3" | ||||
|   dart_style: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: dart_style | ||||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "1.3.3" | ||||
|   flutter: | ||||
|     dependency: "direct main" | ||||
|     description: flutter | ||||
|  | @ -83,6 +111,11 @@ packages: | |||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "3.2.0" | ||||
|   flutter_localizations: | ||||
|     dependency: "direct main" | ||||
|     description: flutter | ||||
|     source: sdk | ||||
|     version: "0.0.0" | ||||
|   flutter_markdown: | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
|  | @ -102,6 +135,20 @@ packages: | |||
|     description: flutter | ||||
|     source: sdk | ||||
|     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: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|  | @ -109,6 +156,27 @@ packages: | |||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     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: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|  | @ -137,6 +205,27 @@ packages: | |||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     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: | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
|  | @ -179,6 +268,13 @@ packages: | |||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "4.0.4" | ||||
|   pub_semver: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: pub_semver | ||||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "1.4.3" | ||||
|   quiver: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|  | @ -268,6 +364,13 @@ packages: | |||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "2.0.8" | ||||
|   watcher: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: watcher | ||||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "0.9.7+13" | ||||
|   xml: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|  | @ -275,6 +378,13 @@ packages: | |||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "3.5.0" | ||||
|   yaml: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: yaml | ||||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "2.2.0" | ||||
| sdks: | ||||
|   dart: ">=2.6.0 <3.0.0" | ||||
|   dart: ">=2.7.0 <3.0.0" | ||||
|   flutter: ">=1.12.1 <2.0.0" | ||||
|  |  | |||
|  | @ -19,6 +19,8 @@ environment: | |||
| dependencies: | ||||
|   flutter: | ||||
|     sdk: flutter | ||||
|   flutter_localizations: | ||||
|     sdk: flutter | ||||
|   flutter_markdown: ^0.3.3 | ||||
|   sqflite: | ||||
|   path: | ||||
|  | @ -32,6 +34,7 @@ dependencies: | |||
| dev_dependencies: | ||||
|   flutter_test: | ||||
|     sdk: flutter | ||||
|   intl_translation: | ||||
| 
 | ||||
| 
 | ||||
| # For information on the generic Dart part of this file, see the | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez