You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			71 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			71 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Dart
		
	
| import 'package:easy_localization/easy_localization.dart';
 | |
| import 'package:flutter/material.dart';
 | |
| import 'package:hmg_patient_app_new/core/app_assets.dart';
 | |
| import 'package:hmg_patient_app_new/core/utils/utils.dart';
 | |
| import 'package:hmg_patient_app_new/widgets/language_switcher.dart';
 | |
| 
 | |
| import '../../generated/locale_keys.g.dart';
 | |
| 
 | |
| class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
 | |
|   final VoidCallback onBackPressed;
 | |
|   final ValueChanged<String> onLanguageChanged;
 | |
| 
 | |
|   const CustomAppBar({
 | |
|     Key? key,
 | |
|     required this.onBackPressed,
 | |
|     required this.onLanguageChanged,
 | |
|   }) : super(key: key);
 | |
| 
 | |
|   @override
 | |
|   Size get preferredSize => const Size.fromHeight(kToolbarHeight);
 | |
| 
 | |
|   @override
 | |
|   Widget build(BuildContext context) {
 | |
|     return AppBar(
 | |
|       backgroundColor: Colors.transparent,
 | |
|       leading: null,
 | |
|       title: Row(
 | |
|         mainAxisAlignment: MainAxisAlignment.spaceBetween,
 | |
|         children: [
 | |
|           // Arrow Back with click handler
 | |
|           Expanded(
 | |
|             child: Align(
 | |
|               alignment: Alignment.centerLeft,
 | |
|               child: GestureDetector(
 | |
|                 onTap: onBackPressed,
 | |
|                 child: Utils.buildSvgWithAssets(
 | |
|                   icon: AppAssets.arrow_back,
 | |
|                   width: 32,
 | |
|                   height: 32,
 | |
|                 ),
 | |
|               ),
 | |
|             ),
 | |
|           ),
 | |
| 
 | |
|           // Logo
 | |
|           Utils.buildSvgWithAssets(
 | |
|             icon: AppAssets.habiblogo,
 | |
|           ),
 | |
| 
 | |
|           // Language Selector
 | |
|           Expanded(
 | |
|             child: Align(
 | |
|               alignment: Alignment.centerRight,
 | |
|               child: LanguageSelector(
 | |
|                 currentLanguage: context.locale.languageCode,
 | |
|                 showOnlyIcon: false,
 | |
|                 onLanguageChanged: onLanguageChanged,
 | |
|                 languages: [
 | |
|                   {'code': 'ar', 'name': LocaleKeys.arabic.tr()},
 | |
|                   {'code': 'en', 'name': LocaleKeys.english.tr()}
 | |
|                 ],
 | |
|               ),
 | |
|             ),
 | |
|           ),
 | |
|         ],
 | |
|       ),
 | |
|       centerTitle: true,
 | |
|     );
 | |
|   }
 | |
| }
 |