groupRightRouteBuilders static method

Map<String, WidgetBuilder> groupRightRouteBuilders(
  1. BuildContext context,
  2. RouteSettings routeSettings,
  3. dynamic _data, {
  4. required Function initialRouteOnArrowBackTap,
  5. required Function initialRouteOnDoneTap,
  6. int? expandIndex,
})

Implementation

static Map<String, WidgetBuilder> groupRightRouteBuilders(
    BuildContext context, RouteSettings routeSettings, var _data,
    {required Function initialRouteOnArrowBackTap,
    required Function initialRouteOnDoneTap,
    int? expandIndex}) {
  return {
    DesktopRoutes.DESKTOP_GROUP_RIGHT_INITIAL: (context) {
      if (_data.length == 0) {
        return GroupContactView(
            asSelectionScreen: true,
            singleSelection: false,
            showGroups: false,
            showContacts: true,
            isDesktop: true,
            selectedList: (selectedContactList) {
              GroupService().setSelectedContacts(
                  selectedContactList.map((e) => e?.contact).toList());
            },
            onBackArrowTap: (selectedGroupContacts) {
              initialRouteOnArrowBackTap();
            },
            onDoneTap: () {
              initialRouteOnDoneTap();
            });
      } else {
        return DesktopGroupDetail(_data[expandIndex ?? 0], expandIndex ?? 0);
      }
    },
    DesktopRoutes.DESKTOP_NEW_GROUP: (context) {
      var args = routeSettings.arguments as Map<String, dynamic>;
      return DesktopNewGroup(
        onPop: args['onPop'],
        onDone: args['onDone'],
      );
    },
    DesktopRoutes.DESKTOP_GROUP_DETAIL: (context) {
      var args = routeSettings.arguments as Map<String, dynamic>;
      return DesktopGroupDetail(args['group'], args['currentIndex']);
    },
    DesktopRoutes.DESKTOP_GROUP_CONTACT_VIEW: (context) {
      var args = routeSettings.arguments as Map<String, dynamic>;
      return GroupContactView(
        asSelectionScreen: true,
        singleSelection: false,
        showGroups: false,
        showContacts: true,
        isDesktop: true,
        selectedList: (selectedContactList) {
          GroupService().setSelectedContacts(
              selectedContactList.map((e) => e?.contact).toList());
        },
        onBackArrowTap: args['onBackArrowTap'],
        onDoneTap: args['onDoneTap'],
        contactSelectedHistory: args['contactSelectedHistory'],
      );
    }
  };
}