createScaledFab method

Widget? createScaledFab(
  1. BuildContext context
)

Implementation

Widget? createScaledFab(BuildContext context) {
  // Searching for index of a tab with not 0.0 scale
  final indexOfCurrentFab =
      controller.tabScales.indexWhere((fabScale) => fabScale != 0);
  // If there are no fabs with non-zero opacity return nothing
  if (indexOfCurrentFab == -1) {
    return null;
  }
  // Creating fab for current index
  final fab = createFab(indexOfCurrentFab, context);
  // If no fab created return nothing
  /*if (fab == null) {
    return null;
  }*/
  final currentFabScale = controller.tabScales[indexOfCurrentFab];
  // Scale created fab with
  // You can use different Widgets to create different effects of switching
  // fabs. E.g. you can use Opacity widget or Transform.translate to create
  // custom animation effects
  return Transform.scale(scale: currentFabScale, child: fab);
}