button-system

Button System Architecture

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "button-system" with this command: npx skills add sampaio-tech/ios-design-system/sampaio-tech-ios-design-system-button-system

Button System Architecture

Two-layer system:

  • CupertinoButtonWidget - Base interactive widget for all tappable elements

  • ButtonWidget - High-level themed button with automatic sizing and styling

CupertinoButtonWidget (Base Layer)

Low-level widget providing:

  • Opacity animation on press (default 0.8)

  • Tap, long press, double tap, drag gestures

  • Loading state with CupertinoActivityIndicator

  • Auto focus management

Basic Usage

CupertinoButtonWidget( onPressed: () {}, color: theme.defaultColors.systemBlue, borderRadius: BorderRadius.circular(12), padding: EdgeInsets.all(16), child: Text('Button'), )

With Loading State

CupertinoButtonWidget( onPressed: isLoading ? null : () {}, displayCupertinoActivityIndicator: isLoading, color: theme.defaultColors.systemBlue, child: Text('Submit'), )

With Gradient

CupertinoButtonWidget( onPressed: () {}, backgroundGradient: LinearGradient( colors: [ theme.defaultColors.systemPurple, theme.defaultColors.systemPink, ], ), child: Text('Premium'), )

ButtonWidget (High Layer)

High-level button with automatic theming.

Label Button

ButtonWidget.label( size: const LargeButtonSize(), color: const BlueButtonColor(), label: 'Continue', leftIcon: CupertinoIcons.checkmark, onPressed: () {}, )

Icon-Only Button

ButtonWidget.icon( size: const MediumButtonSize(), color: const GreyTransparentButtonColor(), leftIcon: CupertinoIcons.add, onPressed: () {}, )

Button Sizes

SmallButtonSize

  • Min height: 28pt

  • Border radius: 14pt

  • Typography: subheadline (15pt)

  • Use for: Secondary actions, compact UIs

MediumButtonSize

  • Min height: 34pt

  • Border radius: 50pt (pill)

  • Typography: body (17pt)

  • Use for: Standard buttons, toolbars

LargeButtonSize

  • Min height: 50pt

  • Border radius: 12pt

  • Typography: body (17pt)

  • Use for: Primary CTAs, main actions

CustomButtonSize

Define your own dimensions:

const CustomButtonSize( borderRadius: BorderRadius.all(Radius.circular(16)), padding: EdgeInsets.symmetric(horizontal: 24, vertical: 18), iconSize: 22, boxConstraints: BoxConstraints(minHeight: 56, minWidth: 56), )

Button Colors

BlueButtonColor (Primary)

  • Background: systemBlue (#007AFF → #0A84FF)

  • Label: White

  • Use for: Primary actions (Continue, Save, Submit)

GreyTransparentButtonColor (Secondary)

  • Background: Fill secondary (grey, adapts)

  • Label: systemBlue

  • Use for: Secondary actions (Cancel, Back)

BlueTransparentButtonColor (Tertiary)

  • Background: Blue tint (15% opacity)

  • Label: systemBlue

  • Use for: Tertiary actions (Learn More, Info)

CustomButtonColor

class RedButtonColor extends ButtonColor { const RedButtonColor();

@override Color? backgroundEnabled({required BuildContext context}) { final theme = IosTheme.of(context); return theme.defaultColors.systemRed; }

@override Color labelEnabled({required BuildContext context}) { final theme = IosTheme.of(context); return theme.defaultColors.systemWhite; } }

Label Font Weights

RegularLabelFontWeight

  • Small: subheadlineRegular (400 weight)

  • Others: bodyRegular (400 weight)

BoldLabelFontWeight

  • Small: subheadlineBold (600 weight)

  • Others: bodyBold (600 weight)

Common Patterns

Primary Action

ButtonWidget.label( size: const LargeButtonSize(), color: const BlueButtonColor(), label: 'Continue', onPressed: () {}, )

Secondary with Icon

ButtonWidget.label( size: const MediumButtonSize(), color: const GreyTransparentButtonColor(), label: 'Share', leftIcon: CupertinoIcons.share, onPressed: () {}, )

Toolbar Icon Button

ButtonWidget.icon( size: const MediumButtonSize(), color: const GreyTransparentButtonColor(), leftIcon: CupertinoIcons.add, onPressed: () {}, )

Loading Button

ButtonWidget.label( size: const LargeButtonSize(), color: const BlueButtonColor(), label: 'Processing', displayCupertinoActivityIndicator: isLoading, onPressed: isLoading ? null : () {}, )

Destructive Action

ButtonWidget.label( size: const MediumButtonSize(), color: const CustomButtonColor( backgroundEnabled: theme.defaultColors.systemRed, labelEnabled: theme.defaultColors.systemWhite, ), label: 'Delete', leftIcon: CupertinoIcons.trash, onPressed: () {}, )

Animation Constants

kAnimationInDuration // 180ms kAnimationOutDuration // 120ms kCupertinoButtonPressedOpacity // 0.8

File Locations

  • Base widget: /lib/src/widgets/cupertino_button_widget.dart

  • High-level widget: /lib/src/widgets/button_widget.dart

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

ios-design-system

No summary provided by upstream source.

Repository SourceNeeds Review
General

image-gen

Generate AI images from text prompts. Triggers on: "生成图片", "画一张", "AI图", "generate image", "配图", "create picture", "draw", "visualize", "generate an image".

Archived SourceRecently Updated
General

explainer

Create explainer videos with narration and AI-generated visuals. Triggers on: "解说视频", "explainer video", "explain this as a video", "tutorial video", "introduce X (video)", "解释一下XX(视频形式)".

Archived SourceRecently Updated
General

asr

Transcribe audio files to text using local speech recognition. Triggers on: "转录", "transcribe", "语音转文字", "ASR", "识别音频", "把这段音频转成文字".

Archived SourceRecently Updated