You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							116 lines
						
					
					
						
							3.5 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							116 lines
						
					
					
						
							3.5 KiB
						
					
					
				| import 'package:flutter/material.dart'; | |
| import 'package:flutter_bloc/flutter_bloc.dart'; | |
| import 'package:hadi_hoda_flutter/common_ui/resources/my_assets.dart'; | |
| import 'package:hadi_hoda_flutter/common_ui/resources/my_spaces.dart'; | |
| import 'package:hadi_hoda_flutter/core/utils/my_localization.dart'; | |
| import 'package:hadi_hoda_flutter/core/utils/screen_size.dart'; | |
| import 'package:hadi_hoda_flutter/core/utils/set_platform_size.dart'; | |
| import 'package:hadi_hoda_flutter/core/widgets/button/my_yellow_button.dart'; | |
| import 'package:hadi_hoda_flutter/core/widgets/images/my_image.dart'; | |
| import 'package:hadi_hoda_flutter/core/widgets/inkwell/my_inkwell.dart'; | |
| import 'package:hadi_hoda_flutter/features/home/presentation/bloc/home_bloc.dart'; | |
| 
 | |
| class HomePage extends StatelessWidget { | |
|   const HomePage({super.key}); | |
| 
 | |
|   @override | |
|   Widget build(BuildContext context) { | |
|     return Scaffold( | |
|       body: PopScope( | |
|         canPop: false, | |
|         onPopInvokedWithResult: context | |
|             .read<HomeBloc>() | |
|             .onPopInvokedWithResult, | |
|         child: DecoratedBox( | |
|           decoration: BoxDecoration( | |
|             image: DecorationImage( | |
|               image: AssetImage(MyAssets.backgroundHome), | |
|               fit: BoxFit.cover, | |
|             ), | |
|           ), | |
|           child: SizedBox.expand( | |
|             child: Stack( | |
|               alignment: Alignment.center, | |
|               children: [ | |
|                 _music(context), | |
|                 _image(context), | |
|                 _bottomBtns(context), | |
|               ], | |
|             ), | |
|           ), | |
|         ), | |
|       ), | |
|     ); | |
|   } | |
| 
 | |
|   Widget _music(BuildContext context) { | |
|     return PositionedDirectional( | |
|       top: MySpaces.s36, | |
|       end: MySpaces.s16, | |
|       child: StreamBuilder<double>( | |
|         initialData: 1, | |
|         stream: context.read<HomeBloc>().volumeStream, | |
|         builder: (context, snapshot) => MyInkwell( | |
|           onTap: () => context.read<HomeBloc>().changeMute(), | |
|           child: MyImage( | |
|             image: snapshot.data == 0 ? MyAssets.musicOff : MyAssets.musicOn, | |
|             size: setSize(context: context, tablet: 100), | |
|           ), | |
|         ), | |
|       ), | |
|     ); | |
|   } | |
| 
 | |
| 
 | |
|   Positioned _image(BuildContext context) { | |
|     return Positioned( | |
|       top: setSize(context: context, mobile: 0.1.h, tablet: 0.15.h), | |
|       child: Stack( | |
|         children: [ | |
|           MyImage( | |
|             image: MyAssets.hadiHoda, | |
|           ), | |
|           PositionedDirectional( | |
|             start: MySpaces.s10, | |
|             top: MySpaces.s40, | |
|             child: MyImage( | |
|               image: MyAssets.globe, | |
|             ), | |
|           ), | |
|         ], | |
|       ), | |
|     ); | |
|   } | |
| 
 | |
|   Positioned _bottomBtns(BuildContext context) { | |
|     return Positioned( | |
|       bottom: MySpaces.s40, | |
|       left: MySpaces.s16, | |
|       right: MySpaces.s16, | |
|       child: Row( | |
|         crossAxisAlignment: CrossAxisAlignment.end, | |
|         mainAxisAlignment: MainAxisAlignment.spaceBetween, | |
|         children: [ | |
|           MyInkwell( | |
|             onTap: () => context.read<HomeBloc>().goToLanguagePage(context), | |
|             child: MyImage( | |
|               image: MyAssets.language, | |
|               size: setSize(context: context, tablet: 100), | |
|             ), | |
|           ), | |
|           MyYellowButton( | |
|             onTap: () => context.read<HomeBloc>().goToLevelPage(context), | |
|             title: context.translate.start, | |
|           ), | |
|           MyInkwell( | |
|             onTap: () => context.read<HomeBloc>().showAboutUs(context), | |
|             child: MyImage( | |
|               image: MyAssets.theme, | |
|               size: setSize(context: context, tablet: 100), | |
|             ), | |
|           ), | |
|         ], | |
|       ), | |
|     ); | |
|   } | |
| }
 |