Files
rasadyar_application/packages/chicken/lib/presentation/widget/base_page/view.dart

111 lines
3.1 KiB
Dart

import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
import 'package:rasadyar_chicken/presentation/widget/base_page/back_ground.dart';
import 'package:rasadyar_core/core.dart';
class ChickenBasePage extends GetView<BaseLogic> {
const ChickenBasePage({
super.key,
this.hasBack = true,
this.hasFilter = true,
this.hasSearch = true,
this.isBase = false,
this.hasNotification = false,
this.hasNews = false,
this.backId,
this.onBackTap,
this.onFilterTap,
this.onSearchTap,
this.onNewsTap,
this.onNotificationTap,
this.onSearchChanged,
this.routes,
this.routesWidget,
this.widgets,
this.child,
this.scrollable = false,
this.floatingActionButtonLocation,
this.floatingActionButton,
this.filteringWidget,
this.backGroundWidget,
this.isFullScreen = false,
this.onPopScopTaped,
});
//AppBar properties`
final bool hasBack;
final bool hasFilter;
final bool hasSearch;
final bool isBase;
final bool isFullScreen;
final bool hasNotification;
final bool hasNews;
final int? backId;
final VoidCallback? onBackTap;
final VoidCallback? onPopScopTaped;
final VoidCallback? onFilterTap;
final VoidCallback? onSearchTap;
final VoidCallback? onNewsTap;
final VoidCallback? onNotificationTap;
final List<String>? routes;
final Breadcrumb? routesWidget;
final List<Widget>? widgets;
final Widget? child;
final bool scrollable;
final FloatingActionButtonLocation? floatingActionButtonLocation;
final Widget? floatingActionButton;
final Widget? filteringWidget;
final void Function(String?)? onSearchChanged;
final BackGroundWidget? backGroundWidget;
void _onFilterTap() {
if (hasFilter && filteringWidget != null) {
final currentRoute = ModalRoute.of(Get.context!);
if (currentRoute?.isCurrent != true) return;
Get.bottomSheet(
filteringWidget!,
isScrollControlled: true,
isDismissible: true,
enableDrag: true,
);
}
}
@override
Widget build(BuildContext context) {
return BasePage(
routes: routes,
routesWidget: routesWidget,
onPopScopTaped: onPopScopTaped,
widgets: widgets,
child: child,
scrollable: scrollable,
onSearchChanged: onSearchChanged,
floatingActionButtonLocation: floatingActionButtonLocation,
floatingActionButton: floatingActionButton,
backGroundWidget: backGroundWidget ?? chickenBackground(),
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,
onFilterTap: onFilterTap ?? _onFilterTap,
onSearchTap: hasSearch ? controller.toggleSearch : null,
),
);
}
}