diff --git a/README.md b/README.md index e1fa7f0..e95ebdd 100644 --- a/README.md +++ b/README.md @@ -1,283 +1,122 @@ -# Escalated for Flutter - -[![Tests](https://github.com/escalated-dev/escalated-flutter/actions/workflows/run-tests.yml/badge.svg)](https://github.com/escalated-dev/escalated-flutter/actions/workflows/run-tests.yml) -[![Flutter](https://img.shields.io/badge/flutter-3.x-02569B?logo=flutter&logoColor=white)](https://flutter.dev/) -[![Dart](https://img.shields.io/badge/dart-3.x-0175C2?logo=dart&logoColor=white)](https://dart.dev/) -[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) -[![Views](https://hits.sh/github.com/escalated-dev/escalated-flutter.svg?style=flat&label=views&color=007ec6)](https://hits.sh/github.com/escalated-dev/escalated-flutter/) - -A full-featured, embeddable support ticket UI for Flutter apps. Drop it into any Flutter project — get a complete customer-facing helpdesk with ticket management, knowledge base, guest access, and SLA tracking. Connects to the Escalated REST API. - -> **[escalated.dev](https://escalated.dev)** — Learn more, view demos, and compare Cloud vs Self-Hosted options. - -**One widget, full support experience.** Wrap your app with `EscalatedPlugin`, point it at your API, and every screen is ready — login, tickets, knowledge base, guest access. Customize colors, auth behavior, and locale with a single config object. +

+ Escalated +

+ +

Escalated for Flutter

+ +

+ Add a customer support area to your Flutter app.
+ Tickets, a knowledge base and guest access, talking to your Escalated backend's REST API. +

+ +

+ Website · + Docs · + Cloud · + Changelog +

+ +
+ +## What it does + + + + + + +
+

Every support screen, ready to route

+ Login, ticket list, ticket detail with replies and SLA timers, new ticket with attachments, and knowledge base screens you drop into your GoRouter tree. +
+

Fits your app instead of fighting it

+ Screens take colours from your app's ThemeData, light or dark, and auth hooks let you plug in the sign-in you already have. +
## Features -- **Ticket management** — Create, view, filter, and reply to support tickets with file attachments -- **Knowledge base** — Searchable article list with HTML rendering for self-service support -- **Guest tickets** — Ticket submission without an account, verified by an emailed code, with expiring per-ticket access -- **SLA tracking** — Real-time SLA countdown timers on ticket detail views -- **Satisfaction ratings** — Post-resolution CSAT ratings with star display -- **Auth hooks** — Override login, logout, register, and token retrieval to integrate with your existing auth -- **Riverpod state management** — Auth, tickets, knowledge base, and theme providers out of the box -- **GoRouter-compatible** — Drop screens into your existing GoRouter navigation tree -- **Host theming** — Screens take the app's `ThemeData`, light or dark, so they match its brand -- **i18n** — Localized in English, Spanish, French (with Canadian French) and German, errors and dates included -- **Configurable** — API base URL, auth hooks, primary color, border radius, dark mode, default locale - -## Requirements - -- Flutter 3.16+ -- Dart 3.2+ -- A running Escalated backend (Laravel, Rails, Django, AdonisJS, or WordPress) + + + + + + + + + + + +
-## Quick Start - -Add the dependency to your `pubspec.yaml`: - -```yaml -dependencies: - escalated: - git: - url: https://github.com/escalated-dev/escalated-flutter.git -``` - -Wrap your app with `EscalatedPlugin`: - -```dart -import 'package:escalated/escalated.dart'; - -EscalatedPlugin( - config: EscalatedConfig( - apiBaseUrl: 'https://yourapp.com/support/api/v1/mobile', - ), - child: MaterialApp.router(...), -) -``` - -That's it — your app now has a full support ticket UI. - -## Configuration - -`EscalatedConfig` accepts the following options: - -```dart -EscalatedConfig( - apiBaseUrl: 'https://yourapp.com/support/api/v1/mobile', - authHooks: myAuthHooks, - primaryColor: Color(0xFF4F46E5), - borderRadius: 12.0, - darkMode: false, - defaultLocale: 'en', -) -``` +**Tickets** +- Create, view, filter and reply +- File attachments on tickets and replies +- SLA countdown timers on ticket detail -| Option | Type | Default | Description | -|--------|------|---------|-------------| -| `apiBaseUrl` | `String` | required | Base URL for the Escalated REST API | -| `authHooks` | `EscalatedAuthHooks?` | `null` | Custom auth hook overrides | -| `primaryColor` | `Color?` | `#4F46E5` | Primary action color for buttons and accents | -| `borderRadius` | `double?` | `8.0` | Border radius for cards, inputs, and buttons | -| `darkMode` | `bool?` | `false` | Enable dark theme | -| `defaultLocale` | `String?` | `'en'` | Default locale code (`en`, `es`, `fr`, `de`) | + -## Theming +**Self-service** +- Searchable knowledge base with HTML articles +- Post-resolution CSAT star ratings -Every screen and widget takes its colours from the app's `ThemeData`, so they -match the host without configuration: + -| Element | Comes from | -|---------|------------| -| Buttons, links, ticket references, selected chips | `colorScheme.primary` | -| New-ticket button | `floatingActionButtonTheme`, else `colorScheme.primary` / `onPrimary` | -| Cards, sheets, composer | `colorScheme.surface` and its `surfaceContainer*` tones | -| Body and secondary text | `colorScheme.onSurface`, `onSurfaceVariant` | -| Borders | `colorScheme.outlineVariant` | -| Errors | `colorScheme.error` / `onError` | +**Guest access** +- Tickets without an account +- Emailed code, expiring per-ticket access -Status, priority and SLA badges keep fixed colours (`AppColors.statusColor`, -`priorityColor`, `slaRed`...), since the colour carries the meaning. -`EscalatedConfig.primaryColor` and `borderRadius` feed `AppTheme` and -`themeProvider` for apps that build their theme from Escalated's; they do not -override the app's own theme. +
-## Available Screens +**Authentication** +- Override login, logout, register and token +- Built-in client with secure token storage -| Screen | Description | -|--------|-------------| -| `LoginScreen` | Email/password login form | -| `RegisterScreen` | New account registration | -| `TicketListScreen` | Paginated ticket list with status filters | -| `CreateTicketScreen` | New ticket form with file attachments | -| `TicketDetailScreen` | Full ticket thread with replies and metadata | -| `KBListScreen` | Knowledge base article listing | -| `KBArticleScreen` | Single article view with HTML rendering | -| `GuestCreateScreen` | Guest ticket submission with email verification | -| `GuestTicketScreen` | Guest ticket view by reference, using the stored access grant | -| `GuestLookupScreen` | Find a guest ticket by reference and verified email; renews access | -| `SettingsScreen` | User preferences and locale selection | -| `TicketFiltersScreen` | Advanced ticket filter controls | + -## Available Widgets +**Flutter integration** +- Riverpod providers for auth, tickets, KB, theme +- GoRouter-compatible screens -| Widget | Description | -|--------|-------------| -| `StatusBadge` | Ticket status indicator | -| `PriorityBadge` | Priority level indicator | -| `SlaTimer` | SLA countdown display | -| `AttachmentList` | File attachment display | -| `FileDropzone` | Drag-and-drop file upload | -| `SatisfactionRating` | Star rating display and input | -| `ReplyThread` | Chronological message thread | -| `ReplyComposer` | Reply text input with attachments | -| `EmptyState` | Placeholder for empty lists | -| `LoadingShimmer` | Shimmer loading placeholder | -| `ErrorView` | Error state with retry action | + -## Guest access +**Look and language** +- Takes your app's ThemeData, light or dark +- English, Spanish, French, Canadian French, German +- Configurable colour, radius, locale and API URL -Guest tickets need the guest to prove they can read their mailbox. The server -emails an eight-digit code, the app sends it back with the ticket (or with a -lookup), and the server answers with an expiring access grant for that ticket. -`GuestAccessService` runs this flow and keeps each grant in the device's secure -storage, keyed by ticket reference. Grants never appear in routes or copied -links; guest routes take the ticket reference (`/guest/ESC-00042`). +
-When a grant runs out or the server refuses it, `GuestTicketScreen` asks the -guest to verify again and `GuestLookupScreen` issues a fresh one. A 429 is -reported with the server's `Retry-After`. +

Every feature in detail

-This needs a backend with verified guest access (escalated-laravel 1.9+, -escalated-phoenix 0.2+). **Upgrading from 1.x:** permanent guest tokens and -links built from them no longer work. Add a route for `/guest/lookup` before -`/guest/:reference`, and see [docs/guest-access.md](docs/guest-access.md) for -the API changes. +

+ Flutter 3.16+ + Dart 3.2+ + Riverpod +

-## Providers +## Quick start -Escalated uses Riverpod for state management. The main providers are: +Add the package to `pubspec.yaml`: -| Provider | Description | -|----------|-------------| -| `authProvider` | Authentication state, login/logout/register actions | -| `ticketsProvider` | Ticket list, creation, replies, and filtering | -| `kbProvider` | Knowledge base articles and search | -| `guestTicketProvider` | A guest ticket opened with its stored access grant | -| `themeProvider` | Theme configuration (colors, dark mode, locale) | - -### Riverpod 3 and the legacy import - -These providers are built on `StateNotifier`. Riverpod 3 moved `StateNotifier` -and `StateNotifierProvider` out of the default export into -`package:flutter_riverpod/legacy.dart`, where they remain supported, so the -provider files import from there. - -They are legacy for a reason and the intended destination is -`Notifier`/`NotifierProvider`. That rewrite is deliberately not bundled with the -Riverpod 3 upgrade: it changes when initial state is produced (a `Notifier` -returns it from `build()` rather than a constructor, so constructor side effects -like `checkAuth()` have to be re-homed), and this package currently ships two -tests -- not enough of a net to catch a behaviour change in seven notifiers. -Widget coverage first, then the rewrite. - -## Models - -Nine models with full `fromJson` / `toJson` serialization are included for use with the REST API. All models map directly to the Escalated API response format. - -## Auth Hooks - -Auth hooks let you override default authentication behavior to integrate with your app's existing auth system: - -```dart -EscalatedConfig( - apiBaseUrl: 'https://yourapp.com/support/api/v1/mobile', - authHooks: EscalatedAuthHooks( - onLogin: (email, password) async { - // Your custom login logic - return yourAuthToken; - }, - onLogout: () async { - // Your custom logout logic - }, - onRegister: (name, email, password) async { - // Your custom registration logic - return yourAuthToken; - }, - getToken: () async { - // Return the current auth token - return await secureStorage.read(key: 'token'); - }, - ), -) -``` - -When no auth hooks are provided, Escalated uses its built-in Dio HTTP client with `flutter_secure_storage` for token persistence. - -## Internationalization - -Every string on screen goes through `AppLocalizations`, including the errors -the providers report. Register the delegate alongside Flutter's: - -```dart -MaterialApp( - localizationsDelegates: const [ - AppLocalizations.delegate, - GlobalMaterialLocalizations.delegate, - GlobalWidgetsLocalizations.delegate, - GlobalCupertinoLocalizations.delegate, - ], - supportedLocales: AppLocalizations.supportedLocales, -) +```yaml +dependencies: + escalated: + git: + url: https://github.com/escalated-dev/escalated-flutter.git ``` -| Code | Language | -|------|----------| -| `en` | English | -| `es` | Spanish | -| `fr` | French | -| `fr_CA` | Canadian French (overrides `fr` where usage differs, e.g. *courriel*) | -| `de` | German | - -A string is looked up in the regional table (`fr_CA`), then the language -(`fr`), then English. Dates follow the app locale too; they use intl's date -names, which `GlobalMaterialLocalizations` loads. - -Providers record a failure as a translation key (`failed_to_load_tickets`, -`unexpected_error`, ...) unless the server refused the request with a -`message` of its own (a 4xx), which is kept as the server wrote it. -`AppLocalizations.t` translates a key and passes other text through, so -`l10n.t(state.error!)` shows either correctly. - -## Dependencies - -| Package | Purpose | -|---------|---------| -| `dio` | HTTP client for API requests | -| `flutter_riverpod` | State management | -| `go_router` | Navigation and routing | -| `flutter_secure_storage` | Secure token persistence | -| `flutter_html` | HTML rendering for knowledge base articles | -| `shimmer` | Loading placeholder animations | -| `file_picker` | File selection for attachments | -| `image_picker` | Image selection for attachments | -| `intl` | Internationalization and date formatting | +Then wrap your app in `EscalatedPlugin` with your API base URL. The [installation guide](docs/installation.md) shows the full setup and every config option. -## Also Available For +## Learn more -| Framework | Package | Repository | -|-----------|---------|------------| -| Laravel | `escalated-dev/escalated-laravel` | [GitHub](https://github.com/escalated-dev/escalated-laravel) | -| Ruby on Rails | `escalated` (gem) | [GitHub](https://github.com/escalated-dev/escalated-rails) | -| Django | `escalated-django` | [GitHub](https://github.com/escalated-dev/escalated-django) | -| AdonisJS | `@escalated-dev/escalated-adonis` | [GitHub](https://github.com/escalated-dev/escalated-adonis) | -| WordPress | `escalated-wordpress` | [GitHub](https://github.com/escalated-dev/escalated-wordpress) | -| Vue UI | `@escalated-dev/escalated` | [GitHub](https://github.com/escalated-dev/escalated) | -| Flutter | `escalated` (Flutter) | [GitHub](https://github.com/escalated-dev/escalated-flutter) | -| React Native | `@escalated-dev/escalated-react-native` | [GitHub](https://github.com/escalated-dev/escalated-react-native) | +- [All features](docs/features.md) · [Installation and configuration](docs/installation.md) +- [Screens, widgets and models](docs/screens-and-widgets.md) · [State management](docs/state-management.md) +- [Authentication and guest access](docs/authentication.md) · [Guest access API changes](docs/guest-access.md) +- [Theming](docs/theming.md) · [Internationalization](docs/internationalization.md) +- [Escalated docs](https://escalated.dev/docs) -Same architecture, same REST API, same support experience — for every major framework. +Escalated is also available for [React Native](https://github.com/escalated-dev/escalated-react-native), and as a web helpdesk for [Laravel](https://github.com/escalated-dev/escalated-laravel), [Rails](https://github.com/escalated-dev/escalated-rails), [Django](https://github.com/escalated-dev/escalated-django), [NestJS](https://github.com/escalated-dev/escalated-nestjs), [AdonisJS](https://github.com/escalated-dev/escalated-adonis), [Symfony](https://github.com/escalated-dev/escalated-symfony), [Phoenix](https://github.com/escalated-dev/escalated-phoenix), [Go](https://github.com/escalated-dev/escalated-go), [.NET](https://github.com/escalated-dev/escalated-dotnet), [Spring](https://github.com/escalated-dev/escalated-spring), [WordPress](https://github.com/escalated-dev/escalated-wordpress) and [Filament](https://github.com/escalated-dev/escalated-filament). ## License -MIT - Copyright (c) Escalated.dev. See [LICENSE](LICENSE). +MIT. Copyright (c) Escalated.dev. See [LICENSE](LICENSE). diff --git a/docs/authentication.md b/docs/authentication.md new file mode 100644 index 0000000..c073650 --- /dev/null +++ b/docs/authentication.md @@ -0,0 +1,49 @@ +# Authentication and guest access + +## Auth Hooks + +Auth hooks let you override default authentication behavior to integrate with your app's existing auth system: + +```dart +EscalatedConfig( + apiBaseUrl: 'https://yourapp.com/support/api/v1/mobile', + authHooks: EscalatedAuthHooks( + onLogin: (email, password) async { + // Your custom login logic + return yourAuthToken; + }, + onLogout: () async { + // Your custom logout logic + }, + onRegister: (name, email, password) async { + // Your custom registration logic + return yourAuthToken; + }, + getToken: () async { + // Return the current auth token + return await secureStorage.read(key: 'token'); + }, + ), +) +``` + +When no auth hooks are provided, Escalated uses its built-in Dio HTTP client with `flutter_secure_storage` for token persistence. + +## Guest access + +Guest tickets need the guest to prove they can read their mailbox. The server +emails an eight-digit code, the app sends it back with the ticket (or with a +lookup), and the server answers with an expiring access grant for that ticket. +`GuestAccessService` runs this flow and keeps each grant in the device's secure +storage, keyed by ticket reference. Grants never appear in routes or copied +links; guest routes take the ticket reference (`/guest/ESC-00042`). + +When a grant runs out or the server refuses it, `GuestTicketScreen` asks the +guest to verify again and `GuestLookupScreen` issues a fresh one. A 429 is +reported with the server's `Retry-After`. + +This needs a backend with verified guest access (escalated-laravel 1.9+, +escalated-phoenix 0.2+). **Upgrading from 1.x:** permanent guest tokens and +links built from them no longer work. Add a route for `/guest/lookup` before +`/guest/:reference`, and see [docs/guest-access.md](guest-access.md) for +the API changes. diff --git a/docs/features.md b/docs/features.md new file mode 100644 index 0000000..1b8b28b --- /dev/null +++ b/docs/features.md @@ -0,0 +1,15 @@ +# Features + +## Features + +- **Ticket management** — Create, view, filter, and reply to support tickets with file attachments +- **Knowledge base** — Searchable article list with HTML rendering for self-service support +- **Guest tickets** — Ticket submission without an account, verified by an emailed code, with expiring per-ticket access +- **SLA tracking** — Real-time SLA countdown timers on ticket detail views +- **Satisfaction ratings** — Post-resolution CSAT ratings with star display +- **Auth hooks** — Override login, logout, register, and token retrieval to integrate with your existing auth +- **Riverpod state management** — Auth, tickets, knowledge base, and theme providers out of the box +- **GoRouter-compatible** — Drop screens into your existing GoRouter navigation tree +- **Host theming** — Screens take the app's `ThemeData`, light or dark, so they match its brand +- **i18n** — Localized in English, Spanish, French (with Canadian French) and German, errors and dates included +- **Configurable** — API base URL, auth hooks, primary color, border radius, dark mode, default locale diff --git a/docs/installation.md b/docs/installation.md new file mode 100644 index 0000000..7b689e7 --- /dev/null +++ b/docs/installation.md @@ -0,0 +1,71 @@ +# Installation and configuration + +## Requirements + +- Flutter 3.16+ +- Dart 3.2+ +- A running Escalated backend (Laravel, Rails, Django, AdonisJS, or WordPress) + +## Quick Start + +Add the dependency to your `pubspec.yaml`: + +```yaml +dependencies: + escalated: + git: + url: https://github.com/escalated-dev/escalated-flutter.git +``` + +Wrap your app with `EscalatedPlugin`: + +```dart +import 'package:escalated/escalated.dart'; + +EscalatedPlugin( + config: EscalatedConfig( + apiBaseUrl: 'https://yourapp.com/support/api/v1/mobile', + ), + child: MaterialApp.router(...), +) +``` + +That's it — your app now has a full support ticket UI. + +## Configuration + +`EscalatedConfig` accepts the following options: + +```dart +EscalatedConfig( + apiBaseUrl: 'https://yourapp.com/support/api/v1/mobile', + authHooks: myAuthHooks, + primaryColor: Color(0xFF4F46E5), + borderRadius: 12.0, + darkMode: false, + defaultLocale: 'en', +) +``` + +| Option | Type | Default | Description | +|--------|------|---------|-------------| +| `apiBaseUrl` | `String` | required | Base URL for the Escalated REST API | +| `authHooks` | `EscalatedAuthHooks?` | `null` | Custom auth hook overrides | +| `primaryColor` | `Color?` | `#4F46E5` | Primary action color for buttons and accents | +| `borderRadius` | `double?` | `8.0` | Border radius for cards, inputs, and buttons | +| `darkMode` | `bool?` | `false` | Enable dark theme | +| `defaultLocale` | `String?` | `'en'` | Default locale code (`en`, `es`, `fr`, `de`) | + +## Dependencies + +| Package | Purpose | +|---------|---------| +| `dio` | HTTP client for API requests | +| `flutter_riverpod` | State management | +| `go_router` | Navigation and routing | +| `flutter_secure_storage` | Secure token persistence | +| `flutter_html` | HTML rendering for knowledge base articles | +| `shimmer` | Loading placeholder animations | +| `file_picker` | File selection for attachments | +| `image_picker` | Image selection for attachments | +| `intl` | Internationalization and date formatting | diff --git a/docs/internationalization.md b/docs/internationalization.md new file mode 100644 index 0000000..a4e65ab --- /dev/null +++ b/docs/internationalization.md @@ -0,0 +1,36 @@ +# Internationalization + +## Internationalization + +Every string on screen goes through `AppLocalizations`, including the errors +the providers report. Register the delegate alongside Flutter's: + +```dart +MaterialApp( + localizationsDelegates: const [ + AppLocalizations.delegate, + GlobalMaterialLocalizations.delegate, + GlobalWidgetsLocalizations.delegate, + GlobalCupertinoLocalizations.delegate, + ], + supportedLocales: AppLocalizations.supportedLocales, +) +``` + +| Code | Language | +|------|----------| +| `en` | English | +| `es` | Spanish | +| `fr` | French | +| `fr_CA` | Canadian French (overrides `fr` where usage differs, e.g. *courriel*) | +| `de` | German | + +A string is looked up in the regional table (`fr_CA`), then the language +(`fr`), then English. Dates follow the app locale too; they use intl's date +names, which `GlobalMaterialLocalizations` loads. + +Providers record a failure as a translation key (`failed_to_load_tickets`, +`unexpected_error`, ...) unless the server refused the request with a +`message` of its own (a 4xx), which is kept as the server wrote it. +`AppLocalizations.t` translates a key and passes other text through, so +`l10n.t(state.error!)` shows either correctly. diff --git a/docs/screens-and-widgets.md b/docs/screens-and-widgets.md new file mode 100644 index 0000000..f2170e5 --- /dev/null +++ b/docs/screens-and-widgets.md @@ -0,0 +1,38 @@ +# Screens, widgets and models + +## Available Screens + +| Screen | Description | +|--------|-------------| +| `LoginScreen` | Email/password login form | +| `RegisterScreen` | New account registration | +| `TicketListScreen` | Paginated ticket list with status filters | +| `CreateTicketScreen` | New ticket form with file attachments | +| `TicketDetailScreen` | Full ticket thread with replies and metadata | +| `KBListScreen` | Knowledge base article listing | +| `KBArticleScreen` | Single article view with HTML rendering | +| `GuestCreateScreen` | Guest ticket submission with email verification | +| `GuestTicketScreen` | Guest ticket view by reference, using the stored access grant | +| `GuestLookupScreen` | Find a guest ticket by reference and verified email; renews access | +| `SettingsScreen` | User preferences and locale selection | +| `TicketFiltersScreen` | Advanced ticket filter controls | + +## Available Widgets + +| Widget | Description | +|--------|-------------| +| `StatusBadge` | Ticket status indicator | +| `PriorityBadge` | Priority level indicator | +| `SlaTimer` | SLA countdown display | +| `AttachmentList` | File attachment display | +| `FileDropzone` | Drag-and-drop file upload | +| `SatisfactionRating` | Star rating display and input | +| `ReplyThread` | Chronological message thread | +| `ReplyComposer` | Reply text input with attachments | +| `EmptyState` | Placeholder for empty lists | +| `LoadingShimmer` | Shimmer loading placeholder | +| `ErrorView` | Error state with retry action | + +## Models + +Nine models with full `fromJson` / `toJson` serialization are included for use with the REST API. All models map directly to the Escalated API response format. diff --git a/docs/state-management.md b/docs/state-management.md new file mode 100644 index 0000000..ae8cc73 --- /dev/null +++ b/docs/state-management.md @@ -0,0 +1,28 @@ +# State management + +## Providers + +Escalated uses Riverpod for state management. The main providers are: + +| Provider | Description | +|----------|-------------| +| `authProvider` | Authentication state, login/logout/register actions | +| `ticketsProvider` | Ticket list, creation, replies, and filtering | +| `kbProvider` | Knowledge base articles and search | +| `guestTicketProvider` | A guest ticket opened with its stored access grant | +| `themeProvider` | Theme configuration (colors, dark mode, locale) | + +### Riverpod 3 and the legacy import + +These providers are built on `StateNotifier`. Riverpod 3 moved `StateNotifier` +and `StateNotifierProvider` out of the default export into +`package:flutter_riverpod/legacy.dart`, where they remain supported, so the +provider files import from there. + +They are legacy for a reason and the intended destination is +`Notifier`/`NotifierProvider`. That rewrite is deliberately not bundled with the +Riverpod 3 upgrade: it changes when initial state is produced (a `Notifier` +returns it from `build()` rather than a constructor, so constructor side effects +like `checkAuth()` have to be re-homed), and this package currently ships two +tests -- not enough of a net to catch a behaviour change in seven notifiers. +Widget coverage first, then the rewrite. diff --git a/docs/theming.md b/docs/theming.md new file mode 100644 index 0000000..70ba596 --- /dev/null +++ b/docs/theming.md @@ -0,0 +1,21 @@ +# Theming + +## Theming + +Every screen and widget takes its colours from the app's `ThemeData`, so they +match the host without configuration: + +| Element | Comes from | +|---------|------------| +| Buttons, links, ticket references, selected chips | `colorScheme.primary` | +| New-ticket button | `floatingActionButtonTheme`, else `colorScheme.primary` / `onPrimary` | +| Cards, sheets, composer | `colorScheme.surface` and its `surfaceContainer*` tones | +| Body and secondary text | `colorScheme.onSurface`, `onSurfaceVariant` | +| Borders | `colorScheme.outlineVariant` | +| Errors | `colorScheme.error` / `onError` | + +Status, priority and SLA badges keep fixed colours (`AppColors.statusColor`, +`priorityColor`, `slaRed`...), since the colour carries the meaning. +`EscalatedConfig.primaryColor` and `borderRadius` feed `AppTheme` and +`themeProvider` for apps that build their theme from Escalated's; they do not +override the app's own theme.