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.
uco-mobile-poc/lib/app/custom_widgets/custom_app_bar.dart

127 lines
4.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import '../core/constants/app_assets.dart';
import '../res/app_colors.dart';
class DashBoardAppBar extends StatelessWidget implements PreferredSizeWidget {
final String? title;
final Color titleColor;
final Color backgroundColor;
final VoidCallback onBackButtonPressed;
final List<Widget>? actions;
const DashBoardAppBar({
Key? key,
this.title = "",
this.titleColor = Colors.white,
this.backgroundColor = AppColors.colorPrimary,
required this.onBackButtonPressed,
this.actions,
}) : super(key: key);
@override
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
@override
Widget build(BuildContext context) {
return AppBar(
backgroundColor: backgroundColor,
elevation: 0.0,
leadingWidth: 100,
leading: Container(
margin: const EdgeInsets.all(10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: Colors.transparent,
),
child: InkWell(
borderRadius: const BorderRadius.all(Radius.circular(50)),
splashColor: Colors.transparent,
onTap: onBackButtonPressed,
child: Padding(
padding: const EdgeInsets.all(7.0),
child: Transform(
alignment: Alignment.center,
transform: Matrix4.rotationY(
Directionality.of(context) == TextDirection.rtl ? 280 : 0),
child: SvgPicture.asset(
AppAssets.lg_back_arrow,
fit: BoxFit.cover,
)),
),
),
),
title: Text(
title ?? "",
style: Theme.of(context)
.textTheme
.displayMedium
?.copyWith(color: AppColors.white, fontSize: 20),
),
actions: actions,
);
// return ColoredBox(
// color: backgroundColor,
// child: Stack(
// children: [
// Align(
// alignment: Directionality.of(context) == TextDirection.rtl
// ? Alignment.centerRight
// : Alignment.centerLeft,
// child: Container(
// margin: const EdgeInsets.all(10),
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(50),
// color: Colors.transparent,
// ),
// width: 66.0,
// height: 32.0,
// child: Material(
// color: Colors.transparent,
// child: InkWell(
// borderRadius: const BorderRadius.all(Radius.circular(50)),
// splashColor: Colors.transparent,
// onTap: onBackButtonPressed,
// child: Padding(
// padding: const EdgeInsets.all(7.0),
// child: Transform(
// alignment: Alignment.center,
// transform: Matrix4.rotationY(
// Directionality.of(context) == TextDirection.rtl ? 280 : 0),
// child: SvgPicture.asset(
// AppAssets.ic_back_arrow_appbar,
// fit: BoxFit.cover,
// )),
// ),
// ),
// ),
// ),
// ),
// Center(
// child: Text(
// title ?? "",
// style: Theme.of(context)
// .textTheme
// .displayMedium
// ?.copyWith(color: AppColors.white, fontSize: 20),
// ),
// ),
// Align(
// alignment: Directionality.of(context) == TextDirection.rtl
// ? Alignment.centerLeft
// : Alignment.centerRight, // Align to the right
// child: Center(
// child: Row(
// mainAxisAlignment: MainAxisAlignment.end,
// children: [...actions ?? []],
// ),
// ),
// ),
// ],
// ),
// );
}
}