110 lines
3.1 KiB
Dart
110 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.child,
|
|
this.scrollable = false,
|
|
this.floatingActionButtonLocation,
|
|
this.floatingActionButton,
|
|
this.filteringWidget,
|
|
this.backGroundWidget,
|
|
this.isFullScreen = false,
|
|
this.onPopScopTaped,
|
|
this.onRefresh,
|
|
});
|
|
|
|
//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 RefreshCallback? onRefresh;
|
|
|
|
final List<String>? routes;
|
|
final Widget? routesWidget;
|
|
final Widget? child;
|
|
final bool scrollable;
|
|
|
|
final FloatingActionButtonLocation? floatingActionButtonLocation;
|
|
final Widget? floatingActionButton;
|
|
final Widget? filteringWidget;
|
|
final void Function(String?)? onSearchChanged;
|
|
|
|
final BoxDecoration? 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,
|
|
onRefresh: onRefresh,
|
|
child: child,
|
|
onSearchChanged: onSearchChanged,
|
|
floatingActionButtonLocation: floatingActionButtonLocation,
|
|
floatingActionButton: floatingActionButton,
|
|
backGroundDecoration: 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,
|
|
),
|
|
);
|
|
}
|
|
}
|