refactor : inspection
This commit is contained in:
@@ -8,6 +8,7 @@ class BaseLogic extends GetxController {
|
||||
final TextEditingController textEditingController = TextEditingController();
|
||||
|
||||
void setSearchCallback(void Function(String?)? onSearchChanged) {
|
||||
fLog("sssssssssssssssssssssssssssssssss");
|
||||
debounce<String?>(searchValue, (val) {
|
||||
if (val != null && val.trim().isNotEmpty) {
|
||||
onSearchChanged?.call(val);
|
||||
|
||||
@@ -15,6 +15,7 @@ class BasePage extends GetView<BaseLogic> {
|
||||
this.backGroundWidget,
|
||||
this.onPopScopTaped,
|
||||
this.backId,
|
||||
this.onSearchChanged,
|
||||
});
|
||||
|
||||
final List<String>? routes;
|
||||
@@ -28,13 +29,18 @@ class BasePage extends GetView<BaseLogic> {
|
||||
final Widget? floatingActionButton;
|
||||
final VoidCallback? onPopScopTaped;
|
||||
final int? backId;
|
||||
final void Function(String?)? onSearchChanged;
|
||||
|
||||
Widget _buildHeader() {
|
||||
if (appBar?.hasSearch == true) {
|
||||
controller.setSearchCallback(onSearchChanged);
|
||||
}
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
routesWidget ?? TextBreadcrumb(routes: routes!),
|
||||
if (controller.isSearchSelected.value) ...{SearchWidget()},
|
||||
routesWidget ?? ContainerBreadcrumb(routes: routes!),
|
||||
SearchWidget(),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ class TextBreadcrumb extends Breadcrumb {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class ContainerBreadcrumb extends Breadcrumb {
|
||||
const ContainerBreadcrumb({super.key, super.routes});
|
||||
|
||||
@@ -35,24 +34,32 @@ class ContainerBreadcrumb extends Breadcrumb {
|
||||
}
|
||||
|
||||
Widget buildContainerPageRoute(List<String> route) {
|
||||
return Container(
|
||||
height: 24.h,
|
||||
margin: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h),
|
||||
decoration: BoxDecoration(color: Color(0xFFE3E3E3), borderRadius: BorderRadius.circular(2.r)),
|
||||
padding: EdgeInsets.symmetric(horizontal: 6.w),
|
||||
child: ListView.separated(
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) => Center(
|
||||
child: Text(route[index], style: AppFonts.yekan14.copyWith(color: AppColor.labelTextColor)),
|
||||
return Row(
|
||||
children: [
|
||||
Container(
|
||||
height: 24.h,
|
||||
margin: EdgeInsets.symmetric(horizontal: 8.w, vertical: 4.h),
|
||||
decoration: BoxDecoration(color: Colors.white, borderRadius: BorderRadius.circular(2.r)),
|
||||
padding: EdgeInsets.symmetric(horizontal: 6.w),
|
||||
child: ListView.separated(
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: NeverScrollableScrollPhysics(),
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) => Center(
|
||||
child: Text(
|
||||
route[index],
|
||||
style: AppFonts.yekan14.copyWith(color: AppColor.labelTextColor),
|
||||
),
|
||||
),
|
||||
separatorBuilder: (context, index) => Assets.vec.arrowLeftSvg.svg(
|
||||
height: 24.h,
|
||||
fit: BoxFit.fitHeight,
|
||||
colorFilter: ColorFilter.mode(Color(0xFFD6DEEE), BlendMode.srcIn),
|
||||
),
|
||||
itemCount: route.length,
|
||||
),
|
||||
),
|
||||
separatorBuilder: (context, index) =>
|
||||
Assets.vec.arrowLeftSvg.svg(height: 24.h, fit: BoxFit.fitHeight),
|
||||
itemCount: route.length,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import 'dart:developer';
|
||||
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
@@ -32,6 +30,7 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
/// Preferred size widget for the AppBar bottom.
|
||||
final PreferredSizeWidget? bottom;
|
||||
|
||||
|
||||
const RAppBar({
|
||||
super.key,
|
||||
this.children,
|
||||
@@ -72,16 +71,19 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
if (hasNews)
|
||||
GestureDetector(
|
||||
onTap: onNewsTap,
|
||||
child: Badge.count(
|
||||
count: 5,
|
||||
child: Icon(CupertinoIcons.news_solid, color: Colors.white),
|
||||
),
|
||||
|
||||
child: Icon(CupertinoIcons.news_solid, color: Colors.white),
|
||||
),
|
||||
if (hasNews) SizedBox(width: 8.w),
|
||||
|
||||
if (hasNotification)
|
||||
Badge.count(count: 2, child: Icon(CupertinoIcons.bell_fill, color: Colors.white)),
|
||||
GestureDetector(
|
||||
onTap: onNotificationTap,
|
||||
child: Icon(CupertinoIcons.bell_fill, color: Colors.white),
|
||||
),
|
||||
|
||||
if (hasNotification) SizedBox(width: 8.w),
|
||||
|
||||
if (!isBase) ...{
|
||||
if (hasFilter)
|
||||
GestureDetector(
|
||||
@@ -94,7 +96,14 @@ class RAppBar extends StatelessWidget implements PreferredSizeWidget {
|
||||
),
|
||||
if (hasBack) SizedBox(width: 8.w),
|
||||
|
||||
if (hasSearch) SearchWidget(),
|
||||
if (hasSearch) GestureDetector(
|
||||
onTap: onSearchTap,
|
||||
child: Assets.vec.searchSvg.svg(
|
||||
width: 24.w,
|
||||
height: 24.h,
|
||||
colorFilter: ColorFilter.mode(Colors.white, BlendMode.srcIn),
|
||||
),
|
||||
),
|
||||
if (hasSearch) SizedBox(width: 8.w),
|
||||
},
|
||||
if (hasBack)
|
||||
|
||||
@@ -4,6 +4,7 @@ import 'package:rasadyar_core/core.dart';
|
||||
class SearchWidget extends GetView<BaseLogic> {
|
||||
const SearchWidget({super.key});
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ObxValue((data) {
|
||||
|
||||
Reference in New Issue
Block a user