slide method

  1. @override
Widget slide(
  1. BuildContext context
)
override

Override this method to add slide (foreground) widget.

The widget returned by this method will be placed as foreground of that particular slide.

Implementation

@override
Widget slide(BuildContext context) {
  return LayoutBuilder(
    builder: (context, constraints) {
      late EdgeInsetsGeometry padding;
      // only when padding is null
      if (_padding == null) {
        // left and bottom paddings when unbounded size
        var left = 40.0;
        var bottom = 80.0;
        if (constraints.hasBoundedHeight) {
          bottom = constraints.maxHeight * 0.12;
        }
        if (constraints.hasBoundedWidth) {
          left = constraints.maxWidth * 0.05;
        }
        padding = EdgeInsets.only(left: left, bottom: bottom);
      }
      return Align(
        alignment: Alignment.bottomLeft,
        child: Padding(
          padding: _padding ?? padding,
          child: caption ??
              Text(
                _captionText!,
                style: Theme.of(context).textTheme.headlineLarge,
              ),
        ),
      );
    },
  );
}