| 
									
										
										
										
											2022-10-23 15:50:44 +02:00
										 |  |  | import 'package:flutter/material.dart'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class DrawerItem extends StatelessWidget { | 
					
						
							|  |  |  |   const DrawerItem( | 
					
						
							| 
									
										
										
										
											2022-10-23 17:57:59 +02:00
										 |  |  |       {Key? key, | 
					
						
							|  |  |  |       required this.dta, | 
					
						
							|  |  |  |       this.endText, | 
					
						
							|  |  |  |       required this.collapsed, | 
					
						
							|  |  |  |       required this.active, | 
					
						
							|  |  |  |       required this.onTap}) | 
					
						
							| 
									
										
										
										
											2022-10-23 15:50:44 +02:00
										 |  |  |       : super(key: key); | 
					
						
							|  |  |  |   final ItemData dta; | 
					
						
							|  |  |  |   final String? endText; | 
					
						
							|  |  |  |   final bool collapsed; | 
					
						
							|  |  |  |   final bool active; | 
					
						
							|  |  |  |   final void Function() onTap; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   Widget build(BuildContext context) { | 
					
						
							|  |  |  |     return InkWell( | 
					
						
							|  |  |  |       onTap: onTap, | 
					
						
							|  |  |  |       child: Padding( | 
					
						
							| 
									
										
										
										
											2022-11-03 00:39:29 +01:00
										 |  |  |         padding: const EdgeInsets.only(left: 9, top: 2, bottom: 2, right: 9), | 
					
						
							| 
									
										
										
										
											2022-10-23 15:50:44 +02:00
										 |  |  |         child: ClipRRect( | 
					
						
							|  |  |  |           borderRadius: BorderRadius.circular(10), | 
					
						
							|  |  |  |           child: Container( | 
					
						
							| 
									
										
										
										
											2022-11-03 00:39:29 +01:00
										 |  |  |             color: active ? const Color(0xff4d4d4d) : Colors.transparent, | 
					
						
							| 
									
										
										
										
											2022-10-23 15:50:44 +02:00
										 |  |  |             child: Padding( | 
					
						
							| 
									
										
										
										
											2022-10-23 17:57:59 +02:00
										 |  |  |               padding: | 
					
						
							| 
									
										
										
										
											2022-11-03 00:39:29 +01:00
										 |  |  |                   const EdgeInsets.only(left: 9, top: 13, bottom: 13, right: 9), | 
					
						
							| 
									
										
										
										
											2022-10-23 15:50:44 +02:00
										 |  |  |               child: Row( | 
					
						
							|  |  |  |                 children: [ | 
					
						
							|  |  |  |                   Icon( | 
					
						
							|  |  |  |                     dta.icon, | 
					
						
							| 
									
										
										
										
											2022-11-03 00:39:29 +01:00
										 |  |  |                     size: 23, | 
					
						
							|  |  |  |                     color: const Color(0xffe5e5e5), | 
					
						
							| 
									
										
										
										
											2022-10-23 15:50:44 +02:00
										 |  |  |                   ), | 
					
						
							|  |  |  |                   if (!collapsed) ...[ | 
					
						
							|  |  |  |                     const SizedBox( | 
					
						
							| 
									
										
										
										
											2022-11-03 00:39:29 +01:00
										 |  |  |                       width: 17, | 
					
						
							| 
									
										
										
										
											2022-10-23 15:50:44 +02:00
										 |  |  |                     ), | 
					
						
							|  |  |  |                     Text( | 
					
						
							|  |  |  |                       dta.name, | 
					
						
							| 
									
										
										
										
											2022-11-03 00:39:29 +01:00
										 |  |  |                       style: const TextStyle( | 
					
						
							|  |  |  |                           color: Color(0xffe5e5e5), fontSize: 16), | 
					
						
							| 
									
										
										
										
											2022-10-23 15:50:44 +02:00
										 |  |  |                     ), | 
					
						
							|  |  |  |                     Expanded(child: Container()), | 
					
						
							|  |  |  |                     Text( | 
					
						
							| 
									
										
										
										
											2022-10-23 17:57:59 +02:00
										 |  |  |                       endText ?? '', | 
					
						
							|  |  |  |                       style: const TextStyle(color: Color(0xffafafaf)), | 
					
						
							| 
									
										
										
										
											2022-10-23 15:50:44 +02:00
										 |  |  |                     ), | 
					
						
							|  |  |  |                     const SizedBox( | 
					
						
							|  |  |  |                       width: 15, | 
					
						
							|  |  |  |                     ) | 
					
						
							|  |  |  |                   ] | 
					
						
							|  |  |  |                 ], | 
					
						
							|  |  |  |               ), | 
					
						
							|  |  |  |             ), | 
					
						
							|  |  |  |           ), | 
					
						
							|  |  |  |         ), | 
					
						
							|  |  |  |       ), | 
					
						
							|  |  |  |     ); | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | class ItemData { | 
					
						
							|  |  |  |   String name; | 
					
						
							|  |  |  |   IconData icon; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   ItemData(this.name, this.icon); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   @override | 
					
						
							|  |  |  |   String toString() { | 
					
						
							|  |  |  |     return 'ItemData{name: $name, icon: $icon}'; | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-10-23 17:57:59 +02:00
										 |  |  | } |