|  | @@ -1,21 +1,11 @@
 | 
	
		
			
			| 1 |  | -// Copyright (c) 2018, the Zefyr project authors.  Please see the AUTHORS file
 | 
	
		
			
			| 2 |  | -// for details. All rights reserved. Use of this source code is governed by a
 | 
	
		
			
			| 3 |  | -// BSD-style license that can be found in the LICENSE file.
 | 
	
		
			
			| 4 |  | -
 | 
	
		
			
			| 5 | 1 |  import 'package:flutter/material.dart';
 | 
	
		
			
			| 6 |  | -import 'package:flutter/widgets.dart';
 | 
	
		
			
			| 7 |  | -import 'package:meta/meta.dart';
 | 
	
		
			
			| 8 | 2 |  
 | 
	
		
			
			| 9 | 3 |  /// Applies a Zefyr editor theme to descendant widgets.
 | 
	
		
			
			| 10 | 4 |  ///
 | 
	
		
			
			| 11 |  | -/// Describes colors and typographic styles for an editor.
 | 
	
		
			
			|  | 5 | +/// Describes colors and typographic styles.
 | 
	
		
			
			| 12 | 6 |  ///
 | 
	
		
			
			| 13 | 7 |  /// Descendant widgets obtain the current theme's [ZefyrThemeData] object using
 | 
	
		
			
			| 14 | 8 |  /// [ZefyrTheme.of].
 | 
	
		
			
			| 15 |  | -///
 | 
	
		
			
			| 16 |  | -/// See also:
 | 
	
		
			
			| 17 |  | -///
 | 
	
		
			
			| 18 |  | -///   * [ZefyrThemeData], which describes actual configuration of a theme.
 | 
	
		
			
			| 19 | 9 |  class ZefyrTheme extends InheritedWidget {
 | 
	
		
			
			| 20 | 10 |    final ZefyrThemeData data;
 | 
	
		
			
			| 21 | 11 |  
 | 
	
	
		
			
			|  | @@ -51,233 +41,454 @@ class ZefyrTheme extends InheritedWidget {
 | 
	
		
			
			| 51 | 41 |    }
 | 
	
		
			
			| 52 | 42 |  }
 | 
	
		
			
			| 53 | 43 |  
 | 
	
		
			
			| 54 |  | -/// Holds colors and typography styles for [ZefyrEditor].
 | 
	
		
			
			|  | 44 | +/// Holds colors and typography values for a Zefyr design theme.
 | 
	
		
			
			|  | 45 | +///
 | 
	
		
			
			|  | 46 | +/// To obtain the current theme, use [ZefyrTheme.of].
 | 
	
		
			
			|  | 47 | +@immutable
 | 
	
		
			
			| 55 | 48 |  class ZefyrThemeData {
 | 
	
		
			
			| 56 |  | -  final TextStyle boldStyle;
 | 
	
		
			
			| 57 |  | -  final TextStyle italicStyle;
 | 
	
		
			
			| 58 |  | -  final TextStyle linkStyle;
 | 
	
		
			
			| 59 |  | -  final StyleTheme paragraphTheme;
 | 
	
		
			
			| 60 |  | -  final HeadingTheme headingTheme;
 | 
	
		
			
			| 61 |  | -  final BlockTheme blockTheme;
 | 
	
		
			
			| 62 |  | -  final Color selectionColor;
 | 
	
		
			
			| 63 |  | -  final Color cursorColor;
 | 
	
		
			
			| 64 |  | -
 | 
	
		
			
			| 65 |  | -  /// Size of indentation for blocks.
 | 
	
		
			
			| 66 |  | -  final double indentSize;
 | 
	
		
			
			| 67 |  | -  final ZefyrToolbarTheme toolbarTheme;
 | 
	
		
			
			|  | 49 | +  /// Default theme used for document lines in Zefyr editor.
 | 
	
		
			
			|  | 50 | +  ///
 | 
	
		
			
			|  | 51 | +  /// Defines text style and spacing for regular paragraphs of text with
 | 
	
		
			
			|  | 52 | +  /// no style attributes applied.
 | 
	
		
			
			|  | 53 | +  final LineTheme defaultLineTheme;
 | 
	
		
			
			| 68 | 54 |  
 | 
	
		
			
			|  | 55 | +  /// The text styles, padding and decorations used to render text with
 | 
	
		
			
			|  | 56 | +  /// different style attributes.
 | 
	
		
			
			|  | 57 | +  final AttributeTheme attributeTheme;
 | 
	
		
			
			|  | 58 | +
 | 
	
		
			
			|  | 59 | +  /// The width of indentation used for blocks (lists, quotes, code).
 | 
	
		
			
			|  | 60 | +  final double indentWidth;
 | 
	
		
			
			|  | 61 | +
 | 
	
		
			
			|  | 62 | +  /// The colors used to render editor toolbar.
 | 
	
		
			
			|  | 63 | +  final ToolbarTheme toolbarTheme;
 | 
	
		
			
			|  | 64 | +
 | 
	
		
			
			|  | 65 | +  /// Creates a [ZefyrThemeData] given a set of exact values.
 | 
	
		
			
			|  | 66 | +  const ZefyrThemeData({
 | 
	
		
			
			|  | 67 | +    this.defaultLineTheme,
 | 
	
		
			
			|  | 68 | +    this.attributeTheme,
 | 
	
		
			
			|  | 69 | +    this.indentWidth,
 | 
	
		
			
			|  | 70 | +    this.toolbarTheme,
 | 
	
		
			
			|  | 71 | +  });
 | 
	
		
			
			|  | 72 | +
 | 
	
		
			
			|  | 73 | +  /// The default editor theme.
 | 
	
		
			
			| 69 | 74 |    factory ZefyrThemeData.fallback(BuildContext context) {
 | 
	
		
			
			| 70 |  | -    final ThemeData themeData = Theme.of(context);
 | 
	
		
			
			| 71 | 75 |      final defaultStyle = DefaultTextStyle.of(context);
 | 
	
		
			
			| 72 |  | -    final paragraphStyle = defaultStyle.style.copyWith(
 | 
	
		
			
			| 73 |  | -      fontSize: 16.0,
 | 
	
		
			
			| 74 |  | -      height: 1.25,
 | 
	
		
			
			| 75 |  | -      fontWeight: FontWeight.normal,
 | 
	
		
			
			| 76 |  | -      color: Colors.grey.shade800,
 | 
	
		
			
			|  | 76 | +    final defaultLineTheme = LineTheme(
 | 
	
		
			
			|  | 77 | +      textStyle: defaultStyle.style.copyWith(
 | 
	
		
			
			|  | 78 | +        fontSize: 16.0,
 | 
	
		
			
			|  | 79 | +        height: 1.3,
 | 
	
		
			
			|  | 80 | +      ),
 | 
	
		
			
			|  | 81 | +      padding: EdgeInsets.symmetric(vertical: 8.0),
 | 
	
		
			
			| 77 | 82 |      );
 | 
	
		
			
			| 78 |  | -    final padding = const EdgeInsets.only(bottom: 16.0);
 | 
	
		
			
			| 79 |  | -    final boldStyle = TextStyle(fontWeight: FontWeight.bold);
 | 
	
		
			
			| 80 |  | -    final italicStyle = TextStyle(fontStyle: FontStyle.italic);
 | 
	
		
			
			| 81 |  | -    final linkStyle =
 | 
	
		
			
			| 82 |  | -        TextStyle(color: Colors.blue, decoration: TextDecoration.underline);
 | 
	
		
			
			| 83 |  | -
 | 
	
		
			
			| 84 | 83 |      return ZefyrThemeData(
 | 
	
		
			
			| 85 |  | -      boldStyle: boldStyle,
 | 
	
		
			
			| 86 |  | -      italicStyle: italicStyle,
 | 
	
		
			
			| 87 |  | -      linkStyle: linkStyle,
 | 
	
		
			
			| 88 |  | -      paragraphTheme: StyleTheme(textStyle: paragraphStyle, padding: padding),
 | 
	
		
			
			| 89 |  | -      headingTheme: HeadingTheme.fallback(),
 | 
	
		
			
			| 90 |  | -      blockTheme: BlockTheme.fallback(themeData),
 | 
	
		
			
			| 91 |  | -      selectionColor: Colors.lightBlueAccent.shade100,
 | 
	
		
			
			| 92 |  | -      cursorColor: Colors.black,
 | 
	
		
			
			| 93 |  | -      indentSize: 16.0,
 | 
	
		
			
			| 94 |  | -      toolbarTheme: ZefyrToolbarTheme.fallback(context),
 | 
	
		
			
			|  | 84 | +      defaultLineTheme: defaultLineTheme,
 | 
	
		
			
			|  | 85 | +      attributeTheme: AttributeTheme.fallback(context, defaultLineTheme),
 | 
	
		
			
			|  | 86 | +      indentWidth: 16.0,
 | 
	
		
			
			|  | 87 | +      toolbarTheme: ToolbarTheme.fallback(context),
 | 
	
		
			
			| 95 | 88 |      );
 | 
	
		
			
			| 96 | 89 |    }
 | 
	
		
			
			| 97 | 90 |  
 | 
	
		
			
			| 98 |  | -  const ZefyrThemeData({
 | 
	
		
			
			| 99 |  | -    this.boldStyle,
 | 
	
		
			
			| 100 |  | -    this.italicStyle,
 | 
	
		
			
			| 101 |  | -    this.linkStyle,
 | 
	
		
			
			| 102 |  | -    this.paragraphTheme,
 | 
	
		
			
			| 103 |  | -    this.headingTheme,
 | 
	
		
			
			| 104 |  | -    this.blockTheme,
 | 
	
		
			
			| 105 |  | -    this.selectionColor,
 | 
	
		
			
			| 106 |  | -    this.cursorColor,
 | 
	
		
			
			| 107 |  | -    this.indentSize,
 | 
	
		
			
			| 108 |  | -    this.toolbarTheme,
 | 
	
		
			
			| 109 |  | -  });
 | 
	
		
			
			| 110 |  | -
 | 
	
		
			
			|  | 91 | +  /// Creates a copy of this theme but with the given fields replaced with
 | 
	
		
			
			|  | 92 | +  /// the new values.
 | 
	
		
			
			| 111 | 93 |    ZefyrThemeData copyWith({
 | 
	
		
			
			| 112 |  | -    TextStyle textStyle,
 | 
	
		
			
			| 113 |  | -    TextStyle boldStyle,
 | 
	
		
			
			| 114 |  | -    TextStyle italicStyle,
 | 
	
		
			
			| 115 |  | -    TextStyle linkStyle,
 | 
	
		
			
			| 116 |  | -    StyleTheme paragraphTheme,
 | 
	
		
			
			| 117 |  | -    HeadingTheme headingTheme,
 | 
	
		
			
			| 118 |  | -    BlockTheme blockTheme,
 | 
	
		
			
			| 119 |  | -    Color selectionColor,
 | 
	
		
			
			| 120 |  | -    Color cursorColor,
 | 
	
		
			
			| 121 |  | -    double indentSize,
 | 
	
		
			
			| 122 |  | -    ZefyrToolbarTheme toolbarTheme,
 | 
	
		
			
			|  | 94 | +    LineTheme defaultLineTheme,
 | 
	
		
			
			|  | 95 | +    AttributeTheme attributeTheme,
 | 
	
		
			
			|  | 96 | +    double indentWidth,
 | 
	
		
			
			|  | 97 | +    ToolbarTheme toolbarTheme,
 | 
	
		
			
			| 123 | 98 |    }) {
 | 
	
		
			
			| 124 | 99 |      return ZefyrThemeData(
 | 
	
		
			
			| 125 |  | -      boldStyle: boldStyle ?? this.boldStyle,
 | 
	
		
			
			| 126 |  | -      italicStyle: italicStyle ?? this.italicStyle,
 | 
	
		
			
			| 127 |  | -      linkStyle: linkStyle ?? this.linkStyle,
 | 
	
		
			
			| 128 |  | -      paragraphTheme: paragraphTheme ?? this.paragraphTheme,
 | 
	
		
			
			| 129 |  | -      headingTheme: headingTheme ?? this.headingTheme,
 | 
	
		
			
			| 130 |  | -      blockTheme: blockTheme ?? this.blockTheme,
 | 
	
		
			
			| 131 |  | -      selectionColor: selectionColor ?? this.selectionColor,
 | 
	
		
			
			| 132 |  | -      cursorColor: cursorColor ?? this.cursorColor,
 | 
	
		
			
			| 133 |  | -      indentSize: indentSize ?? this.indentSize,
 | 
	
		
			
			|  | 100 | +      defaultLineTheme: defaultLineTheme ?? this.defaultLineTheme,
 | 
	
		
			
			|  | 101 | +      attributeTheme: attributeTheme ?? this.attributeTheme,
 | 
	
		
			
			|  | 102 | +      indentWidth: indentWidth ?? this.indentWidth,
 | 
	
		
			
			| 134 | 103 |        toolbarTheme: toolbarTheme ?? this.toolbarTheme,
 | 
	
		
			
			| 135 | 104 |      );
 | 
	
		
			
			| 136 | 105 |    }
 | 
	
		
			
			| 137 | 106 |  
 | 
	
		
			
			|  | 107 | +  /// Creates a new [ZefyrThemeData] where each property from this object has
 | 
	
		
			
			|  | 108 | +  /// been merged with the matching text style from the `other` object.
 | 
	
		
			
			| 138 | 109 |    ZefyrThemeData merge(ZefyrThemeData other) {
 | 
	
		
			
			|  | 110 | +    if (other == null) return this;
 | 
	
		
			
			| 139 | 111 |      return copyWith(
 | 
	
		
			
			| 140 |  | -      boldStyle: other.boldStyle,
 | 
	
		
			
			| 141 |  | -      italicStyle: other.italicStyle,
 | 
	
		
			
			| 142 |  | -      linkStyle: other.linkStyle,
 | 
	
		
			
			| 143 |  | -      paragraphTheme: other.paragraphTheme,
 | 
	
		
			
			| 144 |  | -      headingTheme: other.headingTheme,
 | 
	
		
			
			| 145 |  | -      blockTheme: other.blockTheme,
 | 
	
		
			
			| 146 |  | -      selectionColor: other.selectionColor,
 | 
	
		
			
			| 147 |  | -      cursorColor: other.cursorColor,
 | 
	
		
			
			| 148 |  | -      indentSize: other.indentSize,
 | 
	
		
			
			| 149 |  | -      toolbarTheme: other.toolbarTheme,
 | 
	
		
			
			|  | 112 | +      defaultLineTheme: defaultLineTheme?.merge(other.defaultLineTheme) ??
 | 
	
		
			
			|  | 113 | +          other.defaultLineTheme,
 | 
	
		
			
			|  | 114 | +      attributeTheme:
 | 
	
		
			
			|  | 115 | +          attributeTheme?.merge(other.attributeTheme) ?? other.attributeTheme,
 | 
	
		
			
			|  | 116 | +      indentWidth: other.indentWidth ?? indentWidth,
 | 
	
		
			
			|  | 117 | +      toolbarTheme:
 | 
	
		
			
			|  | 118 | +          toolbarTheme?.merge(other.toolbarTheme) ?? other.toolbarTheme,
 | 
	
		
			
			| 150 | 119 |      );
 | 
	
		
			
			| 151 | 120 |    }
 | 
	
		
			
			|  | 121 | +
 | 
	
		
			
			|  | 122 | +  @override
 | 
	
		
			
			|  | 123 | +  bool operator ==(other) {
 | 
	
		
			
			|  | 124 | +    if (other.runtimeType != runtimeType) return false;
 | 
	
		
			
			|  | 125 | +    final ZefyrThemeData otherData = other;
 | 
	
		
			
			|  | 126 | +    return (otherData.defaultLineTheme == defaultLineTheme) &&
 | 
	
		
			
			|  | 127 | +        (otherData.attributeTheme == attributeTheme) &&
 | 
	
		
			
			|  | 128 | +        (otherData.indentWidth == indentWidth) &&
 | 
	
		
			
			|  | 129 | +        (otherData.toolbarTheme == toolbarTheme);
 | 
	
		
			
			|  | 130 | +  }
 | 
	
		
			
			|  | 131 | +
 | 
	
		
			
			|  | 132 | +  @override
 | 
	
		
			
			|  | 133 | +  int get hashCode {
 | 
	
		
			
			|  | 134 | +    return hashList([
 | 
	
		
			
			|  | 135 | +      defaultLineTheme,
 | 
	
		
			
			|  | 136 | +      attributeTheme,
 | 
	
		
			
			|  | 137 | +      indentWidth,
 | 
	
		
			
			|  | 138 | +      toolbarTheme,
 | 
	
		
			
			|  | 139 | +    ]);
 | 
	
		
			
			|  | 140 | +  }
 | 
	
		
			
			| 152 | 141 |  }
 | 
	
		
			
			| 153 | 142 |  
 | 
	
		
			
			| 154 |  | -/// Theme for heading-styled lines of text.
 | 
	
		
			
			| 155 |  | -class HeadingTheme {
 | 
	
		
			
			| 156 |  | -  /// Style theme for level 1 headings.
 | 
	
		
			
			| 157 |  | -  final StyleTheme level1;
 | 
	
		
			
			|  | 143 | +/// Holds typography values for a document line in Zefyr editor.
 | 
	
		
			
			|  | 144 | +///
 | 
	
		
			
			|  | 145 | +/// Applicable for regular paragraphs, headings and lines within blocks
 | 
	
		
			
			|  | 146 | +/// (lists, quotes). Blocks may override some of these values using [BlockTheme].
 | 
	
		
			
			|  | 147 | +@immutable
 | 
	
		
			
			|  | 148 | +class LineTheme {
 | 
	
		
			
			|  | 149 | +  /// Default text style for a document line.
 | 
	
		
			
			|  | 150 | +  final TextStyle textStyle;
 | 
	
		
			
			| 158 | 151 |  
 | 
	
		
			
			| 159 |  | -  /// Style theme for level 2 headings.
 | 
	
		
			
			| 160 |  | -  final StyleTheme level2;
 | 
	
		
			
			|  | 152 | +  /// Additional space around a document line.
 | 
	
		
			
			|  | 153 | +  final EdgeInsets padding;
 | 
	
		
			
			| 161 | 154 |  
 | 
	
		
			
			| 162 |  | -  /// Style theme for level 3 headings.
 | 
	
		
			
			| 163 |  | -  final StyleTheme level3;
 | 
	
		
			
			|  | 155 | +  /// Creates a [LineTheme] given a set of exact values.
 | 
	
		
			
			|  | 156 | +  LineTheme({this.textStyle, this.padding})
 | 
	
		
			
			|  | 157 | +      : assert(textStyle != null),
 | 
	
		
			
			|  | 158 | +        assert(padding != null);
 | 
	
		
			
			|  | 159 | +
 | 
	
		
			
			|  | 160 | +  /// Creates a copy of this theme but with the given fields replaced with
 | 
	
		
			
			|  | 161 | +  /// the new values.
 | 
	
		
			
			|  | 162 | +  LineTheme copyWith({TextStyle textStyle, EdgeInsets padding}) {
 | 
	
		
			
			|  | 163 | +    return LineTheme(
 | 
	
		
			
			|  | 164 | +      textStyle: textStyle ?? this.textStyle,
 | 
	
		
			
			|  | 165 | +      padding: padding ?? this.padding,
 | 
	
		
			
			|  | 166 | +    );
 | 
	
		
			
			|  | 167 | +  }
 | 
	
		
			
			| 164 | 168 |  
 | 
	
		
			
			| 165 |  | -  HeadingTheme({
 | 
	
		
			
			| 166 |  | -    @required this.level1,
 | 
	
		
			
			| 167 |  | -    @required this.level2,
 | 
	
		
			
			| 168 |  | -    @required this.level3,
 | 
	
		
			
			|  | 169 | +  /// Creates a new [LineTheme] where each property from this object has
 | 
	
		
			
			|  | 170 | +  /// been merged with the matching property from the `other` object.
 | 
	
		
			
			|  | 171 | +  ///
 | 
	
		
			
			|  | 172 | +  /// Text style is merged using [TextStyle.merge] when this and other
 | 
	
		
			
			|  | 173 | +  /// theme have this value set.
 | 
	
		
			
			|  | 174 | +  ///
 | 
	
		
			
			|  | 175 | +  /// If padding property is set in other then it replaces value of this
 | 
	
		
			
			|  | 176 | +  /// theme.
 | 
	
		
			
			|  | 177 | +  LineTheme merge(LineTheme other) {
 | 
	
		
			
			|  | 178 | +    if (other == null) return this;
 | 
	
		
			
			|  | 179 | +    return copyWith(
 | 
	
		
			
			|  | 180 | +      textStyle: textStyle?.merge(other.textStyle) ?? other.textStyle,
 | 
	
		
			
			|  | 181 | +      padding: other.padding ?? padding,
 | 
	
		
			
			|  | 182 | +    );
 | 
	
		
			
			|  | 183 | +  }
 | 
	
		
			
			|  | 184 | +
 | 
	
		
			
			|  | 185 | +  @override
 | 
	
		
			
			|  | 186 | +  bool operator ==(other) {
 | 
	
		
			
			|  | 187 | +    if (other.runtimeType != runtimeType) return false;
 | 
	
		
			
			|  | 188 | +    final LineTheme otherTheme = other;
 | 
	
		
			
			|  | 189 | +    return (otherTheme.textStyle == textStyle) &&
 | 
	
		
			
			|  | 190 | +        (otherTheme.padding == padding);
 | 
	
		
			
			|  | 191 | +  }
 | 
	
		
			
			|  | 192 | +
 | 
	
		
			
			|  | 193 | +  @override
 | 
	
		
			
			|  | 194 | +  int get hashCode => hashValues(textStyle, padding);
 | 
	
		
			
			|  | 195 | +}
 | 
	
		
			
			|  | 196 | +
 | 
	
		
			
			|  | 197 | +/// Holds typography values for a block of lines in Zefyr editor.
 | 
	
		
			
			|  | 198 | +@immutable
 | 
	
		
			
			|  | 199 | +class BlockTheme {
 | 
	
		
			
			|  | 200 | +  /// Default text style for all text within a block, can be null.
 | 
	
		
			
			|  | 201 | +  ///
 | 
	
		
			
			|  | 202 | +  /// Takes precedence over line-level text style set by [LineTheme] if
 | 
	
		
			
			|  | 203 | +  /// [inheritLineTextStyle] is set to `false`. Otherwise this text style
 | 
	
		
			
			|  | 204 | +  /// is merged with the line's style.
 | 
	
		
			
			|  | 205 | +  final TextStyle textStyle;
 | 
	
		
			
			|  | 206 | +
 | 
	
		
			
			|  | 207 | +  /// Whether [textStyle] specified by this block theme should be merged with
 | 
	
		
			
			|  | 208 | +  /// text style of each individual line.
 | 
	
		
			
			|  | 209 | +  ///
 | 
	
		
			
			|  | 210 | +  /// Only applicable if [textStyle] is not null.
 | 
	
		
			
			|  | 211 | +  ///
 | 
	
		
			
			|  | 212 | +  /// If set to `true` then [textStyle] is merged with text style specified
 | 
	
		
			
			|  | 213 | +  /// by [LineTheme] of each line within a block. Otherwise [textStyle]
 | 
	
		
			
			|  | 214 | +  /// takes precedence and replaces style of [LineTheme].
 | 
	
		
			
			|  | 215 | +  final bool inheritLineTextStyle;
 | 
	
		
			
			|  | 216 | +
 | 
	
		
			
			|  | 217 | +  /// Space around the block.
 | 
	
		
			
			|  | 218 | +  final EdgeInsets padding;
 | 
	
		
			
			|  | 219 | +
 | 
	
		
			
			|  | 220 | +  /// Space around each individual line within a block, can be null.
 | 
	
		
			
			|  | 221 | +  ///
 | 
	
		
			
			|  | 222 | +  /// Takes precedence over line padding set in [LineTheme].
 | 
	
		
			
			|  | 223 | +  final EdgeInsets linePadding;
 | 
	
		
			
			|  | 224 | +
 | 
	
		
			
			|  | 225 | +  /// Creates a [BlockTheme] given a set of exact values.
 | 
	
		
			
			|  | 226 | +  const BlockTheme({
 | 
	
		
			
			|  | 227 | +    this.textStyle,
 | 
	
		
			
			|  | 228 | +    this.inheritLineTextStyle = true,
 | 
	
		
			
			|  | 229 | +    this.padding,
 | 
	
		
			
			|  | 230 | +    this.linePadding,
 | 
	
		
			
			| 169 | 231 |    });
 | 
	
		
			
			| 170 | 232 |  
 | 
	
		
			
			| 171 |  | -  /// Creates fallback theme for headings.
 | 
	
		
			
			| 172 |  | -  factory HeadingTheme.fallback() {
 | 
	
		
			
			| 173 |  | -    return HeadingTheme(
 | 
	
		
			
			| 174 |  | -      level1: StyleTheme(
 | 
	
		
			
			| 175 |  | -        textStyle: TextStyle(
 | 
	
		
			
			| 176 |  | -          fontSize: 30.0,
 | 
	
		
			
			| 177 |  | -          color: Colors.grey.shade800,
 | 
	
		
			
			| 178 |  | -          height: 1.25,
 | 
	
		
			
			| 179 |  | -          fontWeight: FontWeight.w600,
 | 
	
		
			
			| 180 |  | -        ),
 | 
	
		
			
			| 181 |  | -        padding: EdgeInsets.only(top: 16.0, bottom: 16.0),
 | 
	
		
			
			| 182 |  | -      ),
 | 
	
		
			
			| 183 |  | -      level2: StyleTheme(
 | 
	
		
			
			| 184 |  | -        textStyle: TextStyle(
 | 
	
		
			
			| 185 |  | -          fontSize: 24.0,
 | 
	
		
			
			| 186 |  | -          color: Colors.grey.shade800,
 | 
	
		
			
			| 187 |  | -          height: 1.25,
 | 
	
		
			
			| 188 |  | -          fontWeight: FontWeight.w600,
 | 
	
		
			
			| 189 |  | -        ),
 | 
	
		
			
			| 190 |  | -        padding: EdgeInsets.only(bottom: 8.0, top: 8.0),
 | 
	
		
			
			| 191 |  | -      ),
 | 
	
		
			
			| 192 |  | -      level3: StyleTheme(
 | 
	
		
			
			| 193 |  | -        textStyle: TextStyle(
 | 
	
		
			
			| 194 |  | -          fontSize: 20.0,
 | 
	
		
			
			| 195 |  | -          color: Colors.grey.shade800,
 | 
	
		
			
			| 196 |  | -          height: 1.25,
 | 
	
		
			
			| 197 |  | -          fontWeight: FontWeight.w600,
 | 
	
		
			
			| 198 |  | -        ),
 | 
	
		
			
			| 199 |  | -        padding: EdgeInsets.only(bottom: 8.0, top: 8.0),
 | 
	
		
			
			| 200 |  | -      ),
 | 
	
		
			
			|  | 233 | +  /// Creates a copy of this theme but with the given fields replaced with
 | 
	
		
			
			|  | 234 | +  /// the new values.
 | 
	
		
			
			|  | 235 | +  BlockTheme copyWith({
 | 
	
		
			
			|  | 236 | +    TextStyle textStyle,
 | 
	
		
			
			|  | 237 | +    EdgeInsets padding,
 | 
	
		
			
			|  | 238 | +    bool inheritLineTextStyle,
 | 
	
		
			
			|  | 239 | +    EdgeInsets linePadding,
 | 
	
		
			
			|  | 240 | +  }) {
 | 
	
		
			
			|  | 241 | +    return BlockTheme(
 | 
	
		
			
			|  | 242 | +      textStyle: textStyle ?? this.textStyle,
 | 
	
		
			
			|  | 243 | +      inheritLineTextStyle: inheritLineTextStyle ?? this.inheritLineTextStyle,
 | 
	
		
			
			|  | 244 | +      padding: padding ?? this.padding,
 | 
	
		
			
			|  | 245 | +      linePadding: linePadding ?? this.linePadding,
 | 
	
		
			
			| 201 | 246 |      );
 | 
	
		
			
			| 202 | 247 |    }
 | 
	
		
			
			|  | 248 | +
 | 
	
		
			
			|  | 249 | +  /// Creates a new [BlockTheme] where each property from this object has
 | 
	
		
			
			|  | 250 | +  /// been merged with the matching property from the `other` object.
 | 
	
		
			
			|  | 251 | +  ///
 | 
	
		
			
			|  | 252 | +  /// Text style is merged using [TextStyle.merge] when this and other
 | 
	
		
			
			|  | 253 | +  /// theme have this field set.
 | 
	
		
			
			|  | 254 | +  ///
 | 
	
		
			
			|  | 255 | +  /// If padding property is set in other then it replaces value of this
 | 
	
		
			
			|  | 256 | +  /// theme. [linePadding] follows the same logic.
 | 
	
		
			
			|  | 257 | +  BlockTheme merge(BlockTheme other) {
 | 
	
		
			
			|  | 258 | +    if (other == null) return this;
 | 
	
		
			
			|  | 259 | +    return copyWith(
 | 
	
		
			
			|  | 260 | +      textStyle: textStyle?.merge(other.textStyle) ?? other.textStyle,
 | 
	
		
			
			|  | 261 | +      inheritLineTextStyle: other.inheritLineTextStyle ?? inheritLineTextStyle,
 | 
	
		
			
			|  | 262 | +      padding: other.padding ?? padding,
 | 
	
		
			
			|  | 263 | +      linePadding: other.linePadding ?? linePadding,
 | 
	
		
			
			|  | 264 | +    );
 | 
	
		
			
			|  | 265 | +  }
 | 
	
		
			
			|  | 266 | +
 | 
	
		
			
			|  | 267 | +  @override
 | 
	
		
			
			|  | 268 | +  bool operator ==(other) {
 | 
	
		
			
			|  | 269 | +    if (other.runtimeType != runtimeType) return false;
 | 
	
		
			
			|  | 270 | +    final BlockTheme otherTheme = other;
 | 
	
		
			
			|  | 271 | +    return (otherTheme.textStyle == textStyle) &&
 | 
	
		
			
			|  | 272 | +        (otherTheme.inheritLineTextStyle == inheritLineTextStyle) &&
 | 
	
		
			
			|  | 273 | +        (otherTheme.padding == padding) &&
 | 
	
		
			
			|  | 274 | +        (otherTheme.linePadding == linePadding);
 | 
	
		
			
			|  | 275 | +  }
 | 
	
		
			
			|  | 276 | +
 | 
	
		
			
			|  | 277 | +  @override
 | 
	
		
			
			|  | 278 | +  int get hashCode =>
 | 
	
		
			
			|  | 279 | +      hashValues(textStyle, inheritLineTextStyle, padding, linePadding);
 | 
	
		
			
			| 203 | 280 |  }
 | 
	
		
			
			| 204 | 281 |  
 | 
	
		
			
			| 205 |  | -/// Theme for a block of lines in a document.
 | 
	
		
			
			| 206 |  | -class BlockTheme {
 | 
	
		
			
			| 207 |  | -  /// Style theme for bullet lists.
 | 
	
		
			
			| 208 |  | -  final StyleTheme bulletList;
 | 
	
		
			
			|  | 282 | +/// Holds style information for all format attributes supported by Zefyr editor.
 | 
	
		
			
			|  | 283 | +@immutable
 | 
	
		
			
			|  | 284 | +class AttributeTheme {
 | 
	
		
			
			|  | 285 | +  /// Style used to render "bold" text.
 | 
	
		
			
			|  | 286 | +  final TextStyle bold;
 | 
	
		
			
			| 209 | 287 |  
 | 
	
		
			
			| 210 |  | -  /// Style theme for number lists.
 | 
	
		
			
			| 211 |  | -  final StyleTheme numberList;
 | 
	
		
			
			|  | 288 | +  /// Style used to render "italic" text.
 | 
	
		
			
			|  | 289 | +  final TextStyle italic;
 | 
	
		
			
			| 212 | 290 |  
 | 
	
		
			
			| 213 |  | -  /// Style theme for code snippets.
 | 
	
		
			
			| 214 |  | -  final StyleTheme code;
 | 
	
		
			
			|  | 291 | +  /// Style used to render text containing links.
 | 
	
		
			
			|  | 292 | +  final TextStyle link;
 | 
	
		
			
			| 215 | 293 |  
 | 
	
		
			
			| 216 |  | -  /// Style theme for quotes.
 | 
	
		
			
			| 217 |  | -  final StyleTheme quote;
 | 
	
		
			
			|  | 294 | +  /// Style theme used to render largest headings.
 | 
	
		
			
			|  | 295 | +  final LineTheme heading1;
 | 
	
		
			
			| 218 | 296 |  
 | 
	
		
			
			| 219 |  | -  BlockTheme({
 | 
	
		
			
			| 220 |  | -    @required this.bulletList,
 | 
	
		
			
			| 221 |  | -    @required this.numberList,
 | 
	
		
			
			| 222 |  | -    @required this.quote,
 | 
	
		
			
			| 223 |  | -    @required this.code,
 | 
	
		
			
			|  | 297 | +  /// Style theme used to render medium headings.
 | 
	
		
			
			|  | 298 | +  final LineTheme heading2;
 | 
	
		
			
			|  | 299 | +
 | 
	
		
			
			|  | 300 | +  /// Style theme used to render smaller headings.
 | 
	
		
			
			|  | 301 | +  final LineTheme heading3;
 | 
	
		
			
			|  | 302 | +
 | 
	
		
			
			|  | 303 | +  /// Style theme used to render bullet lists.
 | 
	
		
			
			|  | 304 | +  final BlockTheme bulletList;
 | 
	
		
			
			|  | 305 | +
 | 
	
		
			
			|  | 306 | +  /// Style theme used to render number lists.
 | 
	
		
			
			|  | 307 | +  final BlockTheme numberList;
 | 
	
		
			
			|  | 308 | +
 | 
	
		
			
			|  | 309 | +  /// Style theme used to render quote blocks.
 | 
	
		
			
			|  | 310 | +  final BlockTheme quote;
 | 
	
		
			
			|  | 311 | +
 | 
	
		
			
			|  | 312 | +  /// Style theme used to render code blocks.
 | 
	
		
			
			|  | 313 | +  final BlockTheme code;
 | 
	
		
			
			|  | 314 | +
 | 
	
		
			
			|  | 315 | +  /// Creates a [AttributeTheme] given a set of exact values.
 | 
	
		
			
			|  | 316 | +  AttributeTheme({
 | 
	
		
			
			|  | 317 | +    this.bold,
 | 
	
		
			
			|  | 318 | +    this.italic,
 | 
	
		
			
			|  | 319 | +    this.link,
 | 
	
		
			
			|  | 320 | +    this.heading1,
 | 
	
		
			
			|  | 321 | +    this.heading2,
 | 
	
		
			
			|  | 322 | +    this.heading3,
 | 
	
		
			
			|  | 323 | +    this.bulletList,
 | 
	
		
			
			|  | 324 | +    this.numberList,
 | 
	
		
			
			|  | 325 | +    this.quote,
 | 
	
		
			
			|  | 326 | +    this.code,
 | 
	
		
			
			| 224 | 327 |    });
 | 
	
		
			
			| 225 | 328 |  
 | 
	
		
			
			| 226 |  | -  /// Creates fallback theme for blocks.
 | 
	
		
			
			| 227 |  | -  factory BlockTheme.fallback(ThemeData themeData) {
 | 
	
		
			
			| 228 |  | -    final padding = const EdgeInsets.only(bottom: 8.0);
 | 
	
		
			
			| 229 |  | -    String fontFamily;
 | 
	
		
			
			| 230 |  | -    switch (themeData.platform) {
 | 
	
		
			
			|  | 329 | +  /// The default attribute theme.
 | 
	
		
			
			|  | 330 | +  factory AttributeTheme.fallback(
 | 
	
		
			
			|  | 331 | +      BuildContext context, LineTheme defaultLineTheme) {
 | 
	
		
			
			|  | 332 | +    final theme = Theme.of(context);
 | 
	
		
			
			|  | 333 | +
 | 
	
		
			
			|  | 334 | +    String monospaceFontFamily;
 | 
	
		
			
			|  | 335 | +    switch (theme.platform) {
 | 
	
		
			
			| 231 | 336 |        case TargetPlatform.iOS:
 | 
	
		
			
			| 232 |  | -        fontFamily = 'Menlo';
 | 
	
		
			
			|  | 337 | +        monospaceFontFamily = 'Menlo';
 | 
	
		
			
			| 233 | 338 |          break;
 | 
	
		
			
			| 234 | 339 |        case TargetPlatform.android:
 | 
	
		
			
			| 235 | 340 |        case TargetPlatform.fuchsia:
 | 
	
		
			
			| 236 |  | -        fontFamily = 'Roboto Mono';
 | 
	
		
			
			|  | 341 | +        monospaceFontFamily = 'Roboto Mono';
 | 
	
		
			
			| 237 | 342 |          break;
 | 
	
		
			
			|  | 343 | +      default:
 | 
	
		
			
			|  | 344 | +        throw UnimplementedError("Platform ${theme.platform} not implemented.");
 | 
	
		
			
			| 238 | 345 |      }
 | 
	
		
			
			| 239 | 346 |  
 | 
	
		
			
			| 240 |  | -    return BlockTheme(
 | 
	
		
			
			| 241 |  | -      bulletList: StyleTheme(padding: padding),
 | 
	
		
			
			| 242 |  | -      numberList: StyleTheme(padding: padding),
 | 
	
		
			
			| 243 |  | -      quote: StyleTheme(
 | 
	
		
			
			| 244 |  | -        textStyle: TextStyle(color: Colors.grey.shade700),
 | 
	
		
			
			| 245 |  | -        padding: padding,
 | 
	
		
			
			|  | 347 | +    return AttributeTheme(
 | 
	
		
			
			|  | 348 | +      bold: TextStyle(fontWeight: FontWeight.bold),
 | 
	
		
			
			|  | 349 | +      italic: TextStyle(fontStyle: FontStyle.italic),
 | 
	
		
			
			|  | 350 | +      link: TextStyle(
 | 
	
		
			
			|  | 351 | +        decoration: TextDecoration.underline,
 | 
	
		
			
			|  | 352 | +        color: theme.accentColor,
 | 
	
		
			
			|  | 353 | +      ),
 | 
	
		
			
			|  | 354 | +      heading1: LineTheme(
 | 
	
		
			
			|  | 355 | +        textStyle: defaultLineTheme.textStyle.copyWith(
 | 
	
		
			
			|  | 356 | +          fontSize: 34.0,
 | 
	
		
			
			|  | 357 | +          color: defaultLineTheme.textStyle.color.withOpacity(0.7),
 | 
	
		
			
			|  | 358 | +          height: 1.15,
 | 
	
		
			
			|  | 359 | +          fontWeight: FontWeight.w300,
 | 
	
		
			
			|  | 360 | +        ),
 | 
	
		
			
			|  | 361 | +        padding: EdgeInsets.only(top: 16.0),
 | 
	
		
			
			|  | 362 | +      ),
 | 
	
		
			
			|  | 363 | +      heading2: LineTheme(
 | 
	
		
			
			|  | 364 | +        textStyle: defaultLineTheme.textStyle.copyWith(
 | 
	
		
			
			|  | 365 | +          fontSize: 24.0,
 | 
	
		
			
			|  | 366 | +          color: defaultLineTheme.textStyle.color.withOpacity(0.7),
 | 
	
		
			
			|  | 367 | +          height: 1.15,
 | 
	
		
			
			|  | 368 | +          fontWeight: FontWeight.normal,
 | 
	
		
			
			|  | 369 | +        ),
 | 
	
		
			
			|  | 370 | +        padding: EdgeInsets.only(top: 8.0),
 | 
	
		
			
			|  | 371 | +      ),
 | 
	
		
			
			|  | 372 | +      heading3: LineTheme(
 | 
	
		
			
			|  | 373 | +        textStyle: defaultLineTheme.textStyle.copyWith(
 | 
	
		
			
			|  | 374 | +          fontSize: 20.0,
 | 
	
		
			
			|  | 375 | +          color: defaultLineTheme.textStyle.color.withOpacity(0.7),
 | 
	
		
			
			|  | 376 | +          height: 1.15,
 | 
	
		
			
			|  | 377 | +          fontWeight: FontWeight.w500,
 | 
	
		
			
			|  | 378 | +        ),
 | 
	
		
			
			|  | 379 | +        padding: EdgeInsets.only(top: 8.0),
 | 
	
		
			
			|  | 380 | +      ),
 | 
	
		
			
			|  | 381 | +      bulletList: BlockTheme(
 | 
	
		
			
			|  | 382 | +        padding: EdgeInsets.symmetric(vertical: 8.0),
 | 
	
		
			
			|  | 383 | +        linePadding: EdgeInsets.symmetric(vertical: 2.0),
 | 
	
		
			
			|  | 384 | +      ),
 | 
	
		
			
			|  | 385 | +      numberList: BlockTheme(
 | 
	
		
			
			|  | 386 | +        padding: EdgeInsets.symmetric(vertical: 8.0),
 | 
	
		
			
			|  | 387 | +        linePadding: EdgeInsets.symmetric(vertical: 2.0),
 | 
	
		
			
			| 246 | 388 |        ),
 | 
	
		
			
			| 247 |  | -      code: StyleTheme(
 | 
	
		
			
			|  | 389 | +      quote: BlockTheme(
 | 
	
		
			
			|  | 390 | +        padding: EdgeInsets.symmetric(vertical: 8.0),
 | 
	
		
			
			| 248 | 391 |          textStyle: TextStyle(
 | 
	
		
			
			| 249 |  | -          color: Colors.blueGrey.shade800,
 | 
	
		
			
			| 250 |  | -          fontFamily: fontFamily,
 | 
	
		
			
			|  | 392 | +          color: defaultLineTheme.textStyle.color.withOpacity(0.6),
 | 
	
		
			
			|  | 393 | +        ),
 | 
	
		
			
			|  | 394 | +        inheritLineTextStyle: true,
 | 
	
		
			
			|  | 395 | +      ),
 | 
	
		
			
			|  | 396 | +      code: BlockTheme(
 | 
	
		
			
			|  | 397 | +        padding: EdgeInsets.symmetric(vertical: 8.0),
 | 
	
		
			
			|  | 398 | +        textStyle: TextStyle(
 | 
	
		
			
			|  | 399 | +          fontFamily: monospaceFontFamily,
 | 
	
		
			
			| 251 | 400 |            fontSize: 14.0,
 | 
	
		
			
			|  | 401 | +          color: defaultLineTheme.textStyle.color.withOpacity(0.8),
 | 
	
		
			
			| 252 | 402 |            height: 1.25,
 | 
	
		
			
			| 253 | 403 |          ),
 | 
	
		
			
			| 254 |  | -        padding: padding,
 | 
	
		
			
			|  | 404 | +        inheritLineTextStyle: false,
 | 
	
		
			
			|  | 405 | +        linePadding: EdgeInsets.zero,
 | 
	
		
			
			| 255 | 406 |        ),
 | 
	
		
			
			| 256 | 407 |      );
 | 
	
		
			
			| 257 | 408 |    }
 | 
	
		
			
			| 258 |  | -}
 | 
	
		
			
			| 259 | 409 |  
 | 
	
		
			
			| 260 |  | -/// Theme for a specific attribute style.
 | 
	
		
			
			| 261 |  | -///
 | 
	
		
			
			| 262 |  | -/// Used in [HeadingTheme] and [BlockTheme], as well as in
 | 
	
		
			
			| 263 |  | -/// [ZefyrThemeData.paragraphTheme].
 | 
	
		
			
			| 264 |  | -class StyleTheme {
 | 
	
		
			
			| 265 |  | -  /// Text style of this theme.
 | 
	
		
			
			| 266 |  | -  final TextStyle textStyle;
 | 
	
		
			
			|  | 410 | +  /// Creates a new [AttributeTheme] where each property from this object has
 | 
	
		
			
			|  | 411 | +  /// been merged with the matching property from the `other` object.
 | 
	
		
			
			|  | 412 | +  AttributeTheme copyWith({
 | 
	
		
			
			|  | 413 | +    TextStyle bold,
 | 
	
		
			
			|  | 414 | +    TextStyle italic,
 | 
	
		
			
			|  | 415 | +    TextStyle link,
 | 
	
		
			
			|  | 416 | +    LineTheme heading1,
 | 
	
		
			
			|  | 417 | +    LineTheme heading2,
 | 
	
		
			
			|  | 418 | +    LineTheme heading3,
 | 
	
		
			
			|  | 419 | +    BlockTheme bulletList,
 | 
	
		
			
			|  | 420 | +    BlockTheme numberList,
 | 
	
		
			
			|  | 421 | +    BlockTheme quote,
 | 
	
		
			
			|  | 422 | +    BlockTheme code,
 | 
	
		
			
			|  | 423 | +  }) {
 | 
	
		
			
			|  | 424 | +    return AttributeTheme(
 | 
	
		
			
			|  | 425 | +      bold: bold ?? this.bold,
 | 
	
		
			
			|  | 426 | +      italic: italic ?? this.italic,
 | 
	
		
			
			|  | 427 | +      link: link ?? this.link,
 | 
	
		
			
			|  | 428 | +      heading1: heading1 ?? this.heading1,
 | 
	
		
			
			|  | 429 | +      heading2: heading2 ?? this.heading2,
 | 
	
		
			
			|  | 430 | +      heading3: heading3 ?? this.heading3,
 | 
	
		
			
			|  | 431 | +      bulletList: bulletList ?? this.bulletList,
 | 
	
		
			
			|  | 432 | +      numberList: numberList ?? this.numberList,
 | 
	
		
			
			|  | 433 | +      quote: quote ?? this.quote,
 | 
	
		
			
			|  | 434 | +      code: code ?? this.code,
 | 
	
		
			
			|  | 435 | +    );
 | 
	
		
			
			|  | 436 | +  }
 | 
	
		
			
			| 267 | 437 |  
 | 
	
		
			
			| 268 |  | -  /// Padding to apply around lines of text.
 | 
	
		
			
			| 269 |  | -  final EdgeInsets padding;
 | 
	
		
			
			|  | 438 | +  /// Creates a new [AttributeTheme] where each property from this object has
 | 
	
		
			
			|  | 439 | +  /// been merged with the matching property from the `other` object.
 | 
	
		
			
			|  | 440 | +  AttributeTheme merge(AttributeTheme other) {
 | 
	
		
			
			|  | 441 | +    if (other == null) return this;
 | 
	
		
			
			|  | 442 | +    return copyWith(
 | 
	
		
			
			|  | 443 | +      bold: bold?.merge(other.bold) ?? other.bold,
 | 
	
		
			
			|  | 444 | +      italic: italic?.merge(other.italic) ?? other.italic,
 | 
	
		
			
			|  | 445 | +      link: link?.merge(other.link) ?? other.link,
 | 
	
		
			
			|  | 446 | +      heading1: heading1?.merge(other.heading1) ?? other.heading1,
 | 
	
		
			
			|  | 447 | +      heading2: heading2?.merge(other.heading2) ?? other.heading2,
 | 
	
		
			
			|  | 448 | +      heading3: heading3?.merge(other.heading3) ?? other.heading3,
 | 
	
		
			
			|  | 449 | +      bulletList: bulletList?.merge(other.bulletList) ?? other.bulletList,
 | 
	
		
			
			|  | 450 | +      numberList: numberList?.merge(other.numberList) ?? other.numberList,
 | 
	
		
			
			|  | 451 | +      quote: quote?.merge(other.quote) ?? other.quote,
 | 
	
		
			
			|  | 452 | +      code: code?.merge(other.code) ?? other.code,
 | 
	
		
			
			|  | 453 | +    );
 | 
	
		
			
			|  | 454 | +  }
 | 
	
		
			
			| 270 | 455 |  
 | 
	
		
			
			| 271 |  | -  /// Creates a new [StyleTheme].
 | 
	
		
			
			| 272 |  | -  StyleTheme({
 | 
	
		
			
			| 273 |  | -    this.textStyle,
 | 
	
		
			
			| 274 |  | -    this.padding,
 | 
	
		
			
			| 275 |  | -  });
 | 
	
		
			
			|  | 456 | +  @override
 | 
	
		
			
			|  | 457 | +  bool operator ==(other) {
 | 
	
		
			
			|  | 458 | +    if (other.runtimeType != runtimeType) return false;
 | 
	
		
			
			|  | 459 | +    final AttributeTheme otherTheme = other;
 | 
	
		
			
			|  | 460 | +    return (otherTheme.bold == bold) &&
 | 
	
		
			
			|  | 461 | +        (otherTheme.italic == italic) &&
 | 
	
		
			
			|  | 462 | +        (otherTheme.link == link) &&
 | 
	
		
			
			|  | 463 | +        (otherTheme.heading1 == heading1) &&
 | 
	
		
			
			|  | 464 | +        (otherTheme.heading2 == heading2) &&
 | 
	
		
			
			|  | 465 | +        (otherTheme.heading3 == heading3) &&
 | 
	
		
			
			|  | 466 | +        (otherTheme.bulletList == bulletList) &&
 | 
	
		
			
			|  | 467 | +        (otherTheme.numberList == numberList) &&
 | 
	
		
			
			|  | 468 | +        (otherTheme.quote == quote) &&
 | 
	
		
			
			|  | 469 | +        (otherTheme.code == code);
 | 
	
		
			
			|  | 470 | +  }
 | 
	
		
			
			|  | 471 | +
 | 
	
		
			
			|  | 472 | +  @override
 | 
	
		
			
			|  | 473 | +  int get hashCode {
 | 
	
		
			
			|  | 474 | +    return hashList([
 | 
	
		
			
			|  | 475 | +      bold,
 | 
	
		
			
			|  | 476 | +      italic,
 | 
	
		
			
			|  | 477 | +      link,
 | 
	
		
			
			|  | 478 | +      heading1,
 | 
	
		
			
			|  | 479 | +      heading2,
 | 
	
		
			
			|  | 480 | +      heading3,
 | 
	
		
			
			|  | 481 | +      bulletList,
 | 
	
		
			
			|  | 482 | +      numberList,
 | 
	
		
			
			|  | 483 | +      quote,
 | 
	
		
			
			|  | 484 | +      code,
 | 
	
		
			
			|  | 485 | +    ]);
 | 
	
		
			
			|  | 486 | +  }
 | 
	
		
			
			| 276 | 487 |  }
 | 
	
		
			
			| 277 | 488 |  
 | 
	
		
			
			| 278 |  | -/// Defines styles and colors for [ZefyrToolbar].
 | 
	
		
			
			| 279 |  | -class ZefyrToolbarTheme {
 | 
	
		
			
			| 280 |  | -  /// The background color of toolbar.
 | 
	
		
			
			|  | 489 | +/// Defines styles and colors for Zefyr editor toolbar.
 | 
	
		
			
			|  | 490 | +class ToolbarTheme {
 | 
	
		
			
			|  | 491 | +  /// The background color of the toolbar.
 | 
	
		
			
			| 281 | 492 |    final Color color;
 | 
	
		
			
			| 282 | 493 |  
 | 
	
		
			
			| 283 | 494 |    /// Color of buttons in toggled state.
 | 
	
	
		
			
			|  | @@ -289,35 +500,67 @@ class ZefyrToolbarTheme {
 | 
	
		
			
			| 289 | 500 |    /// Color of button icons in disabled state.
 | 
	
		
			
			| 290 | 501 |    final Color disabledIconColor;
 | 
	
		
			
			| 291 | 502 |  
 | 
	
		
			
			| 292 |  | -  /// Creates fallback theme for editor toolbars.
 | 
	
		
			
			| 293 |  | -  factory ZefyrToolbarTheme.fallback(BuildContext context) {
 | 
	
		
			
			|  | 503 | +  /// Creates default theme for editor toolbar.
 | 
	
		
			
			|  | 504 | +  factory ToolbarTheme.fallback(BuildContext context) {
 | 
	
		
			
			| 294 | 505 |      final theme = Theme.of(context);
 | 
	
		
			
			| 295 |  | -    return ZefyrToolbarTheme._(
 | 
	
		
			
			| 296 |  | -      color: theme.primaryColorLight,
 | 
	
		
			
			| 297 |  | -      toggleColor: theme.primaryColor,
 | 
	
		
			
			|  | 506 | +    return ToolbarTheme._(
 | 
	
		
			
			|  | 507 | +      color: theme.primaryColorBrightness == Brightness.light
 | 
	
		
			
			|  | 508 | +          ? Colors.grey.shade300
 | 
	
		
			
			|  | 509 | +          : Colors.grey.shade800,
 | 
	
		
			
			|  | 510 | +      toggleColor: theme.primaryColorBrightness == Brightness.light
 | 
	
		
			
			|  | 511 | +          ? Colors.grey.shade400
 | 
	
		
			
			|  | 512 | +          : Colors.grey.shade900,
 | 
	
		
			
			| 298 | 513 |        iconColor: theme.primaryIconTheme.color,
 | 
	
		
			
			| 299 |  | -      disabledIconColor: theme.primaryColor,
 | 
	
		
			
			|  | 514 | +      disabledIconColor: theme.disabledColor,
 | 
	
		
			
			| 300 | 515 |      );
 | 
	
		
			
			| 301 | 516 |    }
 | 
	
		
			
			| 302 | 517 |  
 | 
	
		
			
			| 303 |  | -  ZefyrToolbarTheme._({
 | 
	
		
			
			|  | 518 | +  ToolbarTheme._({
 | 
	
		
			
			| 304 | 519 |      @required this.color,
 | 
	
		
			
			| 305 | 520 |      @required this.toggleColor,
 | 
	
		
			
			| 306 | 521 |      @required this.iconColor,
 | 
	
		
			
			| 307 | 522 |      @required this.disabledIconColor,
 | 
	
		
			
			| 308 | 523 |    });
 | 
	
		
			
			| 309 | 524 |  
 | 
	
		
			
			| 310 |  | -  ZefyrToolbarTheme copyWith({
 | 
	
		
			
			|  | 525 | +  /// Creates a new [ToolbarTheme] where each property from this object has
 | 
	
		
			
			|  | 526 | +  /// been merged with the matching property from the `other` object.
 | 
	
		
			
			|  | 527 | +  ToolbarTheme copyWith({
 | 
	
		
			
			| 311 | 528 |      Color color,
 | 
	
		
			
			| 312 | 529 |      Color toggleColor,
 | 
	
		
			
			| 313 | 530 |      Color iconColor,
 | 
	
		
			
			| 314 | 531 |      Color disabledIconColor,
 | 
	
		
			
			| 315 | 532 |    }) {
 | 
	
		
			
			| 316 |  | -    return ZefyrToolbarTheme._(
 | 
	
		
			
			|  | 533 | +    return ToolbarTheme._(
 | 
	
		
			
			| 317 | 534 |        color: color ?? this.color,
 | 
	
		
			
			| 318 | 535 |        toggleColor: toggleColor ?? this.toggleColor,
 | 
	
		
			
			| 319 | 536 |        iconColor: iconColor ?? this.iconColor,
 | 
	
		
			
			| 320 | 537 |        disabledIconColor: disabledIconColor ?? this.disabledIconColor,
 | 
	
		
			
			| 321 | 538 |      );
 | 
	
		
			
			| 322 | 539 |    }
 | 
	
		
			
			|  | 540 | +
 | 
	
		
			
			|  | 541 | +  /// Creates a new [ToolbarTheme] where each property from this object has
 | 
	
		
			
			|  | 542 | +  /// been merged with the matching property from the `other` object.
 | 
	
		
			
			|  | 543 | +  ToolbarTheme merge(ToolbarTheme other) {
 | 
	
		
			
			|  | 544 | +    if (other == null) return this;
 | 
	
		
			
			|  | 545 | +    return copyWith(
 | 
	
		
			
			|  | 546 | +      color: other.color ?? color,
 | 
	
		
			
			|  | 547 | +      toggleColor: other.toggleColor ?? toggleColor,
 | 
	
		
			
			|  | 548 | +      iconColor: other.iconColor ?? iconColor,
 | 
	
		
			
			|  | 549 | +      disabledIconColor: other.disabledIconColor ?? disabledIconColor,
 | 
	
		
			
			|  | 550 | +    );
 | 
	
		
			
			|  | 551 | +  }
 | 
	
		
			
			|  | 552 | +
 | 
	
		
			
			|  | 553 | +  @override
 | 
	
		
			
			|  | 554 | +  bool operator ==(other) {
 | 
	
		
			
			|  | 555 | +    if (other.runtimeType != runtimeType) return false;
 | 
	
		
			
			|  | 556 | +    final ToolbarTheme otherTheme = other;
 | 
	
		
			
			|  | 557 | +    return (otherTheme.color == color) &&
 | 
	
		
			
			|  | 558 | +        (otherTheme.toggleColor == toggleColor) &&
 | 
	
		
			
			|  | 559 | +        (otherTheme.iconColor == iconColor) &&
 | 
	
		
			
			|  | 560 | +        (otherTheme.disabledIconColor == disabledIconColor);
 | 
	
		
			
			|  | 561 | +  }
 | 
	
		
			
			|  | 562 | +
 | 
	
		
			
			|  | 563 | +  @override
 | 
	
		
			
			|  | 564 | +  int get hashCode =>
 | 
	
		
			
			|  | 565 | +      hashValues(color, toggleColor, iconColor, disabledIconColor);
 | 
	
		
			
			| 323 | 566 |  }
 |