mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-31 15:36:07 +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 | /Ignore | ||||||
| /AideDeJeu/AideDeJeuWeb/Properties/PublishProfiles/AideDeJeuWeb - Web Deploy.pubxml | /AideDeJeu/AideDeJeuWeb/Properties/PublishProfiles/AideDeJeuWeb - Web Deploy.pubxml | ||||||
| *.lock | *.lock | ||||||
|  | *.lock | ||||||
|  |  | ||||||
|  | @ -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(), | ||||||
|     ); |     ); | ||||||
|   } |   } | ||||||
|  |  | ||||||
							
								
								
									
										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_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 { | ||||||
|  |  | ||||||
|  | @ -81,68 +81,77 @@ class _PCEditorPageState extends State<PCEditorPage> { | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   Widget _loadRaceSubRaceWidget() { |   Widget _loadRaceSubRaceWidget() { | ||||||
|     return _race != null ? Column( |     return _race != null | ||||||
|       children: [ |         ? Column( | ||||||
|         Text("Augmentation de caractéristiques"), |             children: [ | ||||||
|         MarkdownBody( |               Text("Augmentation de caractéristiques"), | ||||||
|           data: (_race?.abilityScoreIncrease ?? "") + |               MarkdownBody( | ||||||
|               "\n\n" + |                 data: (_race?.abilityScoreIncrease ?? "") + | ||||||
|               (_subRace?.abilityScoreIncrease ?? ""), |                     "\n\n" + | ||||||
|           onTapLink: (link) => Navigator.push( |                     (_subRace?.abilityScoreIncrease ?? ""), | ||||||
|             context, |                 onTapLink: (link) => Navigator.push( | ||||||
|             MaterialPageRoute(builder: (context) => LibraryPage(id: link)), |                   context, | ||||||
|           ), |                   MaterialPageRoute( | ||||||
|         ), |                       builder: (context) => LibraryPage(id: link)), | ||||||
|         Text("Âge"), |                 ), | ||||||
|         MarkdownBody( |               ), | ||||||
|           data: _race?.age ?? "", |               Text("Âge"), | ||||||
|           onTapLink: (link) => Navigator.push( |               MarkdownBody( | ||||||
|             context, |                 data: _race?.age ?? "", | ||||||
|             MaterialPageRoute(builder: (context) => LibraryPage(id: link)), |                 onTapLink: (link) => Navigator.push( | ||||||
|           ), |                   context, | ||||||
|         ), |                   MaterialPageRoute( | ||||||
|         Text("Alignement"), |                       builder: (context) => LibraryPage(id: link)), | ||||||
|         MarkdownBody( |                 ), | ||||||
|           data: _race?.alignment ?? "", |               ), | ||||||
|           onTapLink: (link) => Navigator.push( |               Text("Alignement"), | ||||||
|             context, |               MarkdownBody( | ||||||
|             MaterialPageRoute(builder: (context) => LibraryPage(id: link)), |                 data: _race?.alignment ?? "", | ||||||
|           ), |                 onTapLink: (link) => Navigator.push( | ||||||
|         ), |                   context, | ||||||
|         Text("Taille"), |                   MaterialPageRoute( | ||||||
|         MarkdownBody( |                       builder: (context) => LibraryPage(id: link)), | ||||||
|           data: _race?.size ?? "", |                 ), | ||||||
|           onTapLink: (link) => Navigator.push( |               ), | ||||||
|             context, |               Text("Taille"), | ||||||
|             MaterialPageRoute(builder: (context) => LibraryPage(id: link)), |               MarkdownBody( | ||||||
|           ), |                 data: _race?.size ?? "", | ||||||
|         ), |                 onTapLink: (link) => Navigator.push( | ||||||
|         Text("Vitesse"), |                   context, | ||||||
|         MarkdownBody( |                   MaterialPageRoute( | ||||||
|           data: _race?.speed ?? "", |                       builder: (context) => LibraryPage(id: link)), | ||||||
|           onTapLink: (link) => Navigator.push( |                 ), | ||||||
|             context, |               ), | ||||||
|             MaterialPageRoute(builder: (context) => LibraryPage(id: link)), |               Text("Vitesse"), | ||||||
|           ), |               MarkdownBody( | ||||||
|         ), |                 data: _race?.speed ?? "", | ||||||
|         Text("Vision dans le noir"), |                 onTapLink: (link) => Navigator.push( | ||||||
|         MarkdownBody( |                   context, | ||||||
|           data: _race?.darkvision ?? "", |                   MaterialPageRoute( | ||||||
|           onTapLink: (link) => Navigator.push( |                       builder: (context) => LibraryPage(id: link)), | ||||||
|             context, |                 ), | ||||||
|             MaterialPageRoute(builder: (context) => LibraryPage(id: link)), |               ), | ||||||
|           ), |               Text("Vision dans le noir"), | ||||||
|         ), |               MarkdownBody( | ||||||
|         Text("Langues"), |                 data: _race?.darkvision ?? "", | ||||||
|         MarkdownBody( |                 onTapLink: (link) => Navigator.push( | ||||||
|           data: _race?.languages ?? "", |                   context, | ||||||
|           onTapLink: (link) => Navigator.push( |                   MaterialPageRoute( | ||||||
|             context, |                       builder: (context) => LibraryPage(id: link)), | ||||||
|             MaterialPageRoute(builder: (context) => LibraryPage(id: link)), |                 ), | ||||||
|           ), |               ), | ||||||
|         ), |               Text("Langues"), | ||||||
|       ], |               MarkdownBody( | ||||||
|     ): SizedBox.shrink(); |                 data: _race?.languages ?? "", | ||||||
|  |                 onTapLink: (link) => Navigator.push( | ||||||
|  |                   context, | ||||||
|  |                   MaterialPageRoute( | ||||||
|  |                       builder: (context) => LibraryPage(id: link)), | ||||||
|  |                 ), | ||||||
|  |               ), | ||||||
|  |             ], | ||||||
|  |           ) | ||||||
|  |         : 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( | ||||||
|       appBar: AppBar( |       length: 3, | ||||||
|         title: Text("Personnage"), |       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 | # 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" | ||||||
|  |  | ||||||
|  | @ -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 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez