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.
HMG_Patient_App_New/lib/widgets/appbar/app_bar_widget.dart

61 lines
1.7 KiB
Dart

2 months ago
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
GestureDetector(
onTap: onBackPressed,
child: Utils.buildSvgWithAssets(
icon: AppAssets.arrow_back,
width: 32,
height: 32,
),
),
// Logo
Utils.buildSvgWithAssets(
icon: AppAssets.habiblogo,
),
// Language Selector
LanguageSelector(
currentLanguage: context.locale.languageCode,
showOnlyIcon: false,
onLanguageChanged: onLanguageChanged,
languages: [
{'code': 'ar', 'name': LocaleKeys.arabic.tr()},
{'code': 'en', 'name': LocaleKeys.english.tr()}
],
),
],
),
centerTitle: true,
);
}
}