refactor : base page

This commit is contained in:
2025-09-24 21:42:22 +03:30
parent 19802e913c
commit fd9de4f80c
43 changed files with 400 additions and 268 deletions

View File

@@ -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;

View File

@@ -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),
);
}*/

View File

@@ -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,
),
),
),
),

View File

@@ -133,10 +133,10 @@ packages:
dependency: transitive
description:
name: built_value
sha256: ba95c961bafcd8686d1cf63be864eb59447e795e124d98d6a27d91fcd13602fb
sha256: a30f0a0e38671e89a492c44d005b5545b830a961575bbd8336d42869ff71066d
url: "https://pub.dev"
source: hosted
version: "8.11.1"
version: "8.12.0"
cached_network_image:
dependency: "direct main"
description:
@@ -197,10 +197,10 @@ packages:
dependency: transitive
description:
name: code_builder
sha256: "0ec10bf4a89e4c613960bf1e8b42c64127021740fb21640c29c909826a5eea3e"
sha256: "11654819532ba94c34de52ff5feb52bd81cba1de00ef2ed622fd50295f9d4243"
url: "https://pub.dev"
source: hosted
version: "4.10.1"
version: "4.11.0"
collection:
dependency: "direct main"
description:
@@ -450,18 +450,18 @@ packages:
dependency: transitive
description:
name: flutter_gen_core
sha256: eda54fdc5de08e7eeea663eb8442aafc8660b5a13fda4e0c9e572c64e50195fb
sha256: b6bafbbd981da2f964eb45bcb8b8a7676a281084f8922c0c75de4cfbaa849311
url: "https://pub.dev"
source: hosted
version: "5.11.0"
version: "5.12.0"
flutter_gen_runner:
dependency: "direct main"
description:
name: flutter_gen_runner
sha256: "669bf8b7a9b4acbdcb7fcc5e12bf638aca19acedf43341714cbca3bf3a219521"
sha256: c99b10af9d404e3f46fd1927e7d90099779e935e86022674c4c2a9e6c2a93b29
url: "https://pub.dev"
source: hosted
version: "5.11.0"
version: "5.12.0"
flutter_lints:
dependency: "direct dev"
description:
@@ -599,10 +599,10 @@ packages:
dependency: "direct main"
description:
name: flutter_svg
sha256: cd57f7969b4679317c17af6fd16ee233c1e60a82ed209d8a475c54fd6fd6f845
sha256: b9c2ad5872518a27507ab432d1fb97e8813b05f0fc693f9d40fad06d073e0678
url: "https://pub.dev"
source: hosted
version: "2.2.0"
version: "2.2.1"
flutter_test:
dependency: "direct dev"
description: flutter
@@ -617,10 +617,10 @@ packages:
dependency: "direct dev"
description:
name: freezed
sha256: da32f8ba8cfcd4ec71d9decc8cbf28bd2c31b5283d9887eb51eb4a0659d8110c
sha256: "13065f10e135263a4f5a4391b79a8efc5fb8106f8dd555a9e49b750b45393d77"
url: "https://pub.dev"
source: hosted
version: "3.2.0"
version: "3.2.3"
freezed_annotation:
dependency: "direct main"
description:
@@ -761,10 +761,10 @@ packages:
dependency: "direct main"
description:
name: hive_ce
sha256: "708bb39050998707c5d422752159f91944d3c81ab42d80e1bd0ee37d8e130658"
sha256: "89746b555109029a30780e0a601978460b8065643592667f6e43a238faccb8a4"
url: "https://pub.dev"
source: hosted
version: "2.11.3"
version: "2.13.2"
hive_ce_flutter:
dependency: "direct main"
description:
@@ -833,10 +833,10 @@ packages:
dependency: transitive
description:
name: image_cropper_platform_interface
sha256: "6ca6b81769abff9a4dcc3bbd3d75f5dfa9de6b870ae9613c8cd237333a4283af"
sha256: "2d8db8f4b638e448fa89a1e77cd8f053b4547472bd3ae073169e86626d03afef"
url: "https://pub.dev"
source: hosted
version: "7.1.0"
version: "7.2.0"
image_picker:
dependency: "direct main"
description:
@@ -849,10 +849,10 @@ packages:
dependency: transitive
description:
name: image_picker_android
sha256: "28f3987ca0ec702d346eae1d90eda59603a2101b52f1e234ded62cff1d5cfa6e"
sha256: "8dfe08ea7fcf7467dbaf6889e72eebd5e0d6711caae201fdac780eb45232cd02"
url: "https://pub.dev"
source: hosted
version: "0.8.13+1"
version: "0.8.13+3"
image_picker_for_web:
dependency: transitive
description:
@@ -969,10 +969,10 @@ packages:
dependency: transitive
description:
name: leak_tracker
sha256: "8dcda04c3fc16c14f48a7bb586d4be1f0d1572731b6d81d51772ef47c02081e0"
sha256: "33e2e26bdd85a0112ec15400c8cbffea70d0f9c3407491f672a2fad47915e2de"
url: "https://pub.dev"
source: hosted
version: "11.0.1"
version: "11.0.2"
leak_tracker_flutter_testing:
dependency: transitive
description:
@@ -1025,10 +1025,10 @@ packages:
dependency: "direct main"
description:
name: lottie
sha256: c5fa04a80a620066c15cf19cc44773e19e9b38e989ff23ea32e5903ef1015950
sha256: "8ae0be46dbd9e19641791dc12ee480d34e1fd3f84c749adc05f3ad9342b71b95"
url: "https://pub.dev"
source: hosted
version: "3.3.1"
version: "3.3.2"
matcher:
dependency: transitive
description:
@@ -1113,18 +1113,18 @@ packages:
dependency: transitive
description:
name: objectbox
sha256: "25c2e24b417d938decb5598682dc831bc6a21856eaae65affbc57cfad326808d"
sha256: "3cc186749178a3556e1020c9082d0897d0f9ecbdefcc27320e65c5bc650f0e57"
url: "https://pub.dev"
source: hosted
version: "4.3.0"
version: "4.3.1"
objectbox_flutter_libs:
dependency: transitive
description:
name: objectbox_flutter_libs
sha256: "574b0233ba79a7159fca9049c67974f790a2180b6141d4951112b20bd146016a"
sha256: cd754766e04229a4f51250f121813d9a3c1a74fc21cd68e48b3c6085cbcd6c85
url: "https://pub.dev"
source: hosted
version: "4.3.0"
version: "4.3.1"
octo_image:
dependency: transitive
description:
@@ -1273,10 +1273,10 @@ packages:
dependency: "direct main"
description:
name: persian_datetime_picker
sha256: "0ec2879d2bee8390dda088b412739e6316e3a54d77640ec54dc1eeca8c5baa59"
sha256: "6a5ae6b9f717a6619ae29e65e4c8074285865a88d339dd05c91b9a5b6f8f47d7"
url: "https://pub.dev"
source: hosted
version: "3.1.1"
version: "3.2.0"
petitparser:
dependency: transitive
description:
@@ -1321,10 +1321,10 @@ packages:
dependency: transitive
description:
name: pool
sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a"
sha256: "978783255c543aa3586a1b3c21f6e9d720eb315376a915872c61ef8b5c20177d"
url: "https://pub.dev"
source: hosted
version: "1.5.1"
version: "1.5.2"
posix:
dependency: transitive
description:
@@ -1417,10 +1417,10 @@ packages:
dependency: transitive
description:
name: shared_preferences_android
sha256: a2608114b1ffdcbc9c120eb71a0e207c71da56202852d4aab8a5e30a82269e74
sha256: bd14436108211b0d4ee5038689a56d4ae3620fd72fd6036e113bf1345bc74d9e
url: "https://pub.dev"
source: hosted
version: "2.4.12"
version: "2.4.13"
shared_preferences_foundation:
dependency: transitive
description:
@@ -1526,10 +1526,10 @@ packages:
dependency: transitive
description:
name: source_helper
sha256: a447acb083d3a5ef17f983dd36201aeea33fedadb3228fa831f2f0c92f0f3aca
sha256: "6a3c6cc82073a8797f8c4dc4572146114a39652851c157db37e964d9c7038723"
url: "https://pub.dev"
source: hosted
version: "1.3.7"
version: "1.3.8"
source_map_stack_trace:
dependency: transitive
description: