Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct TokenButtonStyle: ButtonStyle {
- /// Global properties
- private let styleType: StyleType
- private var iconSize: TokenButton.IconSize?
- private var backgroundColor: Color?
- private var borderStyle: StyleAlias.BorderStyle?
- private var textColor: Color?
- /// Circle Icon Button
- init(iconSize: TokenButton.IconSize,
- backgroundColor: BackgroundColor,
- border: BorderStyle? = .none) {
- // --snip--
- }
- /// Icon Button
- init(iconSize: TokenButton.IconSize) {
- // --snip--
- }
- /// Capsule Button
- init(backgroundColor: BackgroundColor, textColor: TextColor) {
- // --snip--
- }
- /// Text Button
- init(textColor: TextColor) {
- // --snip--
- }
- /// Rendering Button Style
- func makeBody(configuration: Self.Configuration) -> some View {
- var renderView: AnyView!
- let verticalMargin = CapsuleValue.verticalMargin.rawValue
- let horizontalMargin = CapsuleValue.horizontalMargin.rawValue
- switch styleType {
- case .circleIcon:
- renderView = AnyView(configuration.label
- // --snip--
- )
- case .icon:
- renderView = AnyView(configuration.label
- // --snip--
- )
- case .capsule:
- renderView = AnyView(configuration.label
- // --snip--
- )
- case .text:
- renderView = AnyView(configuration.label
- // --snip--
- )
- }
- return renderView.opacity(getOpacityValue(configuration.isPressed))
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement