|
| 1 | +import 'package:bull_ui/bull_ui.dart'; |
| 2 | +import 'package:flutter/material.dart'; |
| 3 | + |
| 4 | +/// Catalogue-local sample palettes for the theme addon. |
| 5 | +/// |
| 6 | +/// `bull_ui` is intentionally brightness-agnostic and literal-free: in the real |
| 7 | +/// app the [BullTheme] values are injected from `AppColors` (which lives in the |
| 8 | +/// app and which this package must NOT import). To render the components with |
| 9 | +/// the right fidelity in the catalogue we keep a small *representative* copy of |
| 10 | +/// the app palette here. Literals are acceptable in this dev-only catalogue — |
| 11 | +/// they keep `bull_ui` itself free of any colour values. |
| 12 | +/// |
| 13 | +/// These mirror `lib/core/themes/colors.dart` closely enough for visual review; |
| 14 | +/// they are not the single source of truth and may drift slightly. |
| 15 | +class CatalogueColors { |
| 16 | + const CatalogueColors._(); |
| 17 | + |
| 18 | + static const BullTheme light = BullTheme( |
| 19 | + red: Color(0xFFC50909), |
| 20 | + onRed: Color(0xFFFFFFFF), |
| 21 | + surface: Color(0xFFFFFFFF), |
| 22 | + card: Color(0xFFFFFFFF), |
| 23 | + text: Color(0xFF15171C), |
| 24 | + muted: Color(0xFF70747D), |
| 25 | + info: Color(0xFF0063F7), |
| 26 | + success: Color(0xFF34C759), |
| 27 | + warning: Color(0xFFFB9300), |
| 28 | + btc: Color(0xFFFF9500), |
| 29 | + outlineVariant: Color(0xFFE8E8E8), |
| 30 | + shimmerBase: Color(0xFFE0E0E0), |
| 31 | + shimmerHighlight: Color(0xFFF5F5F5), |
| 32 | + secondary: Color(0xFF15171C), |
| 33 | + onSecondary: Color(0xFFFFFFFF), |
| 34 | + secondaryFixedDim: Color(0xFFC9CACD), |
| 35 | + border: Color(0xFFC9CACD), |
| 36 | + onSurface: Color(0xFF15171C), |
| 37 | + onSurfaceVariant: Color(0xFF70747D), |
| 38 | + scrim: Color(0x26000000), |
| 39 | + ); |
| 40 | + |
| 41 | + static const BullTheme dark = BullTheme( |
| 42 | + red: Color(0xFFC50909), |
| 43 | + onRed: Color(0xFFFFFFFF), |
| 44 | + surface: Color(0xFF1C1C1E), |
| 45 | + card: Color(0xFF2C2C2E), |
| 46 | + text: Color(0xFFFFFFFF), |
| 47 | + muted: Color(0xFF8E8E93), |
| 48 | + info: Color(0xFF0A84FF), |
| 49 | + success: Color(0xFF32D74B), |
| 50 | + warning: Color(0xFFFF9F0A), |
| 51 | + btc: Color(0xFFFF9F0A), |
| 52 | + outlineVariant: Color(0xFF3C3C3E), |
| 53 | + shimmerBase: Color(0xFF3C3C3E), |
| 54 | + shimmerHighlight: Color(0xFF48484A), |
| 55 | + secondary: Color(0xFFFFFFFF), |
| 56 | + onSecondary: Color(0xFF15171C), |
| 57 | + secondaryFixedDim: Color(0xFF58585A), |
| 58 | + border: Color(0xFF58585A), |
| 59 | + onSurface: Color(0xFFFFFFFF), |
| 60 | + onSurfaceVariant: Color(0xFF8E8E93), |
| 61 | + scrim: Color(0x26000000), |
| 62 | + ); |
| 63 | +} |
| 64 | + |
| 65 | +/// Builds a Material [ThemeData] carrying the [BullTheme] extension, matching |
| 66 | +/// how the app wires `bull_ui` (extension on `ThemeData.extensions`). Components |
| 67 | +/// read their colours via `context.bull`, so the extension is what matters. |
| 68 | +ThemeData catalogueThemeData(Brightness brightness) { |
| 69 | + final bull = brightness == Brightness.dark |
| 70 | + ? CatalogueColors.dark |
| 71 | + : CatalogueColors.light; |
| 72 | + return ThemeData( |
| 73 | + useMaterial3: true, |
| 74 | + brightness: brightness, |
| 75 | + fontFamily: 'Golos Text', |
| 76 | + extensions: [bull], |
| 77 | + colorScheme: ColorScheme.fromSeed( |
| 78 | + seedColor: bull.red, |
| 79 | + brightness: brightness, |
| 80 | + primary: bull.red, |
| 81 | + ), |
| 82 | + scaffoldBackgroundColor: bull.surface, |
| 83 | + canvasColor: bull.card, |
| 84 | + ); |
| 85 | +} |
0 commit comments