Skip to content

Theming and strings

The package draws itself from your ThemeData’s colour scheme. For your own design, put a CrmTheme in the theme’s extensions: its accent (buttons, the user’s bubbles, the send button), tints, lines, spacing, corners, type and motion. Start from your scheme and change what you need:

ThemeData(
colorScheme: scheme,
extensions: [
CrmTheme.fromScheme(scheme).copyWith(
accent: const Color(0xFF8F4C00),
onAccent: Colors.white,
radii: const CrmRadii(row: 20, card: 28),
),
],
)

Surfaces, text and error colours always come from the colour scheme. Check your accent against your surfaces: the package’s own screens meet the tap-target, label and contrast guidelines with its defaults.

The screens follow the platform: on iOS a chevron, Cupertino spinners, bouncing scroll and page sheets with a grabber; on Android Material 3 sheets and the predictive back gesture. They follow ThemeData.platform, so you can show either look on one phone.

Add CrmLocalizations.delegate to your localizations delegates. The package’s own words are English, and English is used when no delegate is installed. Wherever a string names your app, it says CrmConfig.productName (“Talk to the Northwind team”).

Two kinds of words reach your users, by different ways:

  • What your team writes (messages, articles, the help bot’s questions) comes from PurrCRM already in the user’s language. The package sends the phone’s language (CrmConfig.languageTag) with every request, and picks nothing itself. See Languages.
  • The package’s own words (its buttons, its errors) are in its ARB files, which crmSupportedLocales lists: English for now.

Give your own CrmLocalizations to CrmStringsDelegate, in place of CrmLocalizations.delegate:

import 'package:crm_sdk/l10n/crm_localizations_en.dart';
class CrmWelsh extends CrmLocalizationsEn {
CrmWelsh() : super('cy');
@override
String get helpCenterTitle => 'Erthyglau help';
// ...every string, or the ones you have; the rest stay English.
}
MaterialApp(
supportedLocales: const [Locale('en'), Locale('cy')],
localizationsDelegates: [
CrmStringsDelegate(strings: {'cy': CrmWelsh()}),
GlobalMaterialLocalizations.delegate,
// ...
],
)

A language tag alone (cy) serves each of its regions (cy-GB); the most precise one that fits the phone wins. CrmStringsDelegate(supportedLocales: [...]) limits the package to fewer languages.