createFab method

Widget createFab(
  1. int index,
  2. BuildContext context
)

Implementation

Widget createFab(final int index, BuildContext context) {
  if (index == 0) {
    return FloatingActionButton(
      tooltip: "New Chat",
      heroTag: "New Chat",
      onPressed: () {
        controller.gotoContacts();
      },
      child: AppUtils.svgIcon(
        icon: chatFabIcon,
        width: Theme.of(context).floatingActionButtonTheme.iconSize,
        colorFilter: ColorFilter.mode(
            Theme.of(context).floatingActionButtonTheme.foregroundColor ??
                Colors.white,
            BlendMode.srcIn),
      ),
    );
  }
  // Not created fab for 1 index deliberately
  if (index == 1) {
    return AnimatedFloatingAction(
      tooltip: "New Call",
      backgroundColor:
          Theme.of(context).floatingActionButtonTheme.backgroundColor,
      foregroundColor:
          Theme.of(context).floatingActionButtonTheme.foregroundColor,
      icon: AppUtils.svgIcon(
        icon: plusIcon,
        width: Theme.of(context).floatingActionButtonTheme.iconSize,
        colorFilter: ColorFilter.mode(
            Theme.of(context).floatingActionButtonTheme.foregroundColor ??
                Colors.white,
            BlendMode.srcIn),
        fit: BoxFit.contain,
      ),
      audioCallOnPressed: () {
        controller.gotoContacts(forCalls: true, callType: CallType.audio);
      },
      videoCallOnPressed: () {
        controller.gotoContacts(forCalls: true, callType: CallType.video);
      },
    );
  }
  return const Offstage();
}