This document serves as a quick reference for using the sail_ui design system components correctly.
Do NOT use:
SailText.primary16() // ❌ Wrong
SailText.secondary16() // ❌ WrongInstead use:
SailText.primary12( // ✅ Correct
'Your text',
)
SailText.secondary12( // ✅ Correct
'Your text',
)Common icons available in sail_ui:
SailSVGAsset.iconHome- Home/OverviewSailSVGAsset.iconWallet- Wallet managementSailSVGAsset.iconTools- Developer tools/utilitiesSailSVGAsset.iconTabSettings- Settings/ConfigurationSailSVGAsset.iconSend- Send/Receive/TransferSailSVGAsset.iconSidechains- Sidechains/NetworkSailSVGAsset.iconCoins- Coins/BalanceSailSVGAsset.dividerDot- Dot separator
Usage:
QtTab(
icon: SailSVGAsset.iconHome,
label: 'Home',
active: true,
)Access through SailTheme:
final theme = SailTheme.of(context);
// Background colors
theme.colors.background
theme.colors.backgroundSecondary
// Text colors
theme.colors.primary
theme.colors.secondary
// Status colors
theme.colors.green
theme.colors.red
theme.colors.orangeUse SailStyleValues for consistent spacing:
SailStyleValues.padding04 // 4.0
SailStyleValues.padding08 // 8.0
SailStyleValues.padding12 // 12.0
SailStyleValues.padding16 // 16.0
SailStyleValues.padding20 // 20.0QtTab(
icon: SailSVGAsset.iconHome,
label: 'Overview',
active: tabsRouter.activeIndex == 0,
onTap: () => tabsRouter.setActiveIndex(0),
)const ToggleThemeButton()- Always get theme from context:
final theme = SailTheme.of(context);- Use SailText with proper size:
SailText.primary12(
'Title',
)- Use proper color properties:
color: theme.colors.primary // ✅ Correct
color: theme.colors.textPrimary // ❌ Wrong- Use SailStyleValues for spacing:
padding: EdgeInsets.all(SailStyleValues.padding16) // ✅ Correct
padding: EdgeInsets.all(16) // ❌ Avoid magic numbersFor status bars and info text:
SailText.secondary12('Status: Connected')For section headers:
SailText.primary12('Section Title')For navigation labels:
QtTab(
icon: SailSVGAsset.iconHome,
label: 'Overview',
active: tabsRouter.activeIndex == 0,
)For gradient backgrounds:
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
theme.colors.background,
theme.colors.backgroundSecondary,
],
),
),