|
| 1 | +# bull_ui |
| 2 | + |
| 3 | +The Bull Bitcoin design-system component library — the go-forward source of truth for |
| 4 | +shared UI primitives. It is the first melos workspace member (`packages/bull_ui`). |
| 5 | + |
| 6 | +Every public widget is prefixed `Bull*` (e.g. `BullText`, `BullButton`, `BullScaffold`). |
| 7 | +This prefix is provenance: **`BB*` = legacy widgets in `lib/core/widgets`, `Bull*` = here**. |
| 8 | +The two coexist during the incremental migration; `BB*` originals are retired |
| 9 | +feature-by-feature in later scoped PRs as usages migrate. Nothing is moved or renamed — |
| 10 | +`bull_ui` components are duplicated copies, so existing app code is untouched. |
| 11 | + |
| 12 | +## Theme injection |
| 13 | + |
| 14 | +`bull_ui` is **brightness-agnostic** and never hardcodes a colour. The app injects the |
| 15 | +palette: it builds a `BullTheme` (a `ThemeExtension`) from `AppColors.light` and another |
| 16 | +from `AppColors.dark`, and registers each on the matching `ThemeData` via `extensions:`. |
| 17 | +Components read colours through `context.bull` (e.g. `context.bull.red`); derived fills use |
| 18 | +`tokenColor.withValues(alpha: …)` so they adapt to both light and dark automatically. |
| 19 | + |
| 20 | +Brightness-invariant tokens (radii, spacing, type over Golos Text) are static consts: |
| 21 | +`BullRadius`, `BullSpacing`, `BullTextStyles`. Icons are wrapped via `BullIcon(BullIcons.…)`. |
| 22 | + |
| 23 | +Fonts (Golos Text, Bebas Neue) are declared at the app root and resolve by family name |
| 24 | +across the workspace — `bull_ui` references them by name and does not re-ship the `.ttf`s. |
| 25 | + |
| 26 | +## Import surface |
| 27 | + |
| 28 | +Consumers import a single barrel: |
| 29 | + |
| 30 | +```dart |
| 31 | +import 'package:bull_ui/bull_ui.dart'; |
| 32 | +``` |
| 33 | + |
| 34 | +It re-exports a curated `show` list of `package:flutter/widgets.dart` layout/foundation |
| 35 | +symbols plus every `Bull*` component and the theme. Internals live under `lib/src/`. |
| 36 | + |
| 37 | +## Components |
| 38 | + |
| 39 | +Duplicated from `lib/core/widgets/**` as dependency-clean `Bull*` copies (the |
| 40 | +`BB*`/core originals are left untouched). Grouped by barrel category: |
| 41 | + |
| 42 | +**Buttons** — `BullButton`, `BullToolButton`, `BullTabMenuVerticalButton` |
| 43 | +(`TabMenuVerticalButton`), `BullViewerActionButton` (`ViewerActionButton`). |
| 44 | + |
| 45 | +**Inputs** — `BullCheckbox`, `BullFilterChip`, `BullInputText` (`BBInputText`), |
| 46 | +`BullPasteInput` (`PasteInput`), `BullDropdown` (`BBDropdown`), |
| 47 | +`BullSelectableList` + `BullSelectableListItem` (`SelectableList`), |
| 48 | +`BullDialPad` (`DialPad`), `BullAmountInputFormatter` (`AmountInputFormatter`), |
| 49 | +`BullLowerCaseTextFormatter` (`LowerCaseTextFormatter`). |
| 50 | + |
| 51 | +**Controls** — `BullSegmented`, `BullSwipeAction`, `BullSwitch` (`BBSwitch`). |
| 52 | + |
| 53 | +**Feedback** — `BullRefreshIndicator` (`BBRefreshIndicator`), `BullShimmerBox`/ |
| 54 | +`BullShimmerLine`, `BullSnackBar`, `BullCountdown` (`Countdown`), |
| 55 | +`BullFadingLinearProgress` (`FadingLinearProgress`). |
| 56 | + |
| 57 | +**Layout** — `BullScrollableColumn` (`ScrollableColumn`), `BullStackedPage` |
| 58 | +(`StackedPage`), `BullPullableBody` (`BBPullableBody`). |
| 59 | + |
| 60 | +**Data display** — `BullAddressText`, `BullBadge`, `BullInfoBar`, |
| 61 | +`BullLabelChip`, `BullStatTile`, `BullText` (`BBText`), `BullOptionsTag` |
| 62 | +(`OptionsTag`), `BullInfoCard` (`InfoCard`), `BullPriceCard` (`PriceCard`), |
| 63 | +`BullBackupOptionCard` (`BackupOptionCard`), `BullBorderedTile` |
| 64 | +(`BorderedTappableTile`), `BullTransactionDirectionBadge` |
| 65 | +(`TransactionDirectionBadge`), `BullSettingsEntryItem` (`SettingsEntryItem`), |
| 66 | +`BullDetailsTable` + `BullDetailsTableItem` (`DetailsTable` / `DetailsTableItem`). |
| 67 | + |
| 68 | +**Overlays** — `BullBottomSheet`, `BullDialog`, `BullPickerSheet` |
| 69 | +(`BBPickerSheet`), `BullInstructionsSheet` (`InstructionsBottomSheet`). |
| 70 | + |
| 71 | +**Chrome** — `BullScaffold`, `BullTopBar`, `BullSelectionActionBar`. |
| 72 | + |
| 73 | +## Not yet migrated (needs dep abstraction) |
| 74 | + |
| 75 | +These `core/widgets` widgets still reach into `package:bb_mobile/*` (or otherwise |
| 76 | +can't preserve their public API on top of the clean kit) and are **deferred** |
| 77 | +until the dependency is abstracted out of the widget: |
| 78 | + |
| 79 | +| Widget | Blocker | |
| 80 | +| --- | --- | |
| 81 | +| `MultiTapTrigger` | `package:bb_mobile/core/widgets/snackbar_utils.dart` — its public `tapsReachedMessageTextColor` / `tapsReachedMessageBackgroundColor` API can't be honoured by `BullSnackBar.show` (String-only), so migrating would lose API. | |
| 82 | +| `CopyInput`, `BBKeyboardActions` | depend on `package:bb_mobile/*` localization / app utils. | |
| 83 | +| `BBButton` (`buttons/button.dart`) | already superseded by `BullButton`; not a 1:1 copy. | |
| 84 | +| Cards: `ActionCard`, `AutoswapWarningCard`, `BackupCard`, `BalanceCard`, `ProviderCart`, `WalletCard` | `package:bb_mobile/*` (router, l10n, feature models, `Assets`). | |
| 85 | +| `BBKeyboardActions` | needs `package:keyboard_actions/keyboard_actions.dart`, not declared in `bull_ui/pubspec.yaml` (no new deps rule). | |
| 86 | +| Bottom sheets: `AdvancedOptions`, `ComingSoon`, `Warning`, `NotLoggedIn`, `DeleteAccount*`, `Logout*`, `TranslationWarning` | `context.loc` localization and/or `package:bb_mobile/*` router & assets. | |
| 87 | +| Cards: `AutoswapWarningCard` | `context.loc` (`autoswapWarningCard*` strings) + `context.font` from `package:bb_mobile/core/utils/build_context_x.dart`. | |
| 88 | +| Loading: `ProgressScreen`, `StatusScreen` | `ProgressScreen` imports `package:bb_mobile/generated/flutter_gen/assets.gen.dart`; `StatusScreen` uses `context.loc` + `BBButton`. | |
| 89 | +| Viewers: `AddressViewer`, `TransactionViewer`, `InvoiceViewer`, `LogViewer`, `QrScanner`, `NfcScanner`, `ShareLogs`, `Bip85Derivation`, `MnemonicWidget`, `CoinSelectionBottomSheet`, `AppLanguagePicker`, `BackupSuccessScreen`, `PriceInput`, `TransactionsByDayList`, `BalanceRow`, `RecoverbullVaultProviderSelector` | `package:bb_mobile/*` (entities, l10n, assets, feature blocs). | |
0 commit comments