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 viewprimaryButtonTitle
: Title for the primary buttonprimaryButtonAction
: Call back for primary button actionisPrimaryButtonEnabled
: A binding property that deals with the enabled/ disabled state of primary buttonsecondaryButtonTitle
: Title for the secondary buttonsecondaryButtonAction
: Call back for secondary button actionisSecondaryButtonEnabled
: 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
)
}
}
}