mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-31 15:36:07 +00:00 
			
		
		
		
	Dup
This commit is contained in:
		
							parent
							
								
									57c792a1cf
								
							
						
					
					
						commit
						fa0e36faa8
					
				
					 12 changed files with 212 additions and 79 deletions
				
			
		
							
								
								
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/Cinzel-Bold.otf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/Cinzel-Bold.otf
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/Cinzel-Regular.otf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/Cinzel-Regular.otf
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/LinLibertine_R.ttf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/LinLibertine_R.ttf
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/LinLibertine_RB.ttf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/LinLibertine_RB.ttf
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/LinLibertine_RBI.ttf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/LinLibertine_RBI.ttf
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/LinLibertine_RI.ttf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/LinLibertine_RI.ttf
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/MarcellusSC-Regular.ttf
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/MarcellusSC-Regular.ttf
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										1
									
								
								aidedejeu_flutter/assets/crystal-ball.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								aidedejeu_flutter/assets/crystal-ball.svg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1 @@ | |||
| <svg style="height: 512px; width: 512px;" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M0 0h512v512H0z" fill="#fff" fill-opacity="0"></path><g class="" style="touch-action: none;" transform="translate(0,0)"><path d="M254.563 20.75c-42.96 0-85.918 16.387-118.688 49.156-65.54 65.54-65.852 172.15-.313 237.688 65.54 65.54 172.15 65.226 237.688-.313 65.54-65.538 65.54-171.835 0-237.374-32.77-32.77-75.728-49.156-118.688-49.156zm-.157 18.47c25.68.053 51.363 6.724 74.313 19.968-13.573-3.984-26.266-2.455-34.22 5.5-14.437 14.437-7.796 44.485 14.813 67.093 22.608 22.61 52.625 29.22 67.062 14.782 8.523-8.522 9.706-22.468 4.594-37.125 36.352 57.684 29.586 134.6-20.69 184.875-29.158 29.16-67.353 43.773-105.56 43.813 9.436-2.3 17.762-6.732 24.436-13.406 28.885-28.886 15.64-88.954-29.594-134.19-45.234-45.233-105.302-58.51-134.187-29.624-4.052 4.052-7.266 8.723-9.688 13.875 3.092-33.537 17.473-66.222 43.157-91.905 29.198-29.2 67.384-43.737 105.562-43.656zM386.97 319.28c-.205.206-.39.422-.595.626-72.78 72.78-191.252 73.155-264.03.375-.278-.275-.54-.565-.814-.842-11.987 9.483-18.81 20.384-18.81 32 0 36.523 67.315 66.125 151.343 66.125 84.027 0 152.093-29.6 152.093-66.125 0-11.68-6.97-22.637-19.187-32.157zm39.717 54.564c-22.225 32.29-91.192 55.906-172.625 55.906-81.172 0-149.954-23.46-172.406-55.594-12.638 11.3-19.72 24.052-19.72 37.563.002 46.928 85.546 85.03 192.064 85.03 106.518 0 192.97-38.1 192.97-85.03 0-13.637-7.313-26.498-20.283-37.876z" fill="#000" fill-opacity="1"></path></g></svg> | ||||
| After Width: | Height: | Size: 1.5 KiB | 
							
								
								
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/library.db
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								aidedejeu_flutter/assets/library.db
									
										
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -1,111 +1,173 @@ | |||
| import 'dart:io'; | ||||
| 
 | ||||
| import 'package:flutter/material.dart'; | ||||
| import 'package:flutter/services.dart'; | ||||
| import 'package:flutter_markdown/flutter_markdown.dart'; | ||||
| import 'package:flutter_svg/flutter_svg.dart'; | ||||
| import 'package:path/path.dart'; | ||||
| import 'package:sqflite/sqflite.dart'; | ||||
| 
 | ||||
| void main() => runApp(MyApp()); | ||||
| 
 | ||||
| class Item { | ||||
|   String Id; | ||||
|   String Markdown; | ||||
| 
 | ||||
|   Item({this.Id, this.Markdown}); | ||||
| 
 | ||||
|   factory Item.fromMap(Map<String, dynamic> json) => new Item( | ||||
|     Id: json["Id"], | ||||
|     Markdown: json["Markdown"], | ||||
|   ); | ||||
| 
 | ||||
|   Map<String, dynamic> toMap() => { | ||||
|     "Id": Id, | ||||
|     "Markdown": Markdown, | ||||
|   }; | ||||
| } | ||||
| 
 | ||||
| Database _database; | ||||
| 
 | ||||
| Future<Database> get database async { | ||||
|   if (_database != null) return _database; | ||||
|   _database = await getDatabaseInstance(); | ||||
|   return _database; | ||||
| } | ||||
| 
 | ||||
| Future<Database> getDatabaseInstance() async { | ||||
|   var databasesPath = await getDatabasesPath(); | ||||
|   var path = join(databasesPath, "library.db"); | ||||
| 
 | ||||
|   var exists = await databaseExists(path); | ||||
|   if (!exists) { | ||||
|     print("Creating new copy from asset"); | ||||
| 
 | ||||
|     try { | ||||
|       await Directory(dirname(path)).create(recursive: true); | ||||
|     } catch (_) {} | ||||
| 
 | ||||
|     ByteData data = await rootBundle.load(join("assets", "library.db")); | ||||
|     List<int> bytes = | ||||
|     data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes); | ||||
| 
 | ||||
|     await File(path).writeAsBytes(bytes, flush: true); | ||||
|   } else { | ||||
|     print("Opening existing database"); | ||||
|   } | ||||
| 
 | ||||
|   return await openDatabase(path, readOnly: true); | ||||
| } | ||||
| 
 | ||||
| Future<Item> getItemWithId(String id) async { | ||||
|   print("getItemWithId " + id); | ||||
|   final db = await database; | ||||
|   var response = await db | ||||
|       .query("Items", where: "Id = ? OR RootId = ?", whereArgs: [id, id]); | ||||
|   if (response.isEmpty) { | ||||
|     print("Id not found"); | ||||
|   } | ||||
|   return response.isNotEmpty ? Item.fromMap(response.first) : null; | ||||
| } | ||||
| 
 | ||||
| class MyApp extends StatelessWidget { | ||||
|   // This widget is the root of your application. | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     return MaterialApp( | ||||
|       title: 'Flutter Demo', | ||||
|       theme: ThemeData( | ||||
|         // This is the theme of your application. | ||||
|         // | ||||
|         // Try running your application with "flutter run". You'll see the | ||||
|         // application has a blue toolbar. Then, without quitting the app, try | ||||
|         // changing the primarySwatch below to Colors.green and then invoke | ||||
|         // "hot reload" (press "r" in the console where you ran "flutter run", | ||||
|         // or simply save your changes to "hot reload" in a Flutter IDE). | ||||
|         // Notice that the counter didn't reset back to zero; the application | ||||
|         // is not restarted. | ||||
|         primarySwatch: Colors.blue, | ||||
|         primarySwatch: Colors.red, | ||||
|       ), | ||||
|       home: MyHomePage(title: 'Flutter Demo Home Page'), | ||||
|       home: MyHomePage(id: 'index.md'), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| class MyHomePage extends StatefulWidget { | ||||
|   MyHomePage({Key key, this.title}) : super(key: key); | ||||
|   MyHomePage({Key key, @required this.id}) : super(key: key); | ||||
| 
 | ||||
|   // This widget is the home page of your application. It is stateful, meaning | ||||
|   // that it has a State object (defined below) that contains fields that affect | ||||
|   // how it looks. | ||||
| 
 | ||||
|   // This class is the configuration for the state. It holds the values (in this | ||||
|   // case the title) provided by the parent (in this case the App widget) and | ||||
|   // used by the build method of the State. Fields in a Widget subclass are | ||||
|   // always marked "final". | ||||
| 
 | ||||
|   final String title; | ||||
|   final String id; | ||||
| 
 | ||||
|   @override | ||||
|   _MyHomePageState createState() => _MyHomePageState(); | ||||
|   _MyHomePageState createState() => _MyHomePageState(id: this.id); | ||||
| } | ||||
| 
 | ||||
| class _MyHomePageState extends State<MyHomePage> { | ||||
|   int _counter = 0; | ||||
|   _MyHomePageState({@required this.id}); | ||||
| 
 | ||||
|   void _incrementCounter() { | ||||
|   final String id; | ||||
| 
 | ||||
|   void setMarkdown(String md) { | ||||
|     setState(() { | ||||
|       // This call to setState tells the Flutter framework that something has | ||||
|       // changed in this State, which causes it to rerun the build method below | ||||
|       // so that the display can reflect the updated values. If we changed | ||||
|       // _counter without calling setState(), then the build method would not be | ||||
|       // called again, and so nothing would appear to happen. | ||||
|       _counter++; | ||||
|       markdown = md.replaceAllMapped(RegExp(r'<!--.*?-->'), (match) { | ||||
|         return ''; | ||||
|       }); | ||||
|     }); | ||||
|   } | ||||
| 
 | ||||
|   String markdown = ""; | ||||
|   MarkdownStyleSheet styleSheet; | ||||
| 
 | ||||
|   @override | ||||
|   void initState() { | ||||
|     super.initState(); | ||||
| 
 | ||||
|     ThemeData theme = ThemeData( | ||||
|       brightness: Brightness.light, | ||||
|       primaryColor: Colors.lightBlue[800], | ||||
|       accentColor: Colors.cyan[600], | ||||
|       fontFamily: 'LinuxLibertine', | ||||
|       textTheme: TextTheme( | ||||
|         headline: TextStyle(fontSize: 20.0, fontWeight: FontWeight.bold), | ||||
|         title: TextStyle(fontSize: 18.0, fontStyle: FontStyle.italic), | ||||
|         body1: TextStyle(fontSize: 14.0, fontFamily: 'Hind'), | ||||
|       ), | ||||
|     ); | ||||
| 
 | ||||
|     //styleSheet = MarkdownStyleSheet.fromTheme(theme); | ||||
|     styleSheet = MarkdownStyleSheet( | ||||
|         tableColumnWidth: IntrinsicColumnWidth(), | ||||
|         tableCellsPadding: EdgeInsets.all(0.2)); | ||||
| 
 | ||||
|     getItemWithId(this.id) | ||||
|         .then((item) => setMarkdown(item.Markdown)) | ||||
|         .catchError((error) => print(error)); | ||||
|   } | ||||
| 
 | ||||
|   final Widget svg = SvgPicture.asset("assets/crystal-ball.svg", | ||||
|     height: 20.0, | ||||
|     width: 20.0, | ||||
|     allowDrawingOutsideViewBox: true, | ||||
|   ); | ||||
|   @override | ||||
|   Widget build(BuildContext context) { | ||||
|     // This method is rerun every time setState is called, for instance as done | ||||
|     // by the _incrementCounter method above. | ||||
|     // | ||||
|     // The Flutter framework has been optimized to make rerunning build methods | ||||
|     // fast, so that you can just rebuild anything that needs updating rather | ||||
|     // than having to individually change instances of widgets. | ||||
| 
 | ||||
|     return Scaffold( | ||||
|       appBar: AppBar( | ||||
|         // Here we take the value from the MyHomePage object that was created by | ||||
|         // the App.build method, and use it to set our appbar title. | ||||
|         title: Text(widget.title), | ||||
|         title: Text(widget.id), | ||||
|       ), | ||||
|       body: Center( | ||||
|         // Center is a layout widget. It takes a single child and positions it | ||||
|         // in the middle of the parent. | ||||
|         child: Column( | ||||
|           // Column is also a layout widget. It takes a list of children and | ||||
|           // arranges them vertically. By default, it sizes itself to fit its | ||||
|           // children horizontally, and tries to be as tall as its parent. | ||||
|           // | ||||
|           // Invoke "debug painting" (press "p" in the console, choose the | ||||
|           // "Toggle Debug Paint" action from the Flutter Inspector in Android | ||||
|           // Studio, or the "Toggle Debug Paint" command in Visual Studio Code) | ||||
|           // to see the wireframe for each widget. | ||||
|           // | ||||
|           // Column has various properties to control how it sizes itself and | ||||
|           // how it positions its children. Here we use mainAxisAlignment to | ||||
|           // center the children vertically; the main axis here is the vertical | ||||
|           // axis because Columns are vertical (the cross axis would be | ||||
|           // horizontal). | ||||
|           mainAxisAlignment: MainAxisAlignment.center, | ||||
|           children: <Widget>[ | ||||
|             Text( | ||||
|               'You have pushed the button this many times:', | ||||
|       body: Markdown( | ||||
|           data: markdown, | ||||
|           styleSheet: styleSheet, | ||||
|           onTapLink: (link) => Navigator.push(context, | ||||
|               MaterialPageRoute(builder: (context) => MyHomePage(id: link)))), | ||||
|       bottomNavigationBar: BottomNavigationBar( | ||||
|         items: const <BottomNavigationBarItem>[ | ||||
|           BottomNavigationBarItem( | ||||
|             icon: Icon(Icons.home), | ||||
|             title: Text('Home'), | ||||
|           ), | ||||
|             Text( | ||||
|               '$_counter', | ||||
|               style: Theme.of(context).textTheme.display1, | ||||
|           BottomNavigationBarItem( | ||||
|             icon: Icon(Icons.business), | ||||
|             title: Text('Business'), | ||||
|           ), | ||||
|           BottomNavigationBarItem( | ||||
|             icon: Icon(Icons.business), | ||||
|             //icon: svg, | ||||
|             title: Text('School'), | ||||
|             //activeIcon: Icon(Icons.category, color: Color(0xFFEF5123)), | ||||
|           ), | ||||
|         ], | ||||
|       ), | ||||
|       ), | ||||
|       floatingActionButton: FloatingActionButton( | ||||
|         onPressed: _incrementCounter, | ||||
|         tooltip: 'Increment', | ||||
|         child: Icon(Icons.add), | ||||
|       ), // This trailing comma makes auto-formatting nicer for build methods. | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|  |  | |||
|  | @ -69,6 +69,20 @@ packages: | |||
|     description: flutter | ||||
|     source: sdk | ||||
|     version: "0.0.0" | ||||
|   flutter_markdown: | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
|       name: flutter_markdown | ||||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "0.3.3" | ||||
|   flutter_svg: | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
|       name: flutter_svg | ||||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "0.17.1" | ||||
|   flutter_test: | ||||
|     dependency: "direct dev" | ||||
|     description: flutter | ||||
|  | @ -81,6 +95,13 @@ packages: | |||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "2.1.4" | ||||
|   markdown: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: markdown | ||||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "2.1.3" | ||||
|   matcher: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|  | @ -96,12 +117,26 @@ packages: | |||
|     source: hosted | ||||
|     version: "1.1.8" | ||||
|   path: | ||||
|     dependency: transitive | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
|       name: path | ||||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "1.6.4" | ||||
|   path_drawing: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: path_drawing | ||||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "0.4.1" | ||||
|   path_parsing: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: path_parsing | ||||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "0.1.4" | ||||
|   pedantic: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|  | @ -135,6 +170,13 @@ packages: | |||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "1.5.5" | ||||
|   sqflite: | ||||
|     dependency: "direct main" | ||||
|     description: | ||||
|       name: sqflite | ||||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "1.2.0" | ||||
|   stack_trace: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|  | @ -156,6 +198,13 @@ packages: | |||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "1.0.5" | ||||
|   synchronized: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|       name: synchronized | ||||
|       url: "https://pub.dartlang.org" | ||||
|     source: hosted | ||||
|     version: "2.2.0" | ||||
|   term_glyph: | ||||
|     dependency: transitive | ||||
|     description: | ||||
|  | @ -192,4 +241,5 @@ packages: | |||
|     source: hosted | ||||
|     version: "3.5.0" | ||||
| sdks: | ||||
|   dart: ">=2.4.0 <3.0.0" | ||||
|   dart: ">=2.6.0 <3.0.0" | ||||
|   flutter: ">=1.10.7 <2.0.0" | ||||
|  |  | |||
|  | @ -19,7 +19,10 @@ environment: | |||
| dependencies: | ||||
|   flutter: | ||||
|     sdk: flutter | ||||
| 
 | ||||
|   flutter_markdown: ^0.3.3 | ||||
|   sqflite: | ||||
|   path: | ||||
|   flutter_svg: | ||||
|   # The following adds the Cupertino Icons font to your application. | ||||
|   # Use with the CupertinoIcons class for iOS style icons. | ||||
|   cupertino_icons: ^0.1.2 | ||||
|  | @ -41,7 +44,8 @@ flutter: | |||
|   uses-material-design: true | ||||
| 
 | ||||
|   # To add assets to your application, add an assets section, like this: | ||||
|   # assets: | ||||
|   assets: | ||||
|     - assets/ | ||||
|   #  - images/a_dot_burr.jpeg | ||||
|   #  - images/a_dot_ham.jpeg | ||||
| 
 | ||||
|  | @ -70,3 +74,19 @@ flutter: | |||
|   # | ||||
|   # For details regarding fonts from package dependencies, | ||||
|   # see https://flutter.dev/custom-fonts/#from-packages | ||||
|   fonts: | ||||
|     - family: Cinzel | ||||
|       fonts: | ||||
|         - asset: assets/Cinzel-Bold.otf | ||||
|           weight: 700 | ||||
|         - asset: assets/Cinzel-Regular.otf | ||||
|     - family: LinuxLibertine | ||||
|       fonts: | ||||
|         - asset: assets/LinLibertine_R.ttf | ||||
|         - asset: assets/LinLibertine_RB.ttf | ||||
|           weight: 700 | ||||
|         - asset: assets/LinLibertine_RBI.ttf | ||||
|           style: italic | ||||
|           weight: 700 | ||||
|         - asset: assets/LinLibertine_RI.ttf | ||||
|           style: italic | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez