Files

112 lines
3.1 KiB
Dart
Raw Permalink Normal View History

2025-06-30 16:18:12 +03:30
import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
2025-09-24 21:42:22 +03:30
import 'package:rasadyar_chicken/presentation/widget/base_page/back_ground.dart';
2025-06-30 16:18:12 +03:30
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
class ChickenBasePage extends GetView<ChickenBaseLogic> {
2025-09-24 16:24:45 +03:30
const ChickenBasePage({
2025-06-30 16:18:12 +03:30
super.key,
this.hasBack = true,
this.hasFilter = true,
this.hasSearch = true,
this.isBase = false,
2025-09-24 16:24:45 +03:30
this.hasNotification = false,
this.hasNews = false,
this.backId,
this.onBackTap,
2025-06-30 16:18:12 +03:30
this.onFilterTap,
this.onSearchTap,
2025-09-24 16:24:45 +03:30
this.onNewsTap,
this.onNotificationTap,
this.onSearchChanged,
this.routes,
this.routesWidget,
2025-09-24 16:24:45 +03:30
this.child,
this.scrollable = false,
this.floatingActionButtonLocation,
this.floatingActionButton,
this.filteringWidget,
2025-09-24 21:42:22 +03:30
this.backGroundWidget,
2025-09-25 17:25:55 +03:30
this.isFullScreen = false,
this.onPopScopTaped,
2025-10-07 14:21:09 +03:30
this.onRefresh,
2025-09-25 17:25:55 +03:30
});
2025-09-24 16:24:45 +03:30
//AppBar properties`
final bool hasBack;
final bool hasFilter;
final bool hasSearch;
final bool isBase;
2025-09-25 17:25:55 +03:30
final bool isFullScreen;
2025-09-24 16:24:45 +03:30
final bool hasNotification;
final bool hasNews;
final int? backId;
2025-09-24 16:24:45 +03:30
final VoidCallback? onBackTap;
2025-09-25 17:25:55 +03:30
final VoidCallback? onPopScopTaped;
2025-09-24 16:24:45 +03:30
final VoidCallback? onFilterTap;
final VoidCallback? onSearchTap;
final VoidCallback? onNewsTap;
final VoidCallback? onNotificationTap;
2025-10-07 14:21:09 +03:30
final RefreshCallback? onRefresh;
2025-09-24 16:24:45 +03:30
final List<String>? routes;
2025-09-30 09:56:22 +03:30
final Widget? routesWidget;
2025-09-24 16:24:45 +03:30
final Widget? child;
final bool scrollable;
2025-09-24 16:24:45 +03:30
final FloatingActionButtonLocation? floatingActionButtonLocation;
final Widget? floatingActionButton;
final Widget? filteringWidget;
final void Function(String?)? onSearchChanged;
2025-10-07 14:21:09 +03:30
final BoxDecoration? backGroundWidget;
2025-09-24 21:42:22 +03:30
void _onFilterTap() {
2025-09-27 08:05:26 +03:30
if (hasFilter && filteringWidget != null) {
2025-09-24 16:24:45 +03:30
final currentRoute = ModalRoute.of(Get.context!);
if (currentRoute?.isCurrent != true) return;
Get.bottomSheet(
2025-09-27 08:05:26 +03:30
filteringWidget!,
isScrollControlled: true,
isDismissible: true,
enableDrag: true,
);
}
}
@override
Widget build(BuildContext context) {
2025-09-27 08:05:26 +03:30
return BasePage(
routes: routes,
routesWidget: routesWidget,
2025-09-27 13:52:54 +03:30
onPopScopTaped: onPopScopTaped,
2025-10-07 14:21:09 +03:30
onRefresh: onRefresh,
2025-09-27 08:05:26 +03:30
child: child,
2025-09-27 09:35:00 +03:30
onSearchChanged: onSearchChanged,
2025-09-27 08:05:26 +03:30
floatingActionButtonLocation: floatingActionButtonLocation,
floatingActionButton: floatingActionButton,
2025-10-07 14:21:09 +03:30
backGroundDecoration: backGroundWidget ?? chickenBackground(),
2025-09-27 08:05:26 +03:30
appBar: isFullScreen
? null
: chickenAppBar(
isBase: isBase,
hasBack: isBase ? false : hasBack,
onNewsTap: onNewsTap,
hasFilter: hasFilter,
hasSearch: hasSearch,
hasNews: hasNews,
backId: backId,
onBackTap: onBackTap,
hasNotification: hasNotification,
onNotificationTap: onNotificationTap,
2025-09-27 09:35:00 +03:30
onFilterTap: onFilterTap ?? _onFilterTap,
onSearchTap: hasSearch ? controller.toggleSearch : null,
2025-09-27 08:05:26 +03:30
),
);
}
}