import 'package:flutter/foundation.dart'; import 'package:flutter/painting.dart'; export 'design_density.dart'; /// How the chat transcript draws a conversation. Each design picks one; the /// transcript widgets branch on it, never on the design itself. enum TranscriptStyle { /// The operator's turns as bubbles on the trailing side, the agent's /// answers on the page and its activity as a one-line button (Classic). bubbles, /// A CLI's prompt line, glyph-led tool lines and bracketed injected /// prompts, every turn starting at the same edge (Terminal). prompt, /// A typeset page: the operator's turns as indented block quotes under a /// small-caps label, answers as prose, activity as a muted marginal note /// and injected prompts as italic editorial notes (Paper). manuscript, } /// How the chat composer frames its writing area. enum ComposerStyle { /// A floating pill (frosted, or flat and framed under a flat design) in /// the design's corners, with a focus ring along its edge. pill, /// An open writing area on the page with a rule beneath it that takes /// the accent while the field has focus. underline, } /// How a list (AppListRow) marks the row that is open. Every style but /// [glow] keeps the leading bar in the row's accent; they differ in the fill /// and frame. enum SelectedRowStyle { /// Material's tonal `secondaryContainer` fill (Classic). tonal, /// The accent washed over the page, stronger than a tinted row, inside a /// hairline frame in the accent (Terminal). framed, /// The accent washed over the page, without a frame (Paper). washed, /// A brighter glass slab inset in the list, in the design's corners, with /// a soft glow ring in the accent instead of a leading bar (Glass). glow, } /// The typography of reading text: chat messages, markdown answers and /// documents. Interface text (navigation, buttons, chips, labels, metadata) /// keeps the theme's own text roles. @immutable class ReadingType { const ReadingType({ this.family, this.height, this.measure, this.scale = 1, this.figureWidth = 0.5, this.paragraphGap = 0.9, }); /// The reading face; null keeps the theme's body face. final String? family; /// The line height as a multiple of the font size; null keeps the role's. final double? height; /// The widest reading column in `ch` (widths of the digit zero in the /// reading face); null keeps the app's fixed reading width. final double? measure; /// The reading size relative to the theme's `bodyLarge`. final double scale; /// The width of the reading face's digit zero, in ems: what one `ch` of /// [measure] is worth (half an em for Source Serif's figures). final double figureWidth; /// The gap between two paragraphs of an answer, in lines of reading text /// (before text scaling): about a line by default, less for a dense design. final double paragraphGap; /// [base] in the reading face, size and line height. TextStyle? apply(TextStyle? base) { if (base == null) return null; if (family == null && height == null && scale == 1) return base; final size = base.fontSize; return base.copyWith( fontFamily: family, // The interface face stays as the fallback, so a glyph the reading // face lacks still draws from a bundled family. fontFamilyFallback: family == null || base.fontFamily == null ? null : [base.fontFamily!, ...?base.fontFamilyFallback], fontSize: size == null ? null : size * scale, height: height, letterSpacing: family == null ? null : 0, ); } @override bool operator ==(Object other) => other is ReadingType && other.family == family && other.height == height && other.measure == measure && other.scale == scale && other.figureWidth == figureWidth && other.paragraphGap == paragraphGap; @override int get hashCode => Object.hash(family, height, measure, scale, figureWidth, paragraphGap); }