dvDocsTheme function
The ThemeData the documentation site is drawn with.
A real Material theme rather than a bare ThemeData, because the pages the framework hands it -- the not-found page above all -- take their text styles and their canvas from the theme, and a page with no text style comes out in Flutter's fallback error colours.
Implementation
ThemeData dvDocsTheme(Brightness brightness) {
final DVDocsTheme docs = brightness == .dark
? const DVDocsTheme.dark()
: const DVDocsTheme.light();
final DVDocsStyle style = DVDocsStyle(docs);
return ThemeData(
brightness: brightness,
// The accent the stylesheet already had, so the few Material bits the
// shared pages draw from it land in the same palette rather than in a
// default purple nothing else on the site has seen.
colorScheme: ColorScheme.fromSeed(
seedColor: docs.warn,
brightness: brightness,
),
scaffoldBackgroundColor: docs.canvas,
canvasColor: docs.canvas,
dividerColor: docs.rule,
textTheme: TextTheme(
bodySmall: style.source,
bodyMedium: style.body,
bodyLarge: style.body,
titleLarge: style.title,
titleMedium: style.heading(2),
titleSmall: style.heading(3),
headlineSmall: style.heading(1),
headlineMedium: style.title,
),
extensions: <ThemeExtension<dynamic>>[docs],
);
}