Keyboard Shortcuts

j / kScroll down / up
ggScroll to top
GScroll to bottom
K / /Open search
?Show this help
EscClose search / help
n / NNext / previous section
hGo to landing
dGo to docs
:Command mode — type section name

Press ? or Esc to close

Architecture

Design System

Full design token system. Runtime theme switching with zero refactor cost. All UI uses semantic tokens — never hardcoded values.

ClassRole
AppColorsRaw palette — never used directly in UI
AppThemeColorsThemeExtension with 40+ semantic properties. Access via context.colors.*
AppTypographyTextStyle constants. Display · Heading · Body scales. Two font families.
AppSpacingBase scale s0–s1200. Aliases: xxs(4) xs(8) sm(12) md(16) lg(20) xl(24) xxl(32) xxxl(40) huge(48)
AppShadowsElevation shadow tokens

AppThemeColors — 40+ semantic tokens

lib/config/theme/app_theme_colors.dart
class AppThemeColors extends ThemeExtension<AppThemeColors> {
  // Backgrounds
  final Color background;
  final Color surface;
  final Color surfaceSecondary;
  final Color surfaceTertiary;

  // Brand
  final Color primary;
  final Color primaryDark;
  final Color primaryHover;
  final Color primaryPressed;

  // Text
  final Color textPrimary;
  final Color textSecondary;
  final Color textTertiary;
  final Color textDisabled;
  final Color textPrimaryInv;

  // Stroke
  final Color border;
  final Color divider;

  // Status
  final Color success;
  final Color warning;
  final Color error;
  final Color info;

  // ... 20+ more tokens
}

ThemeCubit — runtime switching

lib/config/theme/theme_cubit.dart
class ThemeCubit extends Cubit<ThemeMode> {
  final SharedPreferences _prefs;

  ThemeCubit(this._prefs) : super(_loadSavedTheme());

  void setLight() => _saveAndEmit(ThemeMode.light);
  void setDark()  => _saveAndEmit(ThemeMode.dark);
  void toggle()   => _saveAndEmit(state == ThemeMode.light ? ThemeMode.dark : ThemeMode.light);

  ThemeData buildTheme() => ThemeData(
    extensions: [AppThemeColors.light()],
    // ...
  );
}

UI usage

lib/features/home/presentation/screens/home_screen.dart
// Always use context.colors.* — never AppColors.*
Container(
  color: context.colors.surface,
  child: Text(
    'Hello',
    style: AppTypography.bodyMdRegular.copyWith(
      color: context.colors.textPrimary,
    ),
  ),
);

// Spacing — never raw numbers
SizedBox(height: AppSpacing.md);
Padding(padding: .symmetric(horizontal: AppSpacing.lg));
Rule: Never use AppColors.* directly in widgets. Always context.colors.* — the only API into the color system.
sam's arch — A Pragmatic Flutter Architecture