setEndDrawerContent method

void setEndDrawerContent(
  1. BuildContext context,
  2. Widget view, {
  3. GlobalKey<ScaffoldState>? scaffoldKey,
})

Implementation

void setEndDrawerContent(BuildContext context, Widget view,
    {GlobalKey<ScaffoldState>? scaffoldKey}) {
  currentEndDrawerContent.value = view;
  if (isWebScreen(context)) {
    // Use addPostFrameCallback so the Scaffold's Obx has time to rebuild
    // and register the new endDrawer before we try to open it.
    // Without this, the very first tap silently fails because the drawer
    // is not yet attached to the Scaffold when openEndDrawer() is called.
    WidgetsBinding.instance.addPostFrameCallback((_) {
      if (scaffoldKey != null) {
        scaffoldKey.currentState?.openEndDrawer();
      } else {
        Scaffold.of(context).openEndDrawer();
      }
    });
  } else {
    AppUtils.showActionBottomSheet(context, view, isScrollControlled: true);
  }
}