mainContainer method

Widget mainContainer(
  1. BuildContext context
)

Implementation

Widget mainContainer(BuildContext context) {
  return Stack(
    fit: StackFit.expand,
    children: [
      NotificationListener<ScrollNotification>(
        onNotification: (notification) {
          if (notification is ScrollUpdateNotification) {
            controller.searchFocusNode.unfocus();
            if (notification.metrics.pixels > 10 && !controller.isScrollingUp.value) {
              controller.isScrollingUp.value = true;
              controller.reachedStart.value = false;
            }else if (notification.metrics.pixels < 10 && !controller.reachedStart.value) {
              controller.reachedStart.value = true;
              controller.isScrollingUp.value = false;
            }
            else if (notification is ScrollEndNotification) {
              controller.isScrollingUp.value = false;
              // controller.reachedStart.value = false;
            }
          }
          return true;
        },
        child: CustomScrollView(
          slivers: [
             SliverAppBar(
                  automaticallyImplyLeading: false,
                  backgroundColor: Colors.white,
                  surfaceTintColor: Colors.white,
                  pinned: true,
                  floating: false,
                  titleSpacing: 0,
                  expandedHeight: context.x<768?300:400,
                  collapsedHeight: 315,
                  flexibleSpace: const FlexibleSpaceBar(
                    titlePadding: EdgeInsets.zero,
                    title: DashboardHeader(),
                    expandedTitleScale: 1,
                  ),
                ),
            SliverToBoxAdapter(
              child:  SingleChildScrollView(
                physics: const NeverScrollableScrollPhysics(),
                child: Column(
                  children: [
                    Obx(
                      () {
                        return _buildWidget();
                      },
                    ),
                     Footer(fromLandingPage: false,)
                  ],
                ),
              ),
            )
          ],
        ),
      ),
      Positioned(
          top: 0,
          left: 0,
          right: 0,
          child: Container(
            width: double.infinity,
            color: Colors.white,
            child: TopMenuHeader(
              isMoreOpen: RxBool(false),
              isPhoneMoreOpen: true.obs,
              onNotificationClicked: () {
                controller.isFilterDrawer.value = false;
                Get.find<NotificationsController>().getNotifications();
                Scaffold.of(context).openEndDrawer();
              },
            ),
          )),
    ],
  );
}