mirror of
				https://github.com/Nioux/AideDeJeu.git
				synced 2025-10-31 15:36:07 +00:00 
			
		
		
		
	Début filtres
This commit is contained in:
		
							parent
							
								
									033f7ec94a
								
							
						
					
					
						commit
						c25cc83ec2
					
				
					 2 changed files with 69 additions and 22 deletions
				
			
		|  | @ -18,6 +18,7 @@ Future<Database> getDatabaseInstance() async { | |||
|   var path = join(databasesPath, "library.db"); | ||||
| 
 | ||||
|   var exists = await databaseExists(path); | ||||
|   exists = false; | ||||
|   if (!exists) { | ||||
|     print("Creating new copy from asset"); | ||||
| 
 | ||||
|  | @ -52,7 +53,7 @@ Future<Item> getItemWithId(String id) async { | |||
| } | ||||
| 
 | ||||
| Future<Item> loadChildrenItems(Item item) async { | ||||
|   print("getChildrenItems " + item.ItemType); | ||||
|   print("getChildrenItems " + (item?.ItemType ?? "")); | ||||
|   if (item.ItemType.endsWith("Items")) { | ||||
|     String itemType = | ||||
|     item.ItemType.substring(0, item.ItemType.length - 1); | ||||
|  |  | |||
|  | @ -84,33 +84,29 @@ class _MyHomePageState extends State<MyHomePage> { | |||
|       styleSheet: styleSheet, | ||||
|       onTapLink: (link) => Navigator.push( | ||||
|         context, | ||||
|         MaterialPageRoute( | ||||
|             builder: (context) => MyHomePage(id: link) | ||||
|         ), | ||||
|         MaterialPageRoute(builder: (context) => MyHomePage(id: link)), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   Widget buildMarkdownBody(BuildContext context) { | ||||
|     return MarkdownBody( | ||||
|       data: markdown, | ||||
|       styleSheet: styleSheet, | ||||
|       onTapLink: (link) => Navigator.push( | ||||
|         context, | ||||
|         MaterialPageRoute( | ||||
|             builder: (context) => MyHomePage(id: link) | ||||
|         ), | ||||
|         MaterialPageRoute(builder: (context) => MyHomePage(id: link)), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| 
 | ||||
|   Widget buildChildTile(BuildContext context, Item item) { | ||||
|     return ListTile( | ||||
|       title: Text(item.Name), | ||||
|       subtitle: Text(item.AliasText ?? ""), | ||||
|       onTap: () => Navigator.push( | ||||
|         context, | ||||
|         MaterialPageRoute( | ||||
|             builder: (context) => MyHomePage(id: item.Id) | ||||
|         ), | ||||
|         MaterialPageRoute(builder: (context) => MyHomePage(id: item.Id)), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
|  | @ -121,8 +117,8 @@ class _MyHomePageState extends State<MyHomePage> { | |||
|         ListView.builder( | ||||
|             itemCount: (item?.Children?.length ?? 0) + 1, | ||||
|             itemBuilder: (BuildContext context, int index) { | ||||
|             return index == 0 ? | ||||
|             buildMarkdownBody(context) | ||||
|               return index == 0 | ||||
|                   ? buildMarkdownBody(context) | ||||
|                   : buildChildTile(context, item.Children[index - 1]); | ||||
|             }) | ||||
|       ], | ||||
|  | @ -137,7 +133,8 @@ class _MyHomePageState extends State<MyHomePage> { | |||
|     return Text("Search"); | ||||
|   } | ||||
| 
 | ||||
|   BottomNavigationBarItem buildBottomNavigationBarItem(String title, String assetName) { | ||||
|   BottomNavigationBarItem buildBottomNavigationBarItem( | ||||
|       String title, String assetName) { | ||||
|     return BottomNavigationBarItem( | ||||
|       icon: SvgPicture.asset( | ||||
|         assetName, | ||||
|  | @ -156,8 +153,7 @@ class _MyHomePageState extends State<MyHomePage> { | |||
|   } | ||||
| 
 | ||||
|   List buildBottomNavigationBarItems() { | ||||
|     return | ||||
|     <BottomNavigationBarItem>[ | ||||
|     return <BottomNavigationBarItem>[ | ||||
|       buildBottomNavigationBarItem("Bibliothèque", "assets/spell-book.svg"), | ||||
|       buildBottomNavigationBarItem("Favoris", "assets/stars-stack.svg"), | ||||
|       buildBottomNavigationBarItem("Recherche", "assets/crystal-ball.svg"), | ||||
|  | @ -180,6 +176,7 @@ class _MyHomePageState extends State<MyHomePage> { | |||
|         currentPage = buildSearchPage(); | ||||
|         break; | ||||
|     } | ||||
| 
 | ||||
|     return Scaffold( | ||||
|       appBar: AppBar( | ||||
|         title: Text(widget.id), | ||||
|  | @ -190,11 +187,60 @@ class _MyHomePageState extends State<MyHomePage> { | |||
|         onTap: (int index) { | ||||
|           setState(() { | ||||
|             this.indexPage = index; | ||||
|           } | ||||
|           ); | ||||
|           }); | ||||
|         }, | ||||
|         items: buildBottomNavigationBarItems(), | ||||
|       ), | ||||
|       endDrawer: Drawer( | ||||
|         child: ListView( | ||||
|           // Important: Remove any padding from the ListView. | ||||
|           padding: EdgeInsets.zero, | ||||
|           children: <Widget>[ | ||||
|             DrawerHeader( | ||||
|               child: Text('Drawer Header'), | ||||
|               decoration: BoxDecoration( | ||||
|                 color: Colors.blue, | ||||
|               ), | ||||
|             ), | ||||
|             ListTile( | ||||
|               title: Text('Item 1'), | ||||
|               onTap: () { | ||||
|                 // Update the state of the app. | ||||
|                 // ... | ||||
|               }, | ||||
|             ), | ||||
|             ListTile( | ||||
|               title: Text('Item 2'), | ||||
|               onTap: () { | ||||
|                 // Update the state of the app. | ||||
|                 // ... | ||||
|               }, | ||||
|             ), | ||||
|             Container( | ||||
|               child: Wrap( | ||||
|                 children: <Widget>[ | ||||
|                   FilterChip( | ||||
|                     label: Text("truc"), | ||||
|                     backgroundColor: Colors.transparent, | ||||
|                     shape: StadiumBorder(side: BorderSide()), | ||||
|                     onSelected: (bool value) { | ||||
|                       print("selected"); | ||||
|                     }, | ||||
|                   ), | ||||
|                   FilterChip( | ||||
|                     label: Text("truc"), | ||||
|                     backgroundColor: Colors.transparent, | ||||
|                     shape: StadiumBorder(side: BorderSide()), | ||||
|                     onSelected: (bool value) { | ||||
|                       print("selected"); | ||||
|                     }, | ||||
|                   ), | ||||
|                 ], | ||||
|               ), | ||||
|             ), | ||||
|           ], | ||||
|         ), | ||||
|       ), | ||||
|     ); | ||||
|   } | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Yan Maniez
						Yan Maniez