build method

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

Describes the part of the user interface represented by this widget.

The framework calls this method when this widget is inserted into the tree in a given BuildContext and when the dependencies of this widget change.

Implementation

@override
Widget build(BuildContext context) {
  final theme = StoryMakerThemeProvider.of(context);
  return Container(
    height: context.bottomPadding + kToolbarHeight,
    alignment: Alignment.topCenter,
    child: ClipRect(
      child: BackdropFilter(
        filter: ui.ImageFilter.blur(sigmaX: 10, sigmaY: 10),
        child: DecoratedBox(
          decoration: BoxDecoration(
            gradient: LinearGradient(
              begin: Alignment.bottomCenter,
              end: Alignment.topCenter,
              colors: [
                Colors.black.withValues(alpha: 0.3),
                Colors.transparent,
              ],
            ),
          ),
          child: Padding(
            padding: const EdgeInsets.only(top: 4, right: 16),
            child: Row(
              mainAxisAlignment: MainAxisAlignment.end,
              children: [
                if (doneButtonBuilder != null)
                  doneButtonBuilder!(theme, onDone, isLoading)
                else
                  ElevatedButton(
                    onPressed: isLoading ? null : onDone,
                    style: theme.doneButtonStyle ??
                        ButtonStyle(
                          shape: WidgetStateProperty.all(
                            RoundedRectangleBorder(
                              borderRadius: BorderRadius.all(
                                Radius.circular(theme.buttonBorderRadius),
                              ),
                            ),
                          ),
                          shadowColor: WidgetStateProperty.all(
                            theme.buttonShadow?.color ?? theme.buttonColor,
                          ),
                          backgroundColor:
                              WidgetStateProperty.all(theme.buttonColor),
                          elevation: WidgetStateProperty.all(
                            theme.buttonShadow != null ? 4 : 0,
                          ),
                        ),
                    child: isLoading
                        ? CupertinoActivityIndicator(
                            color: theme.buttonTextColor,
                          )
                        : doneButtonChild ??
                            Row(
                              mainAxisSize: MainAxisSize.min,
                              children: [
                                const SizedBox(width: 4),
                                Text(
                                  'Add to story',
                                  style: TextStyle(
                                    color: theme.buttonTextColor,
                                    fontSize: 12,
                                  ),
                                ),
                                const SizedBox(width: 4),
                                Icon(
                                  CupertinoIcons.forward,
                                  color: theme.buttonTextColor,
                                  size: 18,
                                ),
                              ],
                            ),
                  ),
              ],
            ),
          ),
        ),
      ),
    ),
  );
}