feat : new app bar
This commit is contained in:
@@ -11,7 +11,7 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
final TextStyle? titleTextStyle;
|
final TextStyle? titleTextStyle;
|
||||||
final VoidCallback? onBackPressed;
|
final VoidCallback? onBackPressed;
|
||||||
final List<Widget>? additionalActions;
|
final List<Widget>? additionalActions;
|
||||||
final int? leadingWidth;
|
final double? leadingWidth;
|
||||||
final Widget? leading;
|
final Widget? leading;
|
||||||
final PreferredSizeWidget? bottom;
|
final PreferredSizeWidget? bottom;
|
||||||
|
|
||||||
@@ -80,3 +80,78 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
@override
|
@override
|
||||||
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class RAppBar2 extends StatelessWidget implements PreferredSizeWidget {
|
||||||
|
final String? title;
|
||||||
|
final String? iconTitle;
|
||||||
|
final Color backgroundColor;
|
||||||
|
final Color iconColor;
|
||||||
|
final bool hasBack;
|
||||||
|
final bool centerTitle;
|
||||||
|
final TextStyle? titleTextStyle;
|
||||||
|
final VoidCallback? onBackPressed;
|
||||||
|
final List<Widget>? additionalActions;
|
||||||
|
final double? leadingWidth;
|
||||||
|
final Widget? leading;
|
||||||
|
final PreferredSizeWidget? bottom;
|
||||||
|
|
||||||
|
const RAppBar2({
|
||||||
|
super.key,
|
||||||
|
this.title,
|
||||||
|
this.iconTitle,
|
||||||
|
this.backgroundColor = AppColor.blueNormal,
|
||||||
|
this.iconColor = Colors.white,
|
||||||
|
this.titleTextStyle,
|
||||||
|
this.onBackPressed,
|
||||||
|
this.additionalActions,
|
||||||
|
this.leading,
|
||||||
|
this.hasBack = true,
|
||||||
|
this.centerTitle = false,
|
||||||
|
this.leadingWidth,
|
||||||
|
this.bottom,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return AppBar(
|
||||||
|
automaticallyImplyLeading: false,
|
||||||
|
backgroundColor: backgroundColor,
|
||||||
|
elevation: 0,
|
||||||
|
excludeHeaderSemantics: true,
|
||||||
|
scrolledUnderElevation: 0,
|
||||||
|
centerTitle: centerTitle,
|
||||||
|
titleTextStyle: titleTextStyle ?? AppFonts.yekan16.copyWith(color: Colors.white),
|
||||||
|
title: Row(
|
||||||
|
children: [
|
||||||
|
if (leading != null) ...{
|
||||||
|
Padding(padding: const EdgeInsets.only(right: 6), child: leading),
|
||||||
|
},
|
||||||
|
if (title != null) ...[Text(title!), if (iconTitle != null) const SizedBox(width: 8)],
|
||||||
|
if (iconTitle != null) ...{const SizedBox(width: 8)},
|
||||||
|
if (iconTitle != null) ...{SvgGenImage.vec(iconTitle!).svg(width: 24, height: 24)},
|
||||||
|
],
|
||||||
|
),
|
||||||
|
titleSpacing: 8,
|
||||||
|
actions: [
|
||||||
|
if (additionalActions != null) ...additionalActions!,
|
||||||
|
if (hasBack) ...{
|
||||||
|
GestureDetector(
|
||||||
|
onTap: onBackPressed ?? () => Get.back(),
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.fromLTRB(10, 0, 2, 0),
|
||||||
|
child: Assets.vec.arrowLeftSvg.svg(
|
||||||
|
width: 24.w,
|
||||||
|
height: 24.h,
|
||||||
|
colorFilter: ColorFilter.mode(iconColor ?? Colors.white, BlendMode.srcIn),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
|
bottom: bottom,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Size get preferredSize => const Size.fromHeight(kToolbarHeight);
|
||||||
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
import 'package:rasadyar_livestock/presentation/widgets/base_page/logic.dart';
|
import 'package:rasadyar_livestock/presentation/widgets/base_page/logic.dart';
|
||||||
|
|
||||||
RAppBar liveStockAppBar({
|
RAppBar2 liveStockAppBar({
|
||||||
bool hasBack = true,
|
bool hasBack = true,
|
||||||
bool hasFilter = true,
|
bool hasFilter = true,
|
||||||
bool hasSearch = true,
|
bool hasSearch = true,
|
||||||
@@ -10,16 +10,17 @@ RAppBar liveStockAppBar({
|
|||||||
VoidCallback? onBackPressed,
|
VoidCallback? onBackPressed,
|
||||||
GestureTapCallback? onFilterTap,
|
GestureTapCallback? onFilterTap,
|
||||||
GestureTapCallback? onSearchTap,
|
GestureTapCallback? onSearchTap,
|
||||||
|
String? title,
|
||||||
}) {
|
}) {
|
||||||
return RAppBar(
|
return RAppBar2(
|
||||||
hasBack: isBase == true ? false : hasBack,
|
hasBack: isBase == true ? false : hasBack,
|
||||||
onBackPressed: onBackPressed,
|
onBackPressed: onBackPressed,
|
||||||
leadingWidth: 155,
|
leadingWidth: 180.w,
|
||||||
leading: Row(
|
leading: Row(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
spacing: 6,
|
spacing: 6,
|
||||||
children: [
|
children: [
|
||||||
Text('رصددام', style: AppFonts.yekan16Bold.copyWith(color: Colors.white)),
|
Text(title ?? 'رصددام', style: AppFonts.yekan16Bold.copyWith(color: Colors.white)),
|
||||||
Assets.vec.appBarInspectionSvg.svg(width: 24, height: 24),
|
Assets.vec.appBarInspectionSvg.svg(width: 24, height: 24),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user