|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +**layrz_theme** is a Flutter widget library (published on pub.dev) that implements the Layrz design standard following Material Design 3 guidelines. It provides inputs, layout systems, tables, theme generators, maps, and more. SDK constraints: Dart >=3.10.0, Flutter >=3.38.1. |
| 8 | + |
| 9 | +## Commands |
| 10 | + |
| 11 | +```bash |
| 12 | +flutter pub get # Install dependencies |
| 13 | +flutter analyze # Lint (this is what CI runs on PRs) |
| 14 | +flutter test # Run all tests |
| 15 | +flutter test test/color_test.dart # Run a single test file |
| 16 | +``` |
| 17 | + |
| 18 | +**Example app:** |
| 19 | +```bash |
| 20 | +cd example && flutter pub get && flutter run |
| 21 | +``` |
| 22 | + |
| 23 | +## Architecture |
| 24 | + |
| 25 | +### Module System |
| 26 | + |
| 27 | +The library is organized as a set of sub-libraries under `lib/src/`. Each module directory contains a barrel file (e.g., `inputs.dart`, `layout.dart`) that uses Dart's `library` + `part` directives to compose its implementation files. The top-level `lib/layrz_theme.dart` re-exports all sub-libraries. |
| 28 | + |
| 29 | +**To add a new widget to an existing module:** create the implementation file in the appropriate subdirectory, then add a `part` directive in the module's barrel file. |
| 30 | + |
| 31 | +### Key Modules |
| 32 | + |
| 33 | +| Module | Purpose | |
| 34 | +|--------|---------| |
| 35 | +| `inputs/` | Form inputs (text, number, select, pickers, code editor, etc.) — largest module (~95 part files) | |
| 36 | +| `layout/` | App shell with multiple navigation styles (sidebar, dual bar, mini, bottom nav), breadcrumbs, AppBar | |
| 37 | +| `theme/` | Light/dark Material 3 theme generation, color constants, font config via Google Fonts | |
| 38 | +| `table2/` | Advanced data table with sorting, filtering, multi-select, infinite scroll, controller pattern | |
| 39 | +| `extensions/` | Extension methods on Color, DateTime, Widget, String | |
| 40 | +| `helpers/` | Utilities for shadows, avatars, colors, file handling | |
| 41 | +| `map/` | Flutter Map integration with toolbar and controls | |
| 42 | +| `colorblindness/` | Color blindness simulation filters (6 modes with adjustable strength) | |
| 43 | + |
| 44 | +### Patterns |
| 45 | + |
| 46 | +- **Responsive breakpoints:** `kExtraSmallGrid` (600), `kSmallGrid` (960), `kMediumGrid` (1264), `kLargeGrid` (1904) — used with `LayoutBuilder` throughout. |
| 47 | +- **Theme colors:** `kPrimaryColor` (#001e60), `kAccentColor` (#FF8200). |
| 48 | +- **State management:** Uses `layrz_state` package. Example app has `AppStore` for theme/colorblind mode. |
| 49 | +- **Platform-conditional imports:** File handling uses `if (dart.library.js_interop)` for web vs native. |
| 50 | +- **Input pattern:** Widgets accept optional external `FocusNode`/`TextEditingController`; only internally-created controllers are disposed. |
| 51 | +- **Enum-based styling:** Components use style enums (e.g., `ThemedButtonStyle`, `ThemedInputStyle`) for variant selection. |
| 52 | + |
| 53 | +## Code Style |
| 54 | + |
| 55 | +- Formatter: 120-char page width, trailing commas preserved (`analysis_options.yaml`) |
| 56 | +- Linter: `flutter_lints` package |
| 57 | +- Use modern Dart dot shorthand syntax |
| 58 | + |
| 59 | +## CI |
| 60 | + |
| 61 | +- PRs to `main`, `next`, `development` run `flutter analyze` (Flutter 3.38.8 stable) |
| 62 | +- Version tags (`v*.*.*`) trigger publish to pub.dev and deploy example to GitHub Pages |
0 commit comments