Skip to main content
Version: Next

OCStickyButtonView: UI Component

OCStickyButtonView is a customizable button view component which can be placed in the bottom of the screens to be sticky.

Buttons of the sticky button view can be configured in multiple ways

  • With just primary button only.
  • With both primary and secondary buttons.
  • With a custom view as the content.

Features

  • An optional customizable fade effect is also comes in the component at the top edge

Parameters:

  • style: Style elements for the view
  • primaryButtonTitle: Title for the primary button
  • primaryButtonAction: Call back for primary button action
  • isPrimaryButtonEnabled: A binding property that deals with the enabled/ disabled state of primary button
  • secondaryButtonTitle: Title for the secondary button
  • secondaryButtonAction: Call back for secondary button action
  • isSecondaryButtonEnabled: A binding property that deals with the enabled/ disabled state of secondary button
    // Option 1
var body: some View {
VStack(spacing: 0) {
OCScaffold(shouldBounce: true) {
listContent // Sample content
Spacer()
}
OCStickyButtonView(primaryButtonTitle: "Primary Button",
primaryButtonAction: primaryAction,
secondaryButtonTitle: "Secondary Button",
secondaryButtonAction: secondaryAction)
}
}

// Option 2
var body: some View {
VStack(spacing: 0) {
OCScaffold(shouldBounce: true) {
listContent // Sample content
Spacer()
}
OCStickyButtonView(style: OCStickyButtonViewStyle(backgroundColor: .backgroundGreen, contentTopPadding: 24.0, contentBottomPadding: 16.0)) {
OCButton(
title: "Custom Button",
type: .custom(configuration: OCCustomButtonStyle(
disabledForegroundColor: .buttonPrimaryOnBackgoundDisabled,
disabledBackgroundColor: .buttonPrimaryBackgroundDisabled
)),
isEnabled: .constant(true),
maxWidth: .infinity
)
}
}
}