Centralized design tokens, theming, and UI primitives used across the app.
- Color roles follow Material 3
ColorScheme. - Use
context.colorsandcontext.textStyleshelpers to avoid hardcoded colors and text styles. - Brand tokens are mapped into the
ColorScheme(light/dark) and exported viaAppTheme.light()andAppTheme.dark().
DSGradients.brandAccent: Orange → Pink brand gradient for accents.DSGradients.surfaceGloss(ColorScheme): subtle surface gradient for elevated surfaces.
Use AsyncStateOverlay for long-running operations to avoid modal spinners:
return Stack(
children: [
content,
AsyncStateOverlay(visible: state.isLoading, label: 'Carregando...'),
],
);
Use InfiniteList<T> for mobile-friendly infinite scrolling with optional pull-to-refresh:
InfiniteList<Item>(
items: state.items,
itemBuilder: (ctx, item, i) => ItemTile(item: item),
onLoadMore: cubit.loadMore,
onRefresh: cubit.refresh,
isLoadingMore: state.isLoadingMore,
hasMore: state.hasMore,
errorText: state.errorMessage,
)
- Do not use
Color(...)orColors.*in feature code. - Always consume theme via
Theme.of(context)or the provided context helpers.
-
Replace hardcoded colors and text styles
- Search for
Colors.andColor(in your feature. - Replace color usage with
context.colors.*roles and text withcontext.textStyles. - For surfaces, prefer
colors.surfaceorcolors.surfaceVariant; for content, usecolors.onSurfaceorcolors.onSurfaceVariant.
- Search for
-
Adopt design-system primitives
- Replace ad-hoc cards/buttons/inputs with system_design components (e.g.,
CardShell, DS buttons, DS inputs). - For long operations, wrap your screen in a
Stackand useAsyncStateOverlay(visible: ...)instead of modal spinners.
- Replace ad-hoc cards/buttons/inputs with system_design components (e.g.,
-
Infinite scrolling lists
- Use
InfiniteList<T>to implement pagination and pull-to-refresh. - Make sure your Cubit exposes
isLoadingMore,hasMore, and guards against duplicate requests.
- Use
-
Gradients and accents
- Use
DSGradients.brandAccent(Orange→Pink) for accents where appropriate. - Avoid inlining gradient definitions in features.
- Use
-
Theme source of truth
- Ensure your app obtains ThemeData from system_design
AppTheme.light()/dark(). - Do not construct custom ThemeData in feature packages.
- Ensure your app obtains ThemeData from system_design
-
Linting (recommended)
- Add a lint that forbids
Color(...)in features. Allow only Theme/DS helpers. - Add CI checks to deny merging if violations occur.
- Add a lint that forbids