refactor : base page
This commit is contained in:
@@ -13,10 +13,7 @@ class BasePage extends GetView<BaseLogic> {
|
||||
this.floatingActionButton,
|
||||
this.appBar,
|
||||
this.backGroundWidget,
|
||||
}) : assert(
|
||||
(routes != null) || routesWidget != null,
|
||||
'Either routes or routesWidget must be provided.',
|
||||
);
|
||||
}) ;
|
||||
|
||||
final List<String>? routes;
|
||||
final Breadcrumb? routesWidget;
|
||||
|
||||
@@ -2,7 +2,11 @@ import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/presentation/common/assets.gen.dart';
|
||||
|
||||
class BackGroundWidget extends StatelessWidget {
|
||||
const BackGroundWidget({super.key, required this.gradient, required this.vecPath});
|
||||
const BackGroundWidget({
|
||||
super.key,
|
||||
required this.gradient,
|
||||
required this.vecPath,
|
||||
});
|
||||
|
||||
final Gradient gradient;
|
||||
final String vecPath;
|
||||
@@ -16,21 +20,4 @@ class BackGroundWidget extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
/*Container chickenBackground() {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient:
|
||||
gradient ??
|
||||
LinearGradient(
|
||||
begin: Alignment(1.00, 0.01),
|
||||
end: Alignment(0.04, 0.99),
|
||||
colors: [
|
||||
const Color(0xFFD6DCEF).withValues(alpha: .8),
|
||||
const Color(0xFFD6E6E9).withValues(alpha: .8),
|
||||
const Color(0xFFD6E4E3).withValues(alpha: .8),
|
||||
],
|
||||
),
|
||||
),
|
||||
child: Assets.vec.chickenPatternSvg.svg(fit: BoxFit.cover),
|
||||
);
|
||||
}*/
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
|
||||
class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
final List<Widget>? children;
|
||||
|
||||
@@ -19,8 +18,10 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
final bool hasSearch;
|
||||
final VoidCallback? onSearchTap;
|
||||
|
||||
final bool hasNotification;
|
||||
final bool hasFilter;
|
||||
final VoidCallback? onFilterTap;
|
||||
|
||||
final bool hasNotification;
|
||||
final VoidCallback? onNotificationTap;
|
||||
|
||||
final bool hasNews;
|
||||
@@ -36,7 +37,8 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
this.hasBack = true,
|
||||
this.hasSearch = false,
|
||||
this.hasNews = false,
|
||||
this.hasNotification= false,
|
||||
this.hasNotification = false,
|
||||
this.hasFilter = false,
|
||||
this.isBase = false,
|
||||
this.centerTitle = false,
|
||||
this.bottom,
|
||||
@@ -45,6 +47,7 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
this.onSearchTap,
|
||||
this.onNewsTap,
|
||||
this.onNotificationTap,
|
||||
this.onFilterTap,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -62,10 +65,8 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
children: [
|
||||
if (children != null) ...children!,
|
||||
|
||||
if (hasNews || hasBack || hasSearch || hasNotification) const Spacer(),
|
||||
|
||||
if (hasSearch) SearchWidget(),
|
||||
if (hasSearch) SizedBox(width: 8.w),
|
||||
if (hasNews || hasBack || hasSearch || hasNotification || hasFilter)
|
||||
const Spacer(),
|
||||
|
||||
if (hasNews)
|
||||
GestureDetector(
|
||||
@@ -78,9 +79,26 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
if (hasNews) SizedBox(width: 8.w),
|
||||
|
||||
if (hasNotification)
|
||||
Badge.count(count: 2, child: Icon(CupertinoIcons.bell_fill, color: Colors.white)),
|
||||
Badge.count(
|
||||
count: 2,
|
||||
child: Icon(CupertinoIcons.bell_fill, color: Colors.white),
|
||||
),
|
||||
if (hasNotification) SizedBox(width: 8.w),
|
||||
|
||||
if (hasFilter)
|
||||
GestureDetector(
|
||||
onTap: onFilterTap,
|
||||
child: Assets.vec.filterSvg.svg(
|
||||
width: 24.w,
|
||||
height: 24.h,
|
||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
if (hasBack) SizedBox(width: 8.w),
|
||||
|
||||
if (hasSearch) SearchWidget(),
|
||||
if (hasSearch) SizedBox(width: 8.w),
|
||||
|
||||
if (hasBack)
|
||||
GestureDetector(
|
||||
onTap: onBackTap ?? () => Get.back(id: backId),
|
||||
@@ -102,7 +120,8 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
}
|
||||
|
||||
@override
|
||||
Size get preferredSize => Size.fromHeight(kToolbarHeight + (bottom?.preferredSize.height ?? 0));
|
||||
Size get preferredSize =>
|
||||
Size.fromHeight(kToolbarHeight + (bottom?.preferredSize.height ?? 0));
|
||||
|
||||
MainAxisAlignment _getMainAxisAlignment() {
|
||||
if (centerTitle) {
|
||||
@@ -154,15 +173,21 @@ class RAppBar2 extends StatelessWidget implements PreferredSizeWidget {
|
||||
excludeHeaderSemantics: true,
|
||||
scrolledUnderElevation: 0,
|
||||
centerTitle: centerTitle,
|
||||
titleTextStyle: titleTextStyle ?? AppFonts.yekan16.copyWith(color: Colors.white),
|
||||
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 (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)},
|
||||
if (iconTitle != null) ...{
|
||||
SvgGenImage.vec(iconTitle!).svg(width: 24, height: 24),
|
||||
},
|
||||
],
|
||||
),
|
||||
titleSpacing: 8,
|
||||
@@ -176,7 +201,10 @@ class RAppBar2 extends StatelessWidget implements PreferredSizeWidget {
|
||||
child: Assets.vec.arrowLeftSvg.svg(
|
||||
width: 24.w,
|
||||
height: 24.h,
|
||||
colorFilter: ColorFilter.mode(iconColor ?? Colors.white, BlendMode.srcIn),
|
||||
colorFilter: ColorFilter.mode(
|
||||
iconColor ?? Colors.white,
|
||||
BlendMode.srcIn,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user