Showing
14 changed files
with
496 additions
and
452 deletions
| @@ -16,30 +16,29 @@ class _CodeFieldState extends State<CodeField> { | @@ -16,30 +16,29 @@ class _CodeFieldState extends State<CodeField> { | ||
| 16 | Widget build(BuildContext context) { | 16 | Widget build(BuildContext context) { |
| 17 | return Material( | 17 | return Material( |
| 18 | color: Theme.of(context).colorScheme.onInverseSurface, | 18 | color: Theme.of(context).colorScheme.onInverseSurface, |
| 19 | - shape: RoundedRectangleBorder( | ||
| 20 | - borderRadius: BorderRadius.circular(8), | ||
| 21 | - ), | 19 | + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), |
| 22 | child: Column( | 20 | child: Column( |
| 23 | crossAxisAlignment: CrossAxisAlignment.stretch, | 21 | crossAxisAlignment: CrossAxisAlignment.stretch, |
| 24 | children: [ | 22 | children: [ |
| 25 | Row( | 23 | Row( |
| 26 | children: [ | 24 | children: [ |
| 27 | Padding( | 25 | Padding( |
| 28 | - padding: | ||
| 29 | - const EdgeInsets.symmetric(horizontal: 16.0, vertical: 8), | 26 | + padding: const EdgeInsets.symmetric( |
| 27 | + horizontal: 16.0, | ||
| 28 | + vertical: 8, | ||
| 29 | + ), | ||
| 30 | child: Text(widget.name), | 30 | child: Text(widget.name), |
| 31 | ), | 31 | ), |
| 32 | const Spacer(), | 32 | const Spacer(), |
| 33 | TextButton.icon( | 33 | TextButton.icon( |
| 34 | style: TextButton.styleFrom( | 34 | style: TextButton.styleFrom( |
| 35 | foregroundColor: Theme.of(context).colorScheme.onSurface, | 35 | foregroundColor: Theme.of(context).colorScheme.onSurface, |
| 36 | - textStyle: const TextStyle( | ||
| 37 | - fontWeight: FontWeight.normal, | ||
| 38 | - ), | 36 | + textStyle: const TextStyle(fontWeight: FontWeight.normal), |
| 39 | ), | 37 | ), |
| 40 | onPressed: () async { | 38 | onPressed: () async { |
| 41 | - await Clipboard.setData(ClipboardData(text: widget.codes)) | ||
| 42 | - .then((value) { | 39 | + await Clipboard.setData( |
| 40 | + ClipboardData(text: widget.codes), | ||
| 41 | + ).then((value) { | ||
| 43 | setState(() { | 42 | setState(() { |
| 44 | _copied = true; | 43 | _copied = true; |
| 45 | }); | 44 | }); |
| @@ -57,15 +56,11 @@ class _CodeFieldState extends State<CodeField> { | @@ -57,15 +56,11 @@ class _CodeFieldState extends State<CodeField> { | ||
| 57 | ), | 56 | ), |
| 58 | ], | 57 | ], |
| 59 | ), | 58 | ), |
| 60 | - const Divider( | ||
| 61 | - height: 1, | ||
| 62 | - ), | 59 | + const Divider(height: 1), |
| 63 | SingleChildScrollView( | 60 | SingleChildScrollView( |
| 64 | scrollDirection: Axis.horizontal, | 61 | scrollDirection: Axis.horizontal, |
| 65 | padding: const EdgeInsets.all(16), | 62 | padding: const EdgeInsets.all(16), |
| 66 | - child: Text( | ||
| 67 | - widget.codes, | ||
| 68 | - ), | 63 | + child: Text(widget.codes), |
| 69 | ), | 64 | ), |
| 70 | ], | 65 | ], |
| 71 | ), | 66 | ), |
| @@ -16,7 +16,9 @@ class CustomDivider extends LeafRenderObjectWidget { | @@ -16,7 +16,9 @@ class CustomDivider extends LeafRenderObjectWidget { | ||
| 16 | 16 | ||
| 17 | @override | 17 | @override |
| 18 | void updateRenderObject( | 18 | void updateRenderObject( |
| 19 | - BuildContext context, covariant RenderDivider renderObject) { | 19 | + BuildContext context, |
| 20 | + covariant RenderDivider renderObject, | ||
| 21 | + ) { | ||
| 20 | renderObject.color = color ?? Theme.of(context).colorScheme.outline; | 22 | renderObject.color = color ?? Theme.of(context).colorScheme.outline; |
| 21 | renderObject.height = height ?? 2; | 23 | renderObject.height = height ?? 2; |
| 22 | renderObject.width = MediaQuery.sizeOf(context).width; | 24 | renderObject.width = MediaQuery.sizeOf(context).width; |
| @@ -25,9 +27,9 @@ class CustomDivider extends LeafRenderObjectWidget { | @@ -25,9 +27,9 @@ class CustomDivider extends LeafRenderObjectWidget { | ||
| 25 | 27 | ||
| 26 | class RenderDivider extends RenderBox { | 28 | class RenderDivider extends RenderBox { |
| 27 | RenderDivider(Color color, double width, double height) | 29 | RenderDivider(Color color, double width, double height) |
| 28 | - : _color = color, | ||
| 29 | - _height = height, | ||
| 30 | - _width = width; | 30 | + : _color = color, |
| 31 | + _height = height, | ||
| 32 | + _width = width; | ||
| 31 | Color _color; | 33 | Color _color; |
| 32 | double _height; | 34 | double _height; |
| 33 | double _width; | 35 | double _width; |
| @@ -57,9 +59,10 @@ class RenderDivider extends RenderBox { | @@ -57,9 +59,10 @@ class RenderDivider extends RenderBox { | ||
| 57 | 59 | ||
| 58 | @override | 60 | @override |
| 59 | Size computeDryLayout(BoxConstraints constraints) { | 61 | Size computeDryLayout(BoxConstraints constraints) { |
| 60 | - return BoxConstraints.tightFor(width: null, height: _height) | ||
| 61 | - .enforce(constraints) | ||
| 62 | - .smallest; | 62 | + return BoxConstraints.tightFor( |
| 63 | + width: null, | ||
| 64 | + height: _height, | ||
| 65 | + ).enforce(constraints).smallest; | ||
| 63 | } | 66 | } |
| 64 | 67 | ||
| 65 | @override | 68 | @override |
| @@ -69,7 +72,9 @@ class RenderDivider extends RenderBox { | @@ -69,7 +72,9 @@ class RenderDivider extends RenderBox { | ||
| 69 | 72 | ||
| 70 | @override | 73 | @override |
| 71 | void paint(PaintingContext context, Offset offset) { | 74 | void paint(PaintingContext context, Offset offset) { |
| 72 | - context.canvas.drawRect(offset & Size(Rect.largest.size.width, _height), | ||
| 73 | - Paint()..color = _color); | 75 | + context.canvas.drawRect( |
| 76 | + offset & Size(Rect.largest.size.width, _height), | ||
| 77 | + Paint()..color = _color, | ||
| 78 | + ); | ||
| 74 | } | 79 | } |
| 75 | } | 80 | } |
| @@ -25,8 +25,11 @@ class CustomImageError extends LeafRenderObjectWidget { | @@ -25,8 +25,11 @@ class CustomImageError extends LeafRenderObjectWidget { | ||
| 25 | 25 | ||
| 26 | @override | 26 | @override |
| 27 | void updateRenderObject( | 27 | void updateRenderObject( |
| 28 | - BuildContext context, covariant RenderCustomImageError renderObject) { | ||
| 29 | - renderObject._backgroundColor = backgroundColor ?? | 28 | + BuildContext context, |
| 29 | + covariant RenderCustomImageError renderObject, | ||
| 30 | + ) { | ||
| 31 | + renderObject._backgroundColor = | ||
| 32 | + backgroundColor ?? | ||
| 30 | Theme.of(context).colorScheme.surfaceContainerHighest; | 33 | Theme.of(context).colorScheme.surfaceContainerHighest; |
| 31 | renderObject._iconColor = | 34 | renderObject._iconColor = |
| 32 | iconColor ?? Theme.of(context).colorScheme.onSurfaceVariant; | 35 | iconColor ?? Theme.of(context).colorScheme.onSurfaceVariant; |
| @@ -37,7 +40,10 @@ class CustomImageError extends LeafRenderObjectWidget { | @@ -37,7 +40,10 @@ class CustomImageError extends LeafRenderObjectWidget { | ||
| 37 | 40 | ||
| 38 | class RenderCustomImageError extends RenderProxyBox { | 41 | class RenderCustomImageError extends RenderProxyBox { |
| 39 | RenderCustomImageError( | 42 | RenderCustomImageError( |
| 40 | - this._iconColor, this._backgroundColor, this._outlineColor); | 43 | + this._iconColor, |
| 44 | + this._backgroundColor, | ||
| 45 | + this._outlineColor, | ||
| 46 | + ); | ||
| 41 | Color _iconColor; | 47 | Color _iconColor; |
| 42 | Color _outlineColor; | 48 | Color _outlineColor; |
| 43 | Color _backgroundColor; | 49 | Color _backgroundColor; |
| @@ -68,29 +74,29 @@ class RenderCustomImageError extends RenderProxyBox { | @@ -68,29 +74,29 @@ class RenderCustomImageError extends RenderProxyBox { | ||
| 68 | @override | 74 | @override |
| 69 | void performLayout() { | 75 | void performLayout() { |
| 70 | if (constraints.hasBoundedHeight && constraints.hasBoundedWidth) { | 76 | if (constraints.hasBoundedHeight && constraints.hasBoundedWidth) { |
| 71 | - size = constraints.constrain(Size( | 77 | + size = constraints.constrain( |
| 78 | + Size( | ||
| 72 | min(constraints.maxWidth, constraints.maxHeight), | 79 | min(constraints.maxWidth, constraints.maxHeight), |
| 73 | - min(constraints.maxHeight, constraints.maxWidth))); | 80 | + min(constraints.maxHeight, constraints.maxWidth), |
| 81 | + ), | ||
| 82 | + ); | ||
| 74 | return; | 83 | return; |
| 75 | } | 84 | } |
| 76 | if (constraints.hasBoundedHeight || constraints.hasBoundedWidth) { | 85 | if (constraints.hasBoundedHeight || constraints.hasBoundedWidth) { |
| 77 | - size = constraints.constrain(Size( | ||
| 78 | - min(constraints.maxHeight, constraints.maxWidth), | ||
| 79 | - min(constraints.maxHeight, constraints.maxWidth), | ||
| 80 | - )); | 86 | + size = constraints.constrain( |
| 87 | + Size( | ||
| 88 | + min(constraints.maxHeight, constraints.maxWidth), | ||
| 89 | + min(constraints.maxHeight, constraints.maxWidth), | ||
| 90 | + ), | ||
| 91 | + ); | ||
| 81 | return; | 92 | return; |
| 82 | } | 93 | } |
| 83 | - size = constraints.constrain( | ||
| 84 | - const Size(80, 80), | ||
| 85 | - ); | 94 | + size = constraints.constrain(const Size(80, 80)); |
| 86 | } | 95 | } |
| 87 | 96 | ||
| 88 | @override | 97 | @override |
| 89 | void paint(PaintingContext context, Offset offset) { | 98 | void paint(PaintingContext context, Offset offset) { |
| 90 | - context.canvas.drawRect( | ||
| 91 | - offset & size, | ||
| 92 | - Paint()..color = _backgroundColor, | ||
| 93 | - ); | 99 | + context.canvas.drawRect(offset & size, Paint()..color = _backgroundColor); |
| 94 | context.canvas.drawRect( | 100 | context.canvas.drawRect( |
| 95 | offset & size, | 101 | offset & size, |
| 96 | Paint() | 102 | Paint() |
| @@ -102,16 +108,19 @@ class RenderCustomImageError extends RenderProxyBox { | @@ -102,16 +108,19 @@ class RenderCustomImageError extends RenderProxyBox { | ||
| 102 | textPainter.text = TextSpan( | 108 | textPainter.text = TextSpan( |
| 103 | text: String.fromCharCode(icon.codePoint), | 109 | text: String.fromCharCode(icon.codePoint), |
| 104 | style: TextStyle( | 110 | style: TextStyle( |
| 105 | - fontSize: min(min(size.width, size.height), 35), | ||
| 106 | - fontFamily: icon.fontFamily, | ||
| 107 | - color: _iconColor), | 111 | + fontSize: min(min(size.width, size.height), 35), |
| 112 | + fontFamily: icon.fontFamily, | ||
| 113 | + color: _iconColor, | ||
| 114 | + ), | ||
| 108 | ); | 115 | ); |
| 109 | textPainter.layout(); | 116 | textPainter.layout(); |
| 110 | textPainter.paint( | 117 | textPainter.paint( |
| 111 | context.canvas, | 118 | context.canvas, |
| 112 | offset + | 119 | offset + |
| 113 | - Offset(size.width / 2 - textPainter.size.width / 2, | ||
| 114 | - size.height / 2 - textPainter.size.height / 2), | 120 | + Offset( |
| 121 | + size.width / 2 - textPainter.size.width / 2, | ||
| 122 | + size.height / 2 - textPainter.size.height / 2, | ||
| 123 | + ), | ||
| 115 | ); | 124 | ); |
| 116 | } | 125 | } |
| 117 | } | 126 | } |
| @@ -141,8 +150,11 @@ class CustomImageLoading extends LeafRenderObjectWidget { | @@ -141,8 +150,11 @@ class CustomImageLoading extends LeafRenderObjectWidget { | ||
| 141 | 150 | ||
| 142 | @override | 151 | @override |
| 143 | void updateRenderObject( | 152 | void updateRenderObject( |
| 144 | - BuildContext context, covariant RenderCustomImageLoading renderObject) { | ||
| 145 | - renderObject._backgroundColor = backgroundColor ?? | 153 | + BuildContext context, |
| 154 | + covariant RenderCustomImageLoading renderObject, | ||
| 155 | + ) { | ||
| 156 | + renderObject._backgroundColor = | ||
| 157 | + backgroundColor ?? | ||
| 146 | Theme.of(context).colorScheme.surfaceContainerHighest; | 158 | Theme.of(context).colorScheme.surfaceContainerHighest; |
| 147 | renderObject._iconColor = | 159 | renderObject._iconColor = |
| 148 | iconColor ?? Theme.of(context).colorScheme.onSurfaceVariant; | 160 | iconColor ?? Theme.of(context).colorScheme.onSurfaceVariant; |
| @@ -153,8 +165,12 @@ class CustomImageLoading extends LeafRenderObjectWidget { | @@ -153,8 +165,12 @@ class CustomImageLoading extends LeafRenderObjectWidget { | ||
| 153 | } | 165 | } |
| 154 | 166 | ||
| 155 | class RenderCustomImageLoading extends RenderProxyBox { | 167 | class RenderCustomImageLoading extends RenderProxyBox { |
| 156 | - RenderCustomImageLoading(this._iconColor, this._backgroundColor, | ||
| 157 | - this._outlineColor, this._progress); | 168 | + RenderCustomImageLoading( |
| 169 | + this._iconColor, | ||
| 170 | + this._backgroundColor, | ||
| 171 | + this._outlineColor, | ||
| 172 | + this._progress, | ||
| 173 | + ); | ||
| 158 | Color _iconColor; | 174 | Color _iconColor; |
| 159 | Color _outlineColor; | 175 | Color _outlineColor; |
| 160 | Color _backgroundColor; | 176 | Color _backgroundColor; |
| @@ -194,29 +210,29 @@ class RenderCustomImageLoading extends RenderProxyBox { | @@ -194,29 +210,29 @@ class RenderCustomImageLoading extends RenderProxyBox { | ||
| 194 | @override | 210 | @override |
| 195 | void performLayout() { | 211 | void performLayout() { |
| 196 | if (constraints.hasBoundedHeight && constraints.hasBoundedWidth) { | 212 | if (constraints.hasBoundedHeight && constraints.hasBoundedWidth) { |
| 197 | - size = constraints.constrain(Size( | 213 | + size = constraints.constrain( |
| 214 | + Size( | ||
| 198 | min(constraints.maxWidth, constraints.maxHeight), | 215 | min(constraints.maxWidth, constraints.maxHeight), |
| 199 | - min(constraints.maxHeight, constraints.maxWidth))); | 216 | + min(constraints.maxHeight, constraints.maxWidth), |
| 217 | + ), | ||
| 218 | + ); | ||
| 200 | return; | 219 | return; |
| 201 | } | 220 | } |
| 202 | if (constraints.hasBoundedHeight || constraints.hasBoundedWidth) { | 221 | if (constraints.hasBoundedHeight || constraints.hasBoundedWidth) { |
| 203 | - size = constraints.constrain(Size( | ||
| 204 | - min(constraints.maxHeight, constraints.maxWidth), | ||
| 205 | - min(constraints.maxHeight, constraints.maxWidth), | ||
| 206 | - )); | 222 | + size = constraints.constrain( |
| 223 | + Size( | ||
| 224 | + min(constraints.maxHeight, constraints.maxWidth), | ||
| 225 | + min(constraints.maxHeight, constraints.maxWidth), | ||
| 226 | + ), | ||
| 227 | + ); | ||
| 207 | return; | 228 | return; |
| 208 | } | 229 | } |
| 209 | - size = constraints.constrain( | ||
| 210 | - const Size(80, 80), | ||
| 211 | - ); | 230 | + size = constraints.constrain(const Size(80, 80)); |
| 212 | } | 231 | } |
| 213 | 232 | ||
| 214 | @override | 233 | @override |
| 215 | void paint(PaintingContext context, Offset offset) { | 234 | void paint(PaintingContext context, Offset offset) { |
| 216 | - context.canvas.drawRect( | ||
| 217 | - offset & size, | ||
| 218 | - Paint()..color = _backgroundColor, | ||
| 219 | - ); | 235 | + context.canvas.drawRect(offset & size, Paint()..color = _backgroundColor); |
| 220 | context.canvas.drawRect( | 236 | context.canvas.drawRect( |
| 221 | offset & size, | 237 | offset & size, |
| 222 | Paint() | 238 | Paint() |
| @@ -228,19 +244,23 @@ class RenderCustomImageLoading extends RenderProxyBox { | @@ -228,19 +244,23 @@ class RenderCustomImageLoading extends RenderProxyBox { | ||
| 228 | textPainter.text = TextSpan( | 244 | textPainter.text = TextSpan( |
| 229 | text: String.fromCharCode(icon.codePoint), | 245 | text: String.fromCharCode(icon.codePoint), |
| 230 | style: TextStyle( | 246 | style: TextStyle( |
| 231 | - fontSize: min(min(size.width, size.height), 35), | ||
| 232 | - fontFamily: icon.fontFamily, | ||
| 233 | - color: _iconColor), | 247 | + fontSize: min(min(size.width, size.height), 35), |
| 248 | + fontFamily: icon.fontFamily, | ||
| 249 | + color: _iconColor, | ||
| 250 | + ), | ||
| 234 | ); | 251 | ); |
| 235 | textPainter.layout(); | 252 | textPainter.layout(); |
| 236 | context.canvas.drawRect( | 253 | context.canvas.drawRect( |
| 237 | - (offset + Offset(0, size.height - 5)) & Size(size.width * _progress, 5), | ||
| 238 | - Paint()..color = _iconColor); | 254 | + (offset + Offset(0, size.height - 5)) & Size(size.width * _progress, 5), |
| 255 | + Paint()..color = _iconColor, | ||
| 256 | + ); | ||
| 239 | textPainter.paint( | 257 | textPainter.paint( |
| 240 | context.canvas, | 258 | context.canvas, |
| 241 | offset + | 259 | offset + |
| 242 | - Offset(size.width / 2 - textPainter.size.width / 2, | ||
| 243 | - size.height / 2 - textPainter.size.height / 2), | 260 | + Offset( |
| 261 | + size.width / 2 - textPainter.size.width / 2, | ||
| 262 | + size.height / 2 - textPainter.size.height / 2, | ||
| 263 | + ), | ||
| 244 | ); | 264 | ); |
| 245 | } | 265 | } |
| 246 | } | 266 | } |
| @@ -25,8 +25,10 @@ class CustomRb extends StatelessWidget { | @@ -25,8 +25,10 @@ class CustomRb extends StatelessWidget { | ||
| 25 | WidgetSpan( | 25 | WidgetSpan( |
| 26 | alignment: PlaceholderAlignment.middle, | 26 | alignment: PlaceholderAlignment.middle, |
| 27 | child: Padding( | 27 | child: Padding( |
| 28 | - padding: | ||
| 29 | - EdgeInsetsDirectional.only(start: spacing, end: spacing), | 28 | + padding: EdgeInsetsDirectional.only( |
| 29 | + start: spacing, | ||
| 30 | + end: spacing, | ||
| 31 | + ), | ||
| 30 | child: Radio( | 32 | child: Radio( |
| 31 | value: value, | 33 | value: value, |
| 32 | groupValue: true, | 34 | groupValue: true, |
| @@ -36,9 +38,7 @@ class CustomRb extends StatelessWidget { | @@ -36,9 +38,7 @@ class CustomRb extends StatelessWidget { | ||
| 36 | ), | 38 | ), |
| 37 | ), | 39 | ), |
| 38 | ), | 40 | ), |
| 39 | - Expanded( | ||
| 40 | - child: child, | ||
| 41 | - ) | 41 | + Expanded(child: child), |
| 42 | ], | 42 | ], |
| 43 | ), | 43 | ), |
| 44 | ); | 44 | ); |
| @@ -70,15 +70,15 @@ class CustomCb extends StatelessWidget { | @@ -70,15 +70,15 @@ class CustomCb extends StatelessWidget { | ||
| 70 | WidgetSpan( | 70 | WidgetSpan( |
| 71 | alignment: PlaceholderAlignment.middle, | 71 | alignment: PlaceholderAlignment.middle, |
| 72 | child: Padding( | 72 | child: Padding( |
| 73 | - padding: | ||
| 74 | - EdgeInsetsDirectional.only(start: spacing, end: spacing), | 73 | + padding: EdgeInsetsDirectional.only( |
| 74 | + start: spacing, | ||
| 75 | + end: spacing, | ||
| 76 | + ), | ||
| 75 | child: Checkbox(value: value, onChanged: (value) {}), | 77 | child: Checkbox(value: value, onChanged: (value) {}), |
| 76 | ), | 78 | ), |
| 77 | ), | 79 | ), |
| 78 | ), | 80 | ), |
| 79 | - Expanded( | ||
| 80 | - child: child, | ||
| 81 | - ) | 81 | + Expanded(child: child), |
| 82 | ], | 82 | ], |
| 83 | ), | 83 | ), |
| 84 | ); | 84 | ); |
| @@ -11,15 +11,16 @@ class LinkButton extends StatefulWidget { | @@ -11,15 +11,16 @@ class LinkButton extends StatefulWidget { | ||
| 11 | final Color color; | 11 | final Color color; |
| 12 | final Color hoverColor; | 12 | final Color hoverColor; |
| 13 | 13 | ||
| 14 | - const LinkButton( | ||
| 15 | - {super.key, | ||
| 16 | - required this.text, | ||
| 17 | - required this.config, | ||
| 18 | - required this.color, | ||
| 19 | - required this.hoverColor, | ||
| 20 | - this.onPressed, | ||
| 21 | - this.textStyle, | ||
| 22 | - this.url}); | 14 | + const LinkButton({ |
| 15 | + super.key, | ||
| 16 | + required this.text, | ||
| 17 | + required this.config, | ||
| 18 | + required this.color, | ||
| 19 | + required this.hoverColor, | ||
| 20 | + this.onPressed, | ||
| 21 | + this.textStyle, | ||
| 22 | + this.url, | ||
| 23 | + }); | ||
| 23 | 24 | ||
| 24 | @override | 25 | @override |
| 25 | State<LinkButton> createState() => _LinkButtonState(); | 26 | State<LinkButton> createState() => _LinkButtonState(); |
| @@ -44,12 +45,7 @@ class _LinkButtonState extends State<LinkButton> { | @@ -44,12 +45,7 @@ class _LinkButtonState extends State<LinkButton> { | ||
| 44 | onTapUp: (_) => _handlePress(false), | 45 | onTapUp: (_) => _handlePress(false), |
| 45 | onTapCancel: () => _handlePress(false), | 46 | onTapCancel: () => _handlePress(false), |
| 46 | onTap: widget.onPressed, | 47 | onTap: widget.onPressed, |
| 47 | - child: widget.config.getRich( | ||
| 48 | - TextSpan( | ||
| 49 | - text: widget.text, | ||
| 50 | - style: style, | ||
| 51 | - ), | ||
| 52 | - ), | 48 | + child: widget.config.getRich(TextSpan(text: widget.text, style: style)), |
| 53 | ), | 49 | ), |
| 54 | ); | 50 | ); |
| 55 | } | 51 | } |
| @@ -24,21 +24,37 @@ class GptMarkdownConfig { | @@ -24,21 +24,37 @@ class GptMarkdownConfig { | ||
| 24 | final void Function(String url, String title)? onLinkTab; | 24 | final void Function(String url, String title)? onLinkTab; |
| 25 | final String Function(String tex)? latexWorkaround; | 25 | final String Function(String tex)? latexWorkaround; |
| 26 | final Widget Function( | 26 | final Widget Function( |
| 27 | - BuildContext context, String tex, TextStyle textStyle, bool inline)? | ||
| 28 | - latexBuilder; | 27 | + BuildContext context, |
| 28 | + String tex, | ||
| 29 | + TextStyle textStyle, | ||
| 30 | + bool inline, | ||
| 31 | + )? | ||
| 32 | + latexBuilder; | ||
| 29 | final Widget Function( | 33 | final Widget Function( |
| 30 | - BuildContext context, String content, TextStyle textStyle)? | ||
| 31 | - sourceTagBuilder; | 34 | + BuildContext context, |
| 35 | + String content, | ||
| 36 | + TextStyle textStyle, | ||
| 37 | + )? | ||
| 38 | + sourceTagBuilder; | ||
| 32 | final bool followLinkColor; | 39 | final bool followLinkColor; |
| 33 | final Widget Function( | 40 | final Widget Function( |
| 34 | - BuildContext context, String name, String code, bool closed)? codeBuilder; | 41 | + BuildContext context, |
| 42 | + String name, | ||
| 43 | + String code, | ||
| 44 | + bool closed, | ||
| 45 | + )? | ||
| 46 | + codeBuilder; | ||
| 35 | final int? maxLines; | 47 | final int? maxLines; |
| 36 | final TextOverflow? overflow; | 48 | final TextOverflow? overflow; |
| 37 | final Widget Function(BuildContext context, String text, TextStyle style)? | 49 | final Widget Function(BuildContext context, String text, TextStyle style)? |
| 38 | - highlightBuilder; | 50 | + highlightBuilder; |
| 39 | final Widget Function( | 51 | final Widget Function( |
| 40 | - BuildContext context, String text, String url, TextStyle style)? | ||
| 41 | - linkBuilder; | 52 | + BuildContext context, |
| 53 | + String text, | ||
| 54 | + String url, | ||
| 55 | + TextStyle style, | ||
| 56 | + )? | ||
| 57 | + linkBuilder; | ||
| 42 | 58 | ||
| 43 | GptMarkdownConfig copyWith({ | 59 | GptMarkdownConfig copyWith({ |
| 44 | TextStyle? style, | 60 | TextStyle? style, |
| @@ -48,22 +64,37 @@ class GptMarkdownConfig { | @@ -48,22 +64,37 @@ class GptMarkdownConfig { | ||
| 48 | final TextScaler? textScaler, | 64 | final TextScaler? textScaler, |
| 49 | final String Function(String tex)? latexWorkaround, | 65 | final String Function(String tex)? latexWorkaround, |
| 50 | final Widget Function( | 66 | final Widget Function( |
| 51 | - BuildContext context, String tex, TextStyle textStyle, bool inline)? | ||
| 52 | - latexBuilder, | 67 | + BuildContext context, |
| 68 | + String tex, | ||
| 69 | + TextStyle textStyle, | ||
| 70 | + bool inline, | ||
| 71 | + )? | ||
| 72 | + latexBuilder, | ||
| 53 | final Widget Function( | 73 | final Widget Function( |
| 54 | - BuildContext context, String content, TextStyle textStyle)? | ||
| 55 | - sourceTagBuilder, | 74 | + BuildContext context, |
| 75 | + String content, | ||
| 76 | + TextStyle textStyle, | ||
| 77 | + )? | ||
| 78 | + sourceTagBuilder, | ||
| 56 | bool? followLinkColor, | 79 | bool? followLinkColor, |
| 57 | final Widget Function( | 80 | final Widget Function( |
| 58 | - BuildContext context, String name, String code, bool closed)? | ||
| 59 | - codeBuilder, | 81 | + BuildContext context, |
| 82 | + String name, | ||
| 83 | + String code, | ||
| 84 | + bool closed, | ||
| 85 | + )? | ||
| 86 | + codeBuilder, | ||
| 60 | final int? maxLines, | 87 | final int? maxLines, |
| 61 | final TextOverflow? overflow, | 88 | final TextOverflow? overflow, |
| 62 | final Widget Function(BuildContext context, String text, TextStyle style)? | 89 | final Widget Function(BuildContext context, String text, TextStyle style)? |
| 63 | - highlightBuilder, | 90 | + highlightBuilder, |
| 64 | final Widget Function( | 91 | final Widget Function( |
| 65 | - BuildContext context, String text, String url, TextStyle style)? | ||
| 66 | - linkBuilder, | 92 | + BuildContext context, |
| 93 | + String text, | ||
| 94 | + String url, | ||
| 95 | + TextStyle style, | ||
| 96 | + )? | ||
| 97 | + linkBuilder, | ||
| 67 | }) { | 98 | }) { |
| 68 | return GptMarkdownConfig( | 99 | return GptMarkdownConfig( |
| 69 | style: style ?? this.style, | 100 | style: style ?? this.style, |
| @@ -2,8 +2,11 @@ import 'package:flutter/material.dart'; | @@ -2,8 +2,11 @@ import 'package:flutter/material.dart'; | ||
| 2 | import 'package:flutter/rendering.dart'; | 2 | import 'package:flutter/rendering.dart'; |
| 3 | 3 | ||
| 4 | class SelectableAdapter extends StatelessWidget { | 4 | class SelectableAdapter extends StatelessWidget { |
| 5 | - const SelectableAdapter( | ||
| 6 | - {super.key, required this.child, required this.selectedText}); | 5 | + const SelectableAdapter({ |
| 6 | + super.key, | ||
| 7 | + required this.child, | ||
| 8 | + required this.selectedText, | ||
| 9 | + }); | ||
| 7 | 10 | ||
| 8 | final Widget child; | 11 | final Widget child; |
| 9 | final String selectedText; | 12 | final String selectedText; |
| @@ -17,31 +20,37 @@ class SelectableAdapter extends StatelessWidget { | @@ -17,31 +20,37 @@ class SelectableAdapter extends StatelessWidget { | ||
| 17 | return MouseRegion( | 20 | return MouseRegion( |
| 18 | cursor: SystemMouseCursors.text, | 21 | cursor: SystemMouseCursors.text, |
| 19 | child: _SelectableAdapter( | 22 | child: _SelectableAdapter( |
| 20 | - registrar: registrar, selectedText: selectedText, child: child), | 23 | + registrar: registrar, |
| 24 | + selectedText: selectedText, | ||
| 25 | + child: child, | ||
| 26 | + ), | ||
| 21 | ); | 27 | ); |
| 22 | } | 28 | } |
| 23 | } | 29 | } |
| 24 | 30 | ||
| 25 | class _SelectableAdapter extends SingleChildRenderObjectWidget { | 31 | class _SelectableAdapter extends SingleChildRenderObjectWidget { |
| 26 | - const _SelectableAdapter( | ||
| 27 | - {required this.registrar, | ||
| 28 | - required Widget child, | ||
| 29 | - required this.selectedText}) | ||
| 30 | - : super(child: child); | 32 | + const _SelectableAdapter({ |
| 33 | + required this.registrar, | ||
| 34 | + required Widget child, | ||
| 35 | + required this.selectedText, | ||
| 36 | + }) : super(child: child); | ||
| 31 | 37 | ||
| 32 | final SelectionRegistrar registrar; | 38 | final SelectionRegistrar registrar; |
| 33 | final String selectedText; | 39 | final String selectedText; |
| 34 | @override | 40 | @override |
| 35 | _RenderSelectableAdapter createRenderObject(BuildContext context) { | 41 | _RenderSelectableAdapter createRenderObject(BuildContext context) { |
| 36 | return _RenderSelectableAdapter( | 42 | return _RenderSelectableAdapter( |
| 37 | - DefaultSelectionStyle.of(context).selectionColor!, | ||
| 38 | - registrar, | ||
| 39 | - selectedText); | 43 | + DefaultSelectionStyle.of(context).selectionColor!, |
| 44 | + registrar, | ||
| 45 | + selectedText, | ||
| 46 | + ); | ||
| 40 | } | 47 | } |
| 41 | 48 | ||
| 42 | @override | 49 | @override |
| 43 | void updateRenderObject( | 50 | void updateRenderObject( |
| 44 | - BuildContext context, _RenderSelectableAdapter renderObject) { | 51 | + BuildContext context, |
| 52 | + _RenderSelectableAdapter renderObject, | ||
| 53 | + ) { | ||
| 45 | renderObject | 54 | renderObject |
| 46 | ..selectionColor = DefaultSelectionStyle.of(context).selectionColor! | 55 | ..selectionColor = DefaultSelectionStyle.of(context).selectionColor! |
| 47 | ..registrar = registrar; | 56 | ..registrar = registrar; |
| @@ -51,9 +60,11 @@ class _SelectableAdapter extends SingleChildRenderObjectWidget { | @@ -51,9 +60,11 @@ class _SelectableAdapter extends SingleChildRenderObjectWidget { | ||
| 51 | class _RenderSelectableAdapter extends RenderProxyBox | 60 | class _RenderSelectableAdapter extends RenderProxyBox |
| 52 | with Selectable, SelectionRegistrant { | 61 | with Selectable, SelectionRegistrant { |
| 53 | _RenderSelectableAdapter( | 62 | _RenderSelectableAdapter( |
| 54 | - Color selectionColor, SelectionRegistrar registrar, this.selectedText) | ||
| 55 | - : _selectionColor = selectionColor, | ||
| 56 | - _geometry = ValueNotifier<SelectionGeometry>(_noSelection) { | 63 | + Color selectionColor, |
| 64 | + SelectionRegistrar registrar, | ||
| 65 | + this.selectedText, | ||
| 66 | + ) : _selectionColor = selectionColor, | ||
| 67 | + _geometry = ValueNotifier<SelectionGeometry>(_noSelection) { | ||
| 57 | this.registrar = registrar; | 68 | this.registrar = registrar; |
| 58 | _geometry.addListener(markNeedsPaint); | 69 | _geometry.addListener(markNeedsPaint); |
| 59 | } | 70 | } |
| @@ -152,13 +163,20 @@ class _RenderSelectableAdapter extends RenderProxyBox | @@ -152,13 +163,20 @@ class _RenderSelectableAdapter extends RenderProxyBox | ||
| 152 | switch (event.type) { | 163 | switch (event.type) { |
| 153 | case SelectionEventType.startEdgeUpdate: | 164 | case SelectionEventType.startEdgeUpdate: |
| 154 | case SelectionEventType.endEdgeUpdate: | 165 | case SelectionEventType.endEdgeUpdate: |
| 155 | - final Rect renderObjectRect = | ||
| 156 | - Rect.fromLTWH(0, 0, size.width, size.height); | 166 | + final Rect renderObjectRect = Rect.fromLTWH( |
| 167 | + 0, | ||
| 168 | + 0, | ||
| 169 | + size.width, | ||
| 170 | + size.height, | ||
| 171 | + ); | ||
| 157 | // Normalize offset in case it is out side of the rect. | 172 | // Normalize offset in case it is out side of the rect. |
| 158 | - final Offset point = | ||
| 159 | - globalToLocal((event as SelectionEdgeUpdateEvent).globalPosition); | ||
| 160 | - final Offset adjustedPoint = | ||
| 161 | - SelectionUtils.adjustDragOffset(renderObjectRect, point); | 173 | + final Offset point = globalToLocal( |
| 174 | + (event as SelectionEdgeUpdateEvent).globalPosition, | ||
| 175 | + ); | ||
| 176 | + final Offset adjustedPoint = SelectionUtils.adjustDragOffset( | ||
| 177 | + renderObjectRect, | ||
| 178 | + point, | ||
| 179 | + ); | ||
| 162 | if (event.type == SelectionEventType.startEdgeUpdate) { | 180 | if (event.type == SelectionEventType.startEdgeUpdate) { |
| 163 | _start = adjustedPoint; | 181 | _start = adjustedPoint; |
| 164 | } else { | 182 | } else { |
| @@ -189,16 +207,18 @@ class _RenderSelectableAdapter extends RenderProxyBox | @@ -189,16 +207,18 @@ class _RenderSelectableAdapter extends RenderProxyBox | ||
| 189 | extendSelectionEvent.forward ? Offset.infinite : Offset.zero; | 207 | extendSelectionEvent.forward ? Offset.infinite : Offset.zero; |
| 190 | if (extendSelectionEvent.isEnd) { | 208 | if (extendSelectionEvent.isEnd) { |
| 191 | if (newOffset == _end) { | 209 | if (newOffset == _end) { |
| 192 | - result = extendSelectionEvent.forward | ||
| 193 | - ? SelectionResult.next | ||
| 194 | - : SelectionResult.previous; | 210 | + result = |
| 211 | + extendSelectionEvent.forward | ||
| 212 | + ? SelectionResult.next | ||
| 213 | + : SelectionResult.previous; | ||
| 195 | } | 214 | } |
| 196 | _end = newOffset; | 215 | _end = newOffset; |
| 197 | } else { | 216 | } else { |
| 198 | if (newOffset == _start) { | 217 | if (newOffset == _start) { |
| 199 | - result = extendSelectionEvent.forward | ||
| 200 | - ? SelectionResult.next | ||
| 201 | - : SelectionResult.previous; | 218 | + result = |
| 219 | + extendSelectionEvent.forward | ||
| 220 | + ? SelectionResult.next | ||
| 221 | + : SelectionResult.previous; | ||
| 202 | } | 222 | } |
| 203 | _start = newOffset; | 223 | _start = newOffset; |
| 204 | } | 224 | } |
| @@ -296,18 +316,22 @@ class _RenderSelectableAdapter extends RenderProxyBox | @@ -296,18 +316,22 @@ class _RenderSelectableAdapter extends RenderProxyBox | ||
| 296 | return; | 316 | return; |
| 297 | } | 317 | } |
| 298 | // Draw the selection highlight. | 318 | // Draw the selection highlight. |
| 299 | - final Paint selectionPaint = Paint() | ||
| 300 | - ..style = PaintingStyle.fill | ||
| 301 | - ..color = _selectionColor; | ||
| 302 | - context.canvas | ||
| 303 | - .drawRect(_getSelectionHighlightRect().shift(offset), selectionPaint); | 319 | + final Paint selectionPaint = |
| 320 | + Paint() | ||
| 321 | + ..style = PaintingStyle.fill | ||
| 322 | + ..color = _selectionColor; | ||
| 323 | + context.canvas.drawRect( | ||
| 324 | + _getSelectionHighlightRect().shift(offset), | ||
| 325 | + selectionPaint, | ||
| 326 | + ); | ||
| 304 | 327 | ||
| 305 | // Push the layer links if any. | 328 | // Push the layer links if any. |
| 306 | if (_startHandle != null) { | 329 | if (_startHandle != null) { |
| 307 | context.pushLayer( | 330 | context.pushLayer( |
| 308 | LeaderLayer( | 331 | LeaderLayer( |
| 309 | - link: _startHandle!, | ||
| 310 | - offset: offset + value.startSelectionPoint!.localPosition), | 332 | + link: _startHandle!, |
| 333 | + offset: offset + value.startSelectionPoint!.localPosition, | ||
| 334 | + ), | ||
| 311 | (PaintingContext context, Offset offset) {}, | 335 | (PaintingContext context, Offset offset) {}, |
| 312 | Offset.zero, | 336 | Offset.zero, |
| 313 | ); | 337 | ); |
| @@ -315,8 +339,9 @@ class _RenderSelectableAdapter extends RenderProxyBox | @@ -315,8 +339,9 @@ class _RenderSelectableAdapter extends RenderProxyBox | ||
| 315 | if (_endHandle != null) { | 339 | if (_endHandle != null) { |
| 316 | context.pushLayer( | 340 | context.pushLayer( |
| 317 | LeaderLayer( | 341 | LeaderLayer( |
| 318 | - link: _endHandle!, | ||
| 319 | - offset: offset + value.endSelectionPoint!.localPosition), | 342 | + link: _endHandle!, |
| 343 | + offset: offset + value.endSelectionPoint!.localPosition, | ||
| 344 | + ), | ||
| 320 | (PaintingContext context, Offset offset) {}, | 345 | (PaintingContext context, Offset offset) {}, |
| 321 | Offset.zero, | 346 | Offset.zero, |
| 322 | ); | 347 | ); |
| @@ -26,16 +26,16 @@ class UnorderedListView extends StatelessWidget { | @@ -26,16 +26,16 @@ class UnorderedListView extends StatelessWidget { | ||
| 26 | crossAxisAlignment: CrossAxisAlignment.baseline, | 26 | crossAxisAlignment: CrossAxisAlignment.baseline, |
| 27 | children: [ | 27 | children: [ |
| 28 | if (bulletSize == 0) | 28 | if (bulletSize == 0) |
| 29 | - SizedBox( | ||
| 30 | - width: spacing + padding, | ||
| 31 | - ) | 29 | + SizedBox(width: spacing + padding) |
| 32 | else | 30 | else |
| 33 | Text.rich( | 31 | Text.rich( |
| 34 | WidgetSpan( | 32 | WidgetSpan( |
| 35 | alignment: PlaceholderAlignment.middle, | 33 | alignment: PlaceholderAlignment.middle, |
| 36 | child: Padding( | 34 | child: Padding( |
| 37 | - padding: | ||
| 38 | - EdgeInsetsDirectional.only(start: padding, end: spacing), | 35 | + padding: EdgeInsetsDirectional.only( |
| 36 | + start: padding, | ||
| 37 | + end: spacing, | ||
| 38 | + ), | ||
| 39 | child: Container( | 39 | child: Container( |
| 40 | width: bulletSize, | 40 | width: bulletSize, |
| 41 | height: bulletSize, | 41 | height: bulletSize, |
| @@ -47,9 +47,7 @@ class UnorderedListView extends StatelessWidget { | @@ -47,9 +47,7 @@ class UnorderedListView extends StatelessWidget { | ||
| 47 | ), | 47 | ), |
| 48 | ), | 48 | ), |
| 49 | ), | 49 | ), |
| 50 | - Expanded( | ||
| 51 | - child: child, | ||
| 52 | - ) | 50 | + Expanded(child: child), |
| 53 | ], | 51 | ], |
| 54 | ), | 52 | ), |
| 55 | ); | 53 | ); |
| @@ -60,15 +58,15 @@ class OrderedListView extends StatelessWidget { | @@ -60,15 +58,15 @@ class OrderedListView extends StatelessWidget { | ||
| 60 | final String no; | 58 | final String no; |
| 61 | final double spacing; | 59 | final double spacing; |
| 62 | final double padding; | 60 | final double padding; |
| 63 | - const OrderedListView( | ||
| 64 | - {super.key, | ||
| 65 | - this.spacing = 6, | ||
| 66 | - this.padding = 6, | ||
| 67 | - TextStyle? style, | ||
| 68 | - required this.child, | ||
| 69 | - this.textDirection = TextDirection.ltr, | ||
| 70 | - required this.no}) | ||
| 71 | - : _style = style; | 61 | + const OrderedListView({ |
| 62 | + super.key, | ||
| 63 | + this.spacing = 6, | ||
| 64 | + this.padding = 6, | ||
| 65 | + TextStyle? style, | ||
| 66 | + required this.child, | ||
| 67 | + this.textDirection = TextDirection.ltr, | ||
| 68 | + required this.no, | ||
| 69 | + }) : _style = style; | ||
| 72 | final TextStyle? _style; | 70 | final TextStyle? _style; |
| 73 | final TextDirection textDirection; | 71 | final TextDirection textDirection; |
| 74 | final Widget child; | 72 | final Widget child; |
| @@ -83,16 +81,9 @@ class OrderedListView extends StatelessWidget { | @@ -83,16 +81,9 @@ class OrderedListView extends StatelessWidget { | ||
| 83 | children: [ | 81 | children: [ |
| 84 | Padding( | 82 | Padding( |
| 85 | padding: EdgeInsetsDirectional.only(start: padding, end: spacing), | 83 | padding: EdgeInsetsDirectional.only(start: padding, end: spacing), |
| 86 | - child: Text.rich( | ||
| 87 | - TextSpan( | ||
| 88 | - text: no, | ||
| 89 | - ), | ||
| 90 | - style: _style, | ||
| 91 | - ), | 84 | + child: Text.rich(TextSpan(text: no), style: _style), |
| 92 | ), | 85 | ), |
| 93 | - Expanded( | ||
| 94 | - child: child, | ||
| 95 | - ) | 86 | + Expanded(child: child), |
| 96 | ], | 87 | ], |
| 97 | ), | 88 | ), |
| 98 | ); | 89 | ); |
| @@ -48,44 +48,52 @@ class GptMarkdown extends StatelessWidget { | @@ -48,44 +48,52 @@ class GptMarkdown extends StatelessWidget { | ||
| 48 | final int? maxLines; | 48 | final int? maxLines; |
| 49 | final TextOverflow? overflow; | 49 | final TextOverflow? overflow; |
| 50 | final Widget Function( | 50 | final Widget Function( |
| 51 | - BuildContext context, String tex, TextStyle style, bool inline)? | ||
| 52 | - latexBuilder; | 51 | + BuildContext context, |
| 52 | + String tex, | ||
| 53 | + TextStyle style, | ||
| 54 | + bool inline, | ||
| 55 | + )? | ||
| 56 | + latexBuilder; | ||
| 53 | final bool followLinkColor; | 57 | final bool followLinkColor; |
| 54 | final Widget Function( | 58 | final Widget Function( |
| 55 | - BuildContext context, String name, String code, bool closed)? codeBuilder; | 59 | + BuildContext context, |
| 60 | + String name, | ||
| 61 | + String code, | ||
| 62 | + bool closed, | ||
| 63 | + )? | ||
| 64 | + codeBuilder; | ||
| 56 | final Widget Function(BuildContext, String, TextStyle)? sourceTagBuilder; | 65 | final Widget Function(BuildContext, String, TextStyle)? sourceTagBuilder; |
| 57 | final Widget Function(BuildContext context, String text, TextStyle style)? | 66 | final Widget Function(BuildContext context, String text, TextStyle style)? |
| 58 | - highlightBuilder; | 67 | + highlightBuilder; |
| 59 | final Widget Function( | 68 | final Widget Function( |
| 60 | - BuildContext context, String text, String url, TextStyle style)? | ||
| 61 | - linkBuilder; | 69 | + BuildContext context, |
| 70 | + String text, | ||
| 71 | + String url, | ||
| 72 | + TextStyle style, | ||
| 73 | + )? | ||
| 74 | + linkBuilder; | ||
| 62 | String _removeExtraLinesInsideBlockLatex(String text) { | 75 | String _removeExtraLinesInsideBlockLatex(String text) { |
| 63 | return text.replaceAllMapped( | 76 | return text.replaceAllMapped( |
| 64 | - RegExp( | ||
| 65 | - r"\\\[(.*?)\\\]", | ||
| 66 | - multiLine: true, | ||
| 67 | - dotAll: true, | ||
| 68 | - ), (match) { | ||
| 69 | - String content = match[0] ?? ""; | ||
| 70 | - return content.replaceAllMapped(RegExp(r"\n[\n\ ]+"), (match) => "\n"); | ||
| 71 | - }); | 77 | + RegExp(r"\\\[(.*?)\\\]", multiLine: true, dotAll: true), |
| 78 | + (match) { | ||
| 79 | + String content = match[0] ?? ""; | ||
| 80 | + return content.replaceAllMapped(RegExp(r"\n[\n\ ]+"), (match) => "\n"); | ||
| 81 | + }, | ||
| 82 | + ); | ||
| 72 | } | 83 | } |
| 73 | 84 | ||
| 74 | @override | 85 | @override |
| 75 | Widget build(BuildContext context) { | 86 | Widget build(BuildContext context) { |
| 76 | String tex = data.trim(); | 87 | String tex = data.trim(); |
| 77 | tex = tex.replaceAllMapped( | 88 | tex = tex.replaceAllMapped( |
| 78 | - RegExp( | ||
| 79 | - r"(?<!\\)\$\$(.*?)(?<!\\)\$\$", | ||
| 80 | - dotAll: true, | ||
| 81 | - ), | ||
| 82 | - (match) => "\\[${match[1] ?? ""}\\]"); | 89 | + RegExp(r"(?<!\\)\$\$(.*?)(?<!\\)\$\$", dotAll: true), |
| 90 | + (match) => "\\[${match[1] ?? ""}\\]", | ||
| 91 | + ); | ||
| 83 | if (!tex.contains(r"\(")) { | 92 | if (!tex.contains(r"\(")) { |
| 84 | tex = tex.replaceAllMapped( | 93 | tex = tex.replaceAllMapped( |
| 85 | - RegExp( | ||
| 86 | - r"(?<!\\)\$(.*?)(?<!\\)\$", | ||
| 87 | - ), | ||
| 88 | - (match) => "\\(${match[1] ?? ""}\\)"); | 94 | + RegExp(r"(?<!\\)\$(.*?)(?<!\\)\$"), |
| 95 | + (match) => "\\(${match[1] ?? ""}\\)", | ||
| 96 | + ); | ||
| 89 | tex = tex.splitMapJoin( | 97 | tex = tex.splitMapJoin( |
| 90 | RegExp(r"\[.*?\]|\(.*?\)"), | 98 | RegExp(r"\[.*?\]|\(.*?\)"), |
| 91 | onNonMatch: (p0) { | 99 | onNonMatch: (p0) { |
| @@ -95,24 +103,25 @@ class GptMarkdown extends StatelessWidget { | @@ -95,24 +103,25 @@ class GptMarkdown extends StatelessWidget { | ||
| 95 | } | 103 | } |
| 96 | tex = _removeExtraLinesInsideBlockLatex(tex); | 104 | tex = _removeExtraLinesInsideBlockLatex(tex); |
| 97 | return ClipRRect( | 105 | return ClipRRect( |
| 98 | - child: MdWidget( | ||
| 99 | - tex, | ||
| 100 | - config: GptMarkdownConfig( | ||
| 101 | - textDirection: textDirection, | ||
| 102 | - style: style, | ||
| 103 | - onLinkTab: onLinkTab, | ||
| 104 | - textAlign: textAlign, | ||
| 105 | - textScaler: textScaler, | ||
| 106 | - followLinkColor: followLinkColor, | ||
| 107 | - latexWorkaround: latexWorkaround, | ||
| 108 | - latexBuilder: latexBuilder, | ||
| 109 | - codeBuilder: codeBuilder, | ||
| 110 | - maxLines: maxLines, | ||
| 111 | - overflow: overflow, | ||
| 112 | - sourceTagBuilder: sourceTagBuilder, | ||
| 113 | - highlightBuilder: highlightBuilder, | ||
| 114 | - linkBuilder: linkBuilder, | 106 | + child: MdWidget( |
| 107 | + tex, | ||
| 108 | + config: GptMarkdownConfig( | ||
| 109 | + textDirection: textDirection, | ||
| 110 | + style: style, | ||
| 111 | + onLinkTab: onLinkTab, | ||
| 112 | + textAlign: textAlign, | ||
| 113 | + textScaler: textScaler, | ||
| 114 | + followLinkColor: followLinkColor, | ||
| 115 | + latexWorkaround: latexWorkaround, | ||
| 116 | + latexBuilder: latexBuilder, | ||
| 117 | + codeBuilder: codeBuilder, | ||
| 118 | + maxLines: maxLines, | ||
| 119 | + overflow: overflow, | ||
| 120 | + sourceTagBuilder: sourceTagBuilder, | ||
| 121 | + highlightBuilder: highlightBuilder, | ||
| 122 | + linkBuilder: linkBuilder, | ||
| 123 | + ), | ||
| 115 | ), | 124 | ), |
| 116 | - )); | 125 | + ); |
| 117 | } | 126 | } |
| 118 | } | 127 | } |
| @@ -3,27 +3,27 @@ part of 'gpt_markdown.dart'; | @@ -3,27 +3,27 @@ part of 'gpt_markdown.dart'; | ||
| 3 | /// Markdown components | 3 | /// Markdown components |
| 4 | abstract class MarkdownComponent { | 4 | abstract class MarkdownComponent { |
| 5 | static List<MarkdownComponent> get components => [ | 5 | static List<MarkdownComponent> get components => [ |
| 6 | - CodeBlockMd(), | ||
| 7 | - NewLines(), | ||
| 8 | - IndentMd(), | ||
| 9 | - ImageMd(), | ||
| 10 | - TableMd(), | ||
| 11 | - HTag(), | ||
| 12 | - UnOrderedList(), | ||
| 13 | - OrderedList(), | ||
| 14 | - RadioButtonMd(), | ||
| 15 | - CheckBoxMd(), | ||
| 16 | - HrLine(), | ||
| 17 | - LatexMath(), | ||
| 18 | - LatexMathMultiLine(), | ||
| 19 | - ImageMd(), | ||
| 20 | - HighlightedText(), | ||
| 21 | - StrikeMd(), | ||
| 22 | - BoldMd(), | ||
| 23 | - ItalicMd(), | ||
| 24 | - ATagMd(), | ||
| 25 | - SourceTag(), | ||
| 26 | - ]; | 6 | + CodeBlockMd(), |
| 7 | + NewLines(), | ||
| 8 | + IndentMd(), | ||
| 9 | + ImageMd(), | ||
| 10 | + TableMd(), | ||
| 11 | + HTag(), | ||
| 12 | + UnOrderedList(), | ||
| 13 | + OrderedList(), | ||
| 14 | + RadioButtonMd(), | ||
| 15 | + CheckBoxMd(), | ||
| 16 | + HrLine(), | ||
| 17 | + LatexMath(), | ||
| 18 | + LatexMathMultiLine(), | ||
| 19 | + ImageMd(), | ||
| 20 | + HighlightedText(), | ||
| 21 | + StrikeMd(), | ||
| 22 | + BoldMd(), | ||
| 23 | + ItalicMd(), | ||
| 24 | + ATagMd(), | ||
| 25 | + SourceTag(), | ||
| 26 | + ]; | ||
| 27 | 27 | ||
| 28 | /// Generate widget for markdown widget | 28 | /// Generate widget for markdown widget |
| 29 | static List<InlineSpan> generate( | 29 | static List<InlineSpan> generate( |
| @@ -46,11 +46,7 @@ abstract class MarkdownComponent { | @@ -46,11 +46,7 @@ abstract class MarkdownComponent { | ||
| 46 | for (var each in components) { | 46 | for (var each in components) { |
| 47 | if (each.exp.hasMatch(element)) { | 47 | if (each.exp.hasMatch(element)) { |
| 48 | if (each.inline) { | 48 | if (each.inline) { |
| 49 | - spans.add(each.span( | ||
| 50 | - context, | ||
| 51 | - element, | ||
| 52 | - config, | ||
| 53 | - )); | 49 | + spans.add(each.span(context, element, config)); |
| 54 | } else { | 50 | } else { |
| 55 | spans.addAll([ | 51 | spans.addAll([ |
| 56 | TextSpan( | 52 | TextSpan( |
| @@ -61,11 +57,7 @@ abstract class MarkdownComponent { | @@ -61,11 +57,7 @@ abstract class MarkdownComponent { | ||
| 61 | color: config.style?.color, | 57 | color: config.style?.color, |
| 62 | ), | 58 | ), |
| 63 | ), | 59 | ), |
| 64 | - each.span( | ||
| 65 | - context, | ||
| 66 | - element, | ||
| 67 | - config, | ||
| 68 | - ), | 60 | + each.span(context, element, config), |
| 69 | TextSpan( | 61 | TextSpan( |
| 70 | text: "\n ", | 62 | text: "\n ", |
| 71 | style: TextStyle( | 63 | style: TextStyle( |
| @@ -82,12 +74,7 @@ abstract class MarkdownComponent { | @@ -82,12 +74,7 @@ abstract class MarkdownComponent { | ||
| 82 | return ""; | 74 | return ""; |
| 83 | }, | 75 | }, |
| 84 | onNonMatch: (p0) { | 76 | onNonMatch: (p0) { |
| 85 | - spans.add( | ||
| 86 | - TextSpan( | ||
| 87 | - text: p0, | ||
| 88 | - style: config.style, | ||
| 89 | - ), | ||
| 90 | - ); | 77 | + spans.add(TextSpan(text: p0, style: config.style)); |
| 91 | return ""; | 78 | return ""; |
| 92 | }, | 79 | }, |
| 93 | ); | 80 | ); |
| @@ -124,11 +111,7 @@ abstract class BlockMd extends MarkdownComponent { | @@ -124,11 +111,7 @@ abstract class BlockMd extends MarkdownComponent { | ||
| 124 | bool get inline => false; | 111 | bool get inline => false; |
| 125 | 112 | ||
| 126 | @override | 113 | @override |
| 127 | - RegExp get exp => RegExp( | ||
| 128 | - r'^\ *?' + expString, | ||
| 129 | - dotAll: true, | ||
| 130 | - multiLine: true, | ||
| 131 | - ); | 114 | + RegExp get exp => RegExp(r'^\ *?' + expString, dotAll: true, multiLine: true); |
| 132 | 115 | ||
| 133 | String get expString; | 116 | String get expString; |
| 134 | 117 | ||
| @@ -141,22 +124,12 @@ abstract class BlockMd extends MarkdownComponent { | @@ -141,22 +124,12 @@ abstract class BlockMd extends MarkdownComponent { | ||
| 141 | var matches = RegExp(r'^(?<spaces>\ \ +).*').firstMatch(text); | 124 | var matches = RegExp(r'^(?<spaces>\ \ +).*').firstMatch(text); |
| 142 | var spaces = matches?.namedGroup('spaces'); | 125 | var spaces = matches?.namedGroup('spaces'); |
| 143 | var length = spaces?.length ?? 0; | 126 | var length = spaces?.length ?? 0; |
| 144 | - var child = build( | ||
| 145 | - context, | ||
| 146 | - text, | ||
| 147 | - config, | ||
| 148 | - ); | 127 | + var child = build(context, text, config); |
| 149 | length = min(length, 4); | 128 | length = min(length, 4); |
| 150 | if (length > 0) { | 129 | if (length > 0) { |
| 151 | - child = UnorderedListView( | ||
| 152 | - spacing: length * 6.0, | ||
| 153 | - child: child, | ||
| 154 | - ); | 130 | + child = UnorderedListView(spacing: length * 6.0, child: child); |
| 155 | } | 131 | } |
| 156 | - return WidgetSpan( | ||
| 157 | - child: child, | ||
| 158 | - alignment: PlaceholderAlignment.middle, | ||
| 159 | - ); | 132 | + return WidgetSpan(child: child, alignment: PlaceholderAlignment.middle); |
| 160 | } | 133 | } |
| 161 | 134 | ||
| 162 | Widget build( | 135 | Widget build( |
| @@ -186,10 +159,7 @@ class HTag extends BlockMd { | @@ -186,10 +159,7 @@ class HTag extends BlockMd { | ||
| 186 | theme.h4, | 159 | theme.h4, |
| 187 | theme.h5, | 160 | theme.h5, |
| 188 | theme.h6, | 161 | theme.h6, |
| 189 | - ][match![1]!.length - 1] | ||
| 190 | - ?.copyWith( | ||
| 191 | - color: config.style?.color, | ||
| 192 | - ), | 162 | + ][match![1]!.length - 1]?.copyWith(color: config.style?.color), |
| 193 | ); | 163 | ); |
| 194 | return config.getRich( | 164 | return config.getRich( |
| 195 | TextSpan( | 165 | TextSpan( |
| @@ -207,7 +177,8 @@ class HTag extends BlockMd { | @@ -207,7 +177,8 @@ class HTag extends BlockMd { | ||
| 207 | WidgetSpan( | 177 | WidgetSpan( |
| 208 | child: CustomDivider( | 178 | child: CustomDivider( |
| 209 | height: theme.hrLineThickness, | 179 | height: theme.hrLineThickness, |
| 210 | - color: config.style?.color ?? | 180 | + color: |
| 181 | + config.style?.color ?? | ||
| 211 | Theme.of(context).colorScheme.outline, | 182 | Theme.of(context).colorScheme.outline, |
| 212 | ), | 183 | ), |
| 213 | ), | 184 | ), |
| @@ -229,10 +200,7 @@ class NewLines extends InlineMd { | @@ -229,10 +200,7 @@ class NewLines extends InlineMd { | ||
| 229 | ) { | 200 | ) { |
| 230 | return TextSpan( | 201 | return TextSpan( |
| 231 | text: "\n\n\n\n", | 202 | text: "\n\n\n\n", |
| 232 | - style: TextStyle( | ||
| 233 | - fontSize: 6, | ||
| 234 | - color: config.style?.color, | ||
| 235 | - ), | 203 | + style: TextStyle(fontSize: 6, color: config.style?.color), |
| 236 | ); | 204 | ); |
| 237 | } | 205 | } |
| 238 | } | 206 | } |
| @@ -272,10 +240,7 @@ class CheckBoxMd extends BlockMd { | @@ -272,10 +240,7 @@ class CheckBoxMd extends BlockMd { | ||
| 272 | return CustomCb( | 240 | return CustomCb( |
| 273 | value: ("${match?[1]}" == "x"), | 241 | value: ("${match?[1]}" == "x"), |
| 274 | textDirection: config.textDirection, | 242 | textDirection: config.textDirection, |
| 275 | - child: MdWidget( | ||
| 276 | - "${match?[2]}", | ||
| 277 | - config: config, | ||
| 278 | - ), | 243 | + child: MdWidget("${match?[2]}", config: config), |
| 279 | ); | 244 | ); |
| 280 | } | 245 | } |
| 281 | } | 246 | } |
| @@ -296,10 +261,7 @@ class RadioButtonMd extends BlockMd { | @@ -296,10 +261,7 @@ class RadioButtonMd extends BlockMd { | ||
| 296 | return CustomRb( | 261 | return CustomRb( |
| 297 | value: ("${match?[1]}" == "x"), | 262 | value: ("${match?[1]}" == "x"), |
| 298 | textDirection: config.textDirection, | 263 | textDirection: config.textDirection, |
| 299 | - child: MdWidget( | ||
| 300 | - "${match?[2]}", | ||
| 301 | - config: config, | ||
| 302 | - ), | 264 | + child: MdWidget("${match?[2]}", config: config), |
| 303 | ); | 265 | ); |
| 304 | } | 266 | } |
| 305 | } | 267 | } |
| @@ -310,8 +272,8 @@ class IndentMd extends InlineMd { | @@ -310,8 +272,8 @@ class IndentMd extends InlineMd { | ||
| 310 | bool get inline => false; | 272 | bool get inline => false; |
| 311 | @override | 273 | @override |
| 312 | RegExp get exp => | 274 | RegExp get exp => |
| 313 | - // RegExp(r"(?<=\n\n)(\ +)(.+?)(?=\n\n)", dotAll: true, multiLine: true); | ||
| 314 | - RegExp(r"^>([^\n]+)$", dotAll: true, multiLine: true); | 275 | + // RegExp(r"(?<=\n\n)(\ +)(.+?)(?=\n\n)", dotAll: true, multiLine: true); |
| 276 | + RegExp(r"^>([^\n]+)$", dotAll: true, multiLine: true); | ||
| 315 | 277 | ||
| 316 | @override | 278 | @override |
| 317 | InlineSpan span( | 279 | InlineSpan span( |
| @@ -324,11 +286,7 @@ class IndentMd extends InlineMd { | @@ -324,11 +286,7 @@ class IndentMd extends InlineMd { | ||
| 324 | // data = data.replaceAll(RegExp(r'\n\ {' '$spaces' '}'), '\n').trim(); | 286 | // data = data.replaceAll(RegExp(r'\n\ {' '$spaces' '}'), '\n').trim(); |
| 325 | data = data.trim(); | 287 | data = data.trim(); |
| 326 | var child = TextSpan( | 288 | var child = TextSpan( |
| 327 | - children: MarkdownComponent.generate( | ||
| 328 | - context, | ||
| 329 | - data, | ||
| 330 | - config, | ||
| 331 | - ), | 289 | + children: MarkdownComponent.generate(context, data, config), |
| 332 | ); | 290 | ); |
| 333 | return TextSpan( | 291 | return TextSpan( |
| 334 | children: [ | 292 | children: [ |
| @@ -370,15 +328,13 @@ class UnOrderedList extends BlockMd { | @@ -370,15 +328,13 @@ class UnOrderedList extends BlockMd { | ||
| 370 | (config.style?.color ?? DefaultTextStyle.of(context).style.color), | 328 | (config.style?.color ?? DefaultTextStyle.of(context).style.color), |
| 371 | padding: 7, | 329 | padding: 7, |
| 372 | spacing: 10, | 330 | spacing: 10, |
| 373 | - bulletSize: 0.3 * | 331 | + bulletSize: |
| 332 | + 0.3 * | ||
| 374 | (config.style?.fontSize ?? | 333 | (config.style?.fontSize ?? |
| 375 | DefaultTextStyle.of(context).style.fontSize ?? | 334 | DefaultTextStyle.of(context).style.fontSize ?? |
| 376 | kDefaultFontSize), | 335 | kDefaultFontSize), |
| 377 | textDirection: config.textDirection, | 336 | textDirection: config.textDirection, |
| 378 | - child: MdWidget( | ||
| 379 | - "${match?[1]?.trim()}", | ||
| 380 | - config: config, | ||
| 381 | - ), | 337 | + child: MdWidget("${match?[1]?.trim()}", config: config), |
| 382 | ); | 338 | ); |
| 383 | } | 339 | } |
| 384 | } | 340 | } |
| @@ -398,12 +354,10 @@ class OrderedList extends BlockMd { | @@ -398,12 +354,10 @@ class OrderedList extends BlockMd { | ||
| 398 | return OrderedListView( | 354 | return OrderedListView( |
| 399 | no: "${match?[1]}", | 355 | no: "${match?[1]}", |
| 400 | textDirection: config.textDirection, | 356 | textDirection: config.textDirection, |
| 401 | - style: (config.style ?? const TextStyle()) | ||
| 402 | - .copyWith(fontWeight: FontWeight.w100), | ||
| 403 | - child: MdWidget( | ||
| 404 | - "${match?[2]?.trim()}", | ||
| 405 | - config: config, | 357 | + style: (config.style ?? const TextStyle()).copyWith( |
| 358 | + fontWeight: FontWeight.w100, | ||
| 406 | ), | 359 | ), |
| 360 | + child: MdWidget("${match?[2]?.trim()}", config: config), | ||
| 407 | ); | 361 | ); |
| 408 | } | 362 | } |
| 409 | } | 363 | } |
| @@ -432,25 +386,25 @@ class HighlightedText extends InlineMd { | @@ -432,25 +386,25 @@ class HighlightedText extends InlineMd { | ||
| 432 | ); | 386 | ); |
| 433 | } | 387 | } |
| 434 | 388 | ||
| 435 | - var style = config.style?.copyWith( | 389 | + var style = |
| 390 | + config.style?.copyWith( | ||
| 436 | fontWeight: FontWeight.bold, | 391 | fontWeight: FontWeight.bold, |
| 437 | - background: Paint() | ||
| 438 | - ..color = GptMarkdownTheme.of(context).highlightColor | ||
| 439 | - ..strokeCap = StrokeCap.round | ||
| 440 | - ..strokeJoin = StrokeJoin.round, | 392 | + background: |
| 393 | + Paint() | ||
| 394 | + ..color = GptMarkdownTheme.of(context).highlightColor | ||
| 395 | + ..strokeCap = StrokeCap.round | ||
| 396 | + ..strokeJoin = StrokeJoin.round, | ||
| 441 | ) ?? | 397 | ) ?? |
| 442 | TextStyle( | 398 | TextStyle( |
| 443 | fontWeight: FontWeight.bold, | 399 | fontWeight: FontWeight.bold, |
| 444 | - background: Paint() | ||
| 445 | - ..color = GptMarkdownTheme.of(context).highlightColor | ||
| 446 | - ..strokeCap = StrokeCap.round | ||
| 447 | - ..strokeJoin = StrokeJoin.round, | 400 | + background: |
| 401 | + Paint() | ||
| 402 | + ..color = GptMarkdownTheme.of(context).highlightColor | ||
| 403 | + ..strokeCap = StrokeCap.round | ||
| 404 | + ..strokeJoin = StrokeJoin.round, | ||
| 448 | ); | 405 | ); |
| 449 | 406 | ||
| 450 | - return TextSpan( | ||
| 451 | - text: highlightedText, | ||
| 452 | - style: style, | ||
| 453 | - ); | 407 | + return TextSpan(text: highlightedText, style: style); |
| 454 | } | 408 | } |
| 455 | } | 409 | } |
| 456 | 410 | ||
| @@ -467,14 +421,12 @@ class BoldMd extends InlineMd { | @@ -467,14 +421,12 @@ class BoldMd extends InlineMd { | ||
| 467 | ) { | 421 | ) { |
| 468 | var match = exp.firstMatch(text.trim()); | 422 | var match = exp.firstMatch(text.trim()); |
| 469 | var conf = config.copyWith( | 423 | var conf = config.copyWith( |
| 470 | - style: config.style?.copyWith(fontWeight: FontWeight.bold) ?? | ||
| 471 | - const TextStyle(fontWeight: FontWeight.bold)); | 424 | + style: |
| 425 | + config.style?.copyWith(fontWeight: FontWeight.bold) ?? | ||
| 426 | + const TextStyle(fontWeight: FontWeight.bold), | ||
| 427 | + ); | ||
| 472 | return TextSpan( | 428 | return TextSpan( |
| 473 | - children: MarkdownComponent.generate( | ||
| 474 | - context, | ||
| 475 | - "${match?[1]}", | ||
| 476 | - conf, | ||
| 477 | - ), | 429 | + children: MarkdownComponent.generate(context, "${match?[1]}", conf), |
| 478 | style: conf.style, | 430 | style: conf.style, |
| 479 | ); | 431 | ); |
| 480 | } | 432 | } |
| @@ -492,19 +444,15 @@ class StrikeMd extends InlineMd { | @@ -492,19 +444,15 @@ class StrikeMd extends InlineMd { | ||
| 492 | ) { | 444 | ) { |
| 493 | var match = exp.firstMatch(text.trim()); | 445 | var match = exp.firstMatch(text.trim()); |
| 494 | var conf = config.copyWith( | 446 | var conf = config.copyWith( |
| 495 | - style: config.style?.copyWith( | ||
| 496 | - decoration: TextDecoration.lineThrough, | ||
| 497 | - decorationColor: config.style?.color, | ||
| 498 | - ) ?? | ||
| 499 | - const TextStyle( | ||
| 500 | - decoration: TextDecoration.lineThrough, | ||
| 501 | - )); | 447 | + style: |
| 448 | + config.style?.copyWith( | ||
| 449 | + decoration: TextDecoration.lineThrough, | ||
| 450 | + decorationColor: config.style?.color, | ||
| 451 | + ) ?? | ||
| 452 | + const TextStyle(decoration: TextDecoration.lineThrough), | ||
| 453 | + ); | ||
| 502 | return TextSpan( | 454 | return TextSpan( |
| 503 | - children: MarkdownComponent.generate( | ||
| 504 | - context, | ||
| 505 | - "${match?[1]}", | ||
| 506 | - conf, | ||
| 507 | - ), | 455 | + children: MarkdownComponent.generate(context, "${match?[1]}", conf), |
| 508 | style: conf.style, | 456 | style: conf.style, |
| 509 | ); | 457 | ); |
| 510 | } | 458 | } |
| @@ -513,9 +461,10 @@ class StrikeMd extends InlineMd { | @@ -513,9 +461,10 @@ class StrikeMd extends InlineMd { | ||
| 513 | /// Italic text component | 461 | /// Italic text component |
| 514 | class ItalicMd extends InlineMd { | 462 | class ItalicMd extends InlineMd { |
| 515 | @override | 463 | @override |
| 516 | - RegExp get exp => | ||
| 517 | - RegExp(r"(?<!\*)\*(?<!\s)(.+?)(?<!\s)\*(?!\*)|\_(?<!\s)(.+?)(?<!\s)\_", | ||
| 518 | - dotAll: true); | 464 | + RegExp get exp => RegExp( |
| 465 | + r"(?<!\*)\*(?<!\s)(.+?)(?<!\s)\*(?!\*)|\_(?<!\s)(.+?)(?<!\s)\_", | ||
| 466 | + dotAll: true, | ||
| 467 | + ); | ||
| 519 | 468 | ||
| 520 | @override | 469 | @override |
| 521 | InlineSpan span( | 470 | InlineSpan span( |
| @@ -526,14 +475,12 @@ class ItalicMd extends InlineMd { | @@ -526,14 +475,12 @@ class ItalicMd extends InlineMd { | ||
| 526 | var match = exp.firstMatch(text.trim()); | 475 | var match = exp.firstMatch(text.trim()); |
| 527 | var data = match?[1] ?? match?[2]; | 476 | var data = match?[1] ?? match?[2]; |
| 528 | var conf = config.copyWith( | 477 | var conf = config.copyWith( |
| 529 | - style: (config.style ?? const TextStyle()) | ||
| 530 | - .copyWith(fontStyle: FontStyle.italic)); | ||
| 531 | - return TextSpan( | ||
| 532 | - children: MarkdownComponent.generate( | ||
| 533 | - context, | ||
| 534 | - "$data", | ||
| 535 | - conf, | 478 | + style: (config.style ?? const TextStyle()).copyWith( |
| 479 | + fontStyle: FontStyle.italic, | ||
| 536 | ), | 480 | ), |
| 481 | + ); | ||
| 482 | + return TextSpan( | ||
| 483 | + children: MarkdownComponent.generate(context, "$data", conf), | ||
| 537 | style: conf.style, | 484 | style: conf.style, |
| 538 | ); | 485 | ); |
| 539 | } | 486 | } |
| @@ -555,7 +502,8 @@ class LatexMathMultiLine extends BlockMd { | @@ -555,7 +502,8 @@ class LatexMathMultiLine extends BlockMd { | ||
| 555 | String mathText = p0?[1] ?? p0?[2] ?? ""; | 502 | String mathText = p0?[1] ?? p0?[2] ?? ""; |
| 556 | var workaround = config.latexWorkaround ?? (String tex) => tex; | 503 | var workaround = config.latexWorkaround ?? (String tex) => tex; |
| 557 | 504 | ||
| 558 | - var builder = config.latexBuilder ?? | 505 | + var builder = |
| 506 | + config.latexBuilder ?? | ||
| 559 | (BuildContext context, String tex, TextStyle textStyle, bool inline) => | 507 | (BuildContext context, String tex, TextStyle textStyle, bool inline) => |
| 560 | SelectableAdapter( | 508 | SelectableAdapter( |
| 561 | selectedText: tex, | 509 | selectedText: tex, |
| @@ -564,14 +512,14 @@ class LatexMathMultiLine extends BlockMd { | @@ -564,14 +512,14 @@ class LatexMathMultiLine extends BlockMd { | ||
| 564 | textStyle: textStyle, | 512 | textStyle: textStyle, |
| 565 | mathStyle: MathStyle.display, | 513 | mathStyle: MathStyle.display, |
| 566 | textScaleFactor: 1, | 514 | textScaleFactor: 1, |
| 567 | - settings: const TexParserSettings( | ||
| 568 | - strict: Strict.ignore, | ||
| 569 | - ), | 515 | + settings: const TexParserSettings(strict: Strict.ignore), |
| 570 | options: MathOptions( | 516 | options: MathOptions( |
| 571 | sizeUnderTextStyle: MathSize.large, | 517 | sizeUnderTextStyle: MathSize.large, |
| 572 | - color: config.style?.color ?? | 518 | + color: |
| 519 | + config.style?.color ?? | ||
| 573 | Theme.of(context).colorScheme.onSurface, | 520 | Theme.of(context).colorScheme.onSurface, |
| 574 | - fontSize: config.style?.fontSize ?? | 521 | + fontSize: |
| 522 | + config.style?.fontSize ?? | ||
| 575 | Theme.of(context).textTheme.bodyMedium?.fontSize, | 523 | Theme.of(context).textTheme.bodyMedium?.fontSize, |
| 576 | mathFontOptions: FontOptions( | 524 | mathFontOptions: FontOptions( |
| 577 | fontFamily: "Main", | 525 | fontFamily: "Main", |
| @@ -590,15 +538,21 @@ class LatexMathMultiLine extends BlockMd { | @@ -590,15 +538,21 @@ class LatexMathMultiLine extends BlockMd { | ||
| 590 | workaround(mathText), | 538 | workaround(mathText), |
| 591 | textDirection: config.textDirection, | 539 | textDirection: config.textDirection, |
| 592 | style: textStyle.copyWith( | 540 | style: textStyle.copyWith( |
| 593 | - color: (!kDebugMode) | ||
| 594 | - ? null | ||
| 595 | - : Theme.of(context).colorScheme.error), | 541 | + color: |
| 542 | + (!kDebugMode) | ||
| 543 | + ? null | ||
| 544 | + : Theme.of(context).colorScheme.error, | ||
| 545 | + ), | ||
| 596 | ); | 546 | ); |
| 597 | }, | 547 | }, |
| 598 | ), | 548 | ), |
| 599 | ); | 549 | ); |
| 600 | - return builder(context, workaround(mathText), | ||
| 601 | - config.style ?? const TextStyle(), false); | 550 | + return builder( |
| 551 | + context, | ||
| 552 | + workaround(mathText), | ||
| 553 | + config.style ?? const TextStyle(), | ||
| 554 | + false, | ||
| 555 | + ); | ||
| 602 | } | 556 | } |
| 603 | } | 557 | } |
| 604 | 558 | ||
| @@ -606,12 +560,12 @@ class LatexMathMultiLine extends BlockMd { | @@ -606,12 +560,12 @@ class LatexMathMultiLine extends BlockMd { | ||
| 606 | class LatexMath extends InlineMd { | 560 | class LatexMath extends InlineMd { |
| 607 | @override | 561 | @override |
| 608 | RegExp get exp => RegExp( | 562 | RegExp get exp => RegExp( |
| 609 | - [ | ||
| 610 | - r"\\\((.*?)\\\)", | ||
| 611 | - // r"(?<!\\)\$((?:\\.|[^$])*?)\$(?!\\)", | ||
| 612 | - ].join("|"), | ||
| 613 | - dotAll: true, | ||
| 614 | - ); | 563 | + [ |
| 564 | + r"\\\((.*?)\\\)", | ||
| 565 | + // r"(?<!\\)\$((?:\\.|[^$])*?)\$(?!\\)", | ||
| 566 | + ].join("|"), | ||
| 567 | + dotAll: true, | ||
| 568 | + ); | ||
| 615 | 569 | ||
| 616 | @override | 570 | @override |
| 617 | InlineSpan span( | 571 | InlineSpan span( |
| @@ -623,7 +577,8 @@ class LatexMath extends InlineMd { | @@ -623,7 +577,8 @@ class LatexMath extends InlineMd { | ||
| 623 | p0?.group(0); | 577 | p0?.group(0); |
| 624 | String mathText = p0?[1]?.toString() ?? ""; | 578 | String mathText = p0?[1]?.toString() ?? ""; |
| 625 | var workaround = config.latexWorkaround ?? (String tex) => tex; | 579 | var workaround = config.latexWorkaround ?? (String tex) => tex; |
| 626 | - var builder = config.latexBuilder ?? | 580 | + var builder = |
| 581 | + config.latexBuilder ?? | ||
| 627 | (BuildContext context, String tex, TextStyle textStyle, bool inline) => | 582 | (BuildContext context, String tex, TextStyle textStyle, bool inline) => |
| 628 | SelectableAdapter( | 583 | SelectableAdapter( |
| 629 | selectedText: tex, | 584 | selectedText: tex, |
| @@ -632,14 +587,14 @@ class LatexMath extends InlineMd { | @@ -632,14 +587,14 @@ class LatexMath extends InlineMd { | ||
| 632 | textStyle: textStyle, | 587 | textStyle: textStyle, |
| 633 | mathStyle: MathStyle.display, | 588 | mathStyle: MathStyle.display, |
| 634 | textScaleFactor: 1, | 589 | textScaleFactor: 1, |
| 635 | - settings: const TexParserSettings( | ||
| 636 | - strict: Strict.ignore, | ||
| 637 | - ), | 590 | + settings: const TexParserSettings(strict: Strict.ignore), |
| 638 | options: MathOptions( | 591 | options: MathOptions( |
| 639 | sizeUnderTextStyle: MathSize.large, | 592 | sizeUnderTextStyle: MathSize.large, |
| 640 | - color: config.style?.color ?? | 593 | + color: |
| 594 | + config.style?.color ?? | ||
| 641 | Theme.of(context).colorScheme.onSurface, | 595 | Theme.of(context).colorScheme.onSurface, |
| 642 | - fontSize: config.style?.fontSize ?? | 596 | + fontSize: |
| 597 | + config.style?.fontSize ?? | ||
| 643 | Theme.of(context).textTheme.bodyMedium?.fontSize, | 598 | Theme.of(context).textTheme.bodyMedium?.fontSize, |
| 644 | mathFontOptions: FontOptions( | 599 | mathFontOptions: FontOptions( |
| 645 | fontFamily: "Main", | 600 | fontFamily: "Main", |
| @@ -658,9 +613,11 @@ class LatexMath extends InlineMd { | @@ -658,9 +613,11 @@ class LatexMath extends InlineMd { | ||
| 658 | workaround(mathText), | 613 | workaround(mathText), |
| 659 | textDirection: config.textDirection, | 614 | textDirection: config.textDirection, |
| 660 | style: textStyle.copyWith( | 615 | style: textStyle.copyWith( |
| 661 | - color: (!kDebugMode) | ||
| 662 | - ? null | ||
| 663 | - : Theme.of(context).colorScheme.error), | 616 | + color: |
| 617 | + (!kDebugMode) | ||
| 618 | + ? null | ||
| 619 | + : Theme.of(context).colorScheme.error, | ||
| 620 | + ), | ||
| 664 | ); | 621 | ); |
| 665 | }, | 622 | }, |
| 666 | ), | 623 | ), |
| @@ -668,8 +625,12 @@ class LatexMath extends InlineMd { | @@ -668,8 +625,12 @@ class LatexMath extends InlineMd { | ||
| 668 | return WidgetSpan( | 625 | return WidgetSpan( |
| 669 | alignment: PlaceholderAlignment.baseline, | 626 | alignment: PlaceholderAlignment.baseline, |
| 670 | baseline: TextBaseline.alphabetic, | 627 | baseline: TextBaseline.alphabetic, |
| 671 | - child: builder(context, workaround(mathText), | ||
| 672 | - config.style ?? const TextStyle(), true), | 628 | + child: builder( |
| 629 | + context, | ||
| 630 | + workaround(mathText), | ||
| 631 | + config.style ?? const TextStyle(), | ||
| 632 | + true, | ||
| 633 | + ), | ||
| 673 | ); | 634 | ); |
| 674 | } | 635 | } |
| 675 | } | 636 | } |
| @@ -694,8 +655,12 @@ class SourceTag extends InlineMd { | @@ -694,8 +655,12 @@ class SourceTag extends InlineMd { | ||
| 694 | alignment: PlaceholderAlignment.middle, | 655 | alignment: PlaceholderAlignment.middle, |
| 695 | child: Padding( | 656 | child: Padding( |
| 696 | padding: const EdgeInsets.all(2), | 657 | padding: const EdgeInsets.all(2), |
| 697 | - child: config.sourceTagBuilder | ||
| 698 | - ?.call(context, content, const TextStyle()) ?? | 658 | + child: |
| 659 | + config.sourceTagBuilder?.call( | ||
| 660 | + context, | ||
| 661 | + content, | ||
| 662 | + const TextStyle(), | ||
| 663 | + ) ?? | ||
| 699 | SizedBox( | 664 | SizedBox( |
| 700 | width: 20, | 665 | width: 20, |
| 701 | height: 20, | 666 | height: 20, |
| @@ -784,8 +749,9 @@ class ImageMd extends InlineMd { | @@ -784,8 +749,9 @@ class ImageMd extends InlineMd { | ||
| 784 | double? height; | 749 | double? height; |
| 785 | double? width; | 750 | double? width; |
| 786 | if (match?[1] != null) { | 751 | if (match?[1] != null) { |
| 787 | - var size = RegExp(r"^([0-9]+)?x?([0-9]+)?") | ||
| 788 | - .firstMatch(match![1].toString().trim()); | 752 | + var size = RegExp( |
| 753 | + r"^([0-9]+)?x?([0-9]+)?", | ||
| 754 | + ).firstMatch(match![1].toString().trim()); | ||
| 789 | width = double.tryParse(size?[1]?.toString().trim() ?? 'a'); | 755 | width = double.tryParse(size?[1]?.toString().trim() ?? 'a'); |
| 790 | height = double.tryParse(size?[2]?.toString().trim() ?? 'a'); | 756 | height = double.tryParse(size?[2]?.toString().trim() ?? 'a'); |
| 791 | } | 757 | } |
| @@ -795,19 +761,21 @@ class ImageMd extends InlineMd { | @@ -795,19 +761,21 @@ class ImageMd extends InlineMd { | ||
| 795 | width: width, | 761 | width: width, |
| 796 | height: height, | 762 | height: height, |
| 797 | child: Image( | 763 | child: Image( |
| 798 | - image: NetworkImage( | ||
| 799 | - "${match?[2]}", | ||
| 800 | - ), | ||
| 801 | - loadingBuilder: (BuildContext context, Widget child, | ||
| 802 | - ImageChunkEvent? loadingProgress) { | 764 | + image: NetworkImage("${match?[2]}"), |
| 765 | + loadingBuilder: ( | ||
| 766 | + BuildContext context, | ||
| 767 | + Widget child, | ||
| 768 | + ImageChunkEvent? loadingProgress, | ||
| 769 | + ) { | ||
| 803 | if (loadingProgress == null) { | 770 | if (loadingProgress == null) { |
| 804 | return child; | 771 | return child; |
| 805 | } | 772 | } |
| 806 | return CustomImageLoading( | 773 | return CustomImageLoading( |
| 807 | - progress: loadingProgress.expectedTotalBytes != null | ||
| 808 | - ? loadingProgress.cumulativeBytesLoaded / | ||
| 809 | - loadingProgress.expectedTotalBytes! | ||
| 810 | - : 1, | 774 | + progress: |
| 775 | + loadingProgress.expectedTotalBytes != null | ||
| 776 | + ? loadingProgress.cumulativeBytesLoaded / | ||
| 777 | + loadingProgress.expectedTotalBytes! | ||
| 778 | + : 1, | ||
| 811 | ); | 779 | ); |
| 812 | }, | 780 | }, |
| 813 | fit: BoxFit.fill, | 781 | fit: BoxFit.fill, |
| @@ -831,16 +799,18 @@ class TableMd extends BlockMd { | @@ -831,16 +799,18 @@ class TableMd extends BlockMd { | ||
| 831 | String text, | 799 | String text, |
| 832 | final GptMarkdownConfig config, | 800 | final GptMarkdownConfig config, |
| 833 | ) { | 801 | ) { |
| 834 | - final List<Map<int, String>> value = text | ||
| 835 | - .split('\n') | ||
| 836 | - .map<Map<int, String>>( | ||
| 837 | - (e) => e | ||
| 838 | - .split('|') | ||
| 839 | - .where((element) => element.isNotEmpty) | ||
| 840 | - .toList() | ||
| 841 | - .asMap(), | ||
| 842 | - ) | ||
| 843 | - .toList(); | 802 | + final List<Map<int, String>> value = |
| 803 | + text | ||
| 804 | + .split('\n') | ||
| 805 | + .map<Map<int, String>>( | ||
| 806 | + (e) => | ||
| 807 | + e | ||
| 808 | + .split('|') | ||
| 809 | + .where((element) => element.isNotEmpty) | ||
| 810 | + .toList() | ||
| 811 | + .asMap(), | ||
| 812 | + ) | ||
| 813 | + .toList(); | ||
| 844 | bool heading = RegExp( | 814 | bool heading = RegExp( |
| 845 | r"^\|.*?\|\n\|-[-\\ |]*?-\|$", | 815 | r"^\|.*?\|\n\|-[-\\ |]*?-\|$", |
| 846 | multiLine: true, | 816 | multiLine: true, |
| @@ -868,45 +838,47 @@ class TableMd extends BlockMd { | @@ -868,45 +838,47 @@ class TableMd extends BlockMd { | ||
| 868 | width: 1, | 838 | width: 1, |
| 869 | color: Theme.of(context).colorScheme.onSurface, | 839 | color: Theme.of(context).colorScheme.onSurface, |
| 870 | ), | 840 | ), |
| 871 | - children: value | ||
| 872 | - .asMap() | ||
| 873 | - .entries | ||
| 874 | - .map<TableRow>( | ||
| 875 | - (entry) => TableRow( | ||
| 876 | - decoration: (heading) | ||
| 877 | - ? BoxDecoration( | ||
| 878 | - color: (entry.key == 0) | ||
| 879 | - ? Theme.of(context) | ||
| 880 | - .colorScheme | ||
| 881 | - .surfaceContainerHighest | 841 | + children: |
| 842 | + value | ||
| 843 | + .asMap() | ||
| 844 | + .entries | ||
| 845 | + .map<TableRow>( | ||
| 846 | + (entry) => TableRow( | ||
| 847 | + decoration: | ||
| 848 | + (heading) | ||
| 849 | + ? BoxDecoration( | ||
| 850 | + color: | ||
| 851 | + (entry.key == 0) | ||
| 852 | + ? Theme.of( | ||
| 853 | + context, | ||
| 854 | + ).colorScheme.surfaceContainerHighest | ||
| 855 | + : null, | ||
| 856 | + ) | ||
| 882 | : null, | 857 | : null, |
| 883 | - ) | ||
| 884 | - : null, | ||
| 885 | - children: List.generate( | ||
| 886 | - maxCol, | ||
| 887 | - (index) { | ||
| 888 | - var e = entry.value; | ||
| 889 | - String data = e[index] ?? ""; | ||
| 890 | - if (RegExp(r"^--+$").hasMatch(data.trim()) || | ||
| 891 | - data.trim().isEmpty) { | ||
| 892 | - return const SizedBox(); | ||
| 893 | - } | ||
| 894 | - | ||
| 895 | - return Center( | ||
| 896 | - child: Padding( | ||
| 897 | - padding: const EdgeInsets.symmetric( | ||
| 898 | - horizontal: 8, vertical: 4), | ||
| 899 | - child: MdWidget( | ||
| 900 | - (e[index] ?? "").trim(), | ||
| 901 | - config: config, | 858 | + children: List.generate(maxCol, (index) { |
| 859 | + var e = entry.value; | ||
| 860 | + String data = e[index] ?? ""; | ||
| 861 | + if (RegExp(r"^--+$").hasMatch(data.trim()) || | ||
| 862 | + data.trim().isEmpty) { | ||
| 863 | + return const SizedBox(); | ||
| 864 | + } | ||
| 865 | + | ||
| 866 | + return Center( | ||
| 867 | + child: Padding( | ||
| 868 | + padding: const EdgeInsets.symmetric( | ||
| 869 | + horizontal: 8, | ||
| 870 | + vertical: 4, | ||
| 871 | + ), | ||
| 872 | + child: MdWidget( | ||
| 873 | + (e[index] ?? "").trim(), | ||
| 874 | + config: config, | ||
| 875 | + ), | ||
| 902 | ), | 876 | ), |
| 903 | - ), | ||
| 904 | - ); | ||
| 905 | - }, | ||
| 906 | - ), | ||
| 907 | - ), | ||
| 908 | - ) | ||
| 909 | - .toList(), | 877 | + ); |
| 878 | + }), | ||
| 879 | + ), | ||
| 880 | + ) | ||
| 881 | + .toList(), | ||
| 910 | ), | 882 | ), |
| 911 | ), | 883 | ), |
| 912 | ); | 884 | ); |
| @@ -2,11 +2,7 @@ part of 'gpt_markdown.dart'; | @@ -2,11 +2,7 @@ part of 'gpt_markdown.dart'; | ||
| 2 | 2 | ||
| 3 | /// It creates a markdown widget closed to each other. | 3 | /// It creates a markdown widget closed to each other. |
| 4 | class MdWidget extends StatelessWidget { | 4 | class MdWidget extends StatelessWidget { |
| 5 | - const MdWidget( | ||
| 6 | - this.exp, { | ||
| 7 | - super.key, | ||
| 8 | - required this.config, | ||
| 9 | - }); | 5 | + const MdWidget(this.exp, {super.key, required this.config}); |
| 10 | final String exp; | 6 | final String exp; |
| 11 | final GptMarkdownConfig config; | 7 | final GptMarkdownConfig config; |
| 12 | 8 | ||
| @@ -31,10 +27,7 @@ class MdWidget extends StatelessWidget { | @@ -31,10 +27,7 @@ class MdWidget extends StatelessWidget { | ||
| 31 | ), | 27 | ), |
| 32 | ); | 28 | ); |
| 33 | return config.getRich( | 29 | return config.getRich( |
| 34 | - TextSpan( | ||
| 35 | - children: list, | ||
| 36 | - style: config.style?.copyWith(), | ||
| 37 | - ), | 30 | + TextSpan(children: list, style: config.style?.copyWith()), |
| 38 | ); | 31 | ); |
| 39 | } | 32 | } |
| 40 | } | 33 | } |
| @@ -39,8 +39,9 @@ class GptMarkdownThemeData extends ThemeExtension<GptMarkdownThemeData> { | @@ -39,8 +39,9 @@ class GptMarkdownThemeData extends ThemeExtension<GptMarkdownThemeData> { | ||
| 39 | displayMedium: Typography.tall2021.displayMedium?.copyWith(inherit: true), | 39 | displayMedium: Typography.tall2021.displayMedium?.copyWith(inherit: true), |
| 40 | displaySmall: Typography.tall2021.displaySmall?.copyWith(inherit: true), | 40 | displaySmall: Typography.tall2021.displaySmall?.copyWith(inherit: true), |
| 41 | headlineLarge: Typography.tall2021.headlineLarge?.copyWith(inherit: true), | 41 | headlineLarge: Typography.tall2021.headlineLarge?.copyWith(inherit: true), |
| 42 | - headlineMedium: | ||
| 43 | - Typography.tall2021.headlineMedium?.copyWith(inherit: true), | 42 | + headlineMedium: Typography.tall2021.headlineMedium?.copyWith( |
| 43 | + inherit: true, | ||
| 44 | + ), | ||
| 44 | headlineSmall: Typography.tall2021.headlineSmall?.copyWith(inherit: true), | 45 | headlineSmall: Typography.tall2021.headlineSmall?.copyWith(inherit: true), |
| 45 | titleLarge: Typography.tall2021.titleLarge?.copyWith(inherit: true), | 46 | titleLarge: Typography.tall2021.titleLarge?.copyWith(inherit: true), |
| 46 | titleMedium: Typography.tall2021.titleMedium?.copyWith(inherit: true), | 47 | titleMedium: Typography.tall2021.titleMedium?.copyWith(inherit: true), |
| @@ -52,9 +53,7 @@ class GptMarkdownThemeData extends ThemeExtension<GptMarkdownThemeData> { | @@ -52,9 +53,7 @@ class GptMarkdownThemeData extends ThemeExtension<GptMarkdownThemeData> { | ||
| 52 | labelMedium: Typography.tall2021.labelMedium?.copyWith(inherit: true), | 53 | labelMedium: Typography.tall2021.labelMedium?.copyWith(inherit: true), |
| 53 | labelSmall: Typography.tall2021.labelSmall?.copyWith(inherit: true), | 54 | labelSmall: Typography.tall2021.labelSmall?.copyWith(inherit: true), |
| 54 | ); | 55 | ); |
| 55 | - themeData = themeData.copyWith( | ||
| 56 | - textTheme: typography, | ||
| 57 | - ); | 56 | + themeData = themeData.copyWith(textTheme: typography); |
| 58 | TextTheme textTheme = themeData.textTheme; | 57 | TextTheme textTheme = themeData.textTheme; |
| 59 | return GptMarkdownThemeData._fromTheme(themeData, textTheme).copyWith( | 58 | return GptMarkdownThemeData._fromTheme(themeData, textTheme).copyWith( |
| 60 | highlightColor: highlightColor, | 59 | highlightColor: highlightColor, |
| @@ -72,7 +71,9 @@ class GptMarkdownThemeData extends ThemeExtension<GptMarkdownThemeData> { | @@ -72,7 +71,9 @@ class GptMarkdownThemeData extends ThemeExtension<GptMarkdownThemeData> { | ||
| 72 | } | 71 | } |
| 73 | 72 | ||
| 74 | factory GptMarkdownThemeData._fromTheme( | 73 | factory GptMarkdownThemeData._fromTheme( |
| 75 | - ThemeData theme, TextTheme textTheme) { | 74 | + ThemeData theme, |
| 75 | + TextTheme textTheme, | ||
| 76 | + ) { | ||
| 76 | return GptMarkdownThemeData._( | 77 | return GptMarkdownThemeData._( |
| 77 | highlightColor: theme.colorScheme.onSurfaceVariant.withAlpha(50), | 78 | highlightColor: theme.colorScheme.onSurfaceVariant.withAlpha(50), |
| 78 | h1: textTheme.headlineLarge, | 79 | h1: textTheme.headlineLarge, |
| @@ -144,8 +145,10 @@ class GptMarkdownThemeData extends ThemeExtension<GptMarkdownThemeData> { | @@ -144,8 +145,10 @@ class GptMarkdownThemeData extends ThemeExtension<GptMarkdownThemeData> { | ||
| 144 | h4: TextStyle.lerp(h4, other.h4, t) ?? h4, | 145 | h4: TextStyle.lerp(h4, other.h4, t) ?? h4, |
| 145 | h5: TextStyle.lerp(h5, other.h5, t) ?? h5, | 146 | h5: TextStyle.lerp(h5, other.h5, t) ?? h5, |
| 146 | h6: TextStyle.lerp(h6, other.h6, t) ?? h6, | 147 | h6: TextStyle.lerp(h6, other.h6, t) ?? h6, |
| 147 | - hrLineThickness: Tween(begin: hrLineThickness, end: other.hrLineThickness) | ||
| 148 | - .transform(t), | 148 | + hrLineThickness: Tween( |
| 149 | + begin: hrLineThickness, | ||
| 150 | + end: other.hrLineThickness, | ||
| 151 | + ).transform(t), | ||
| 149 | hrLineColor: Color.lerp(hrLineColor, other.hrLineColor, t) ?? hrLineColor, | 152 | hrLineColor: Color.lerp(hrLineColor, other.hrLineColor, t) ?? hrLineColor, |
| 150 | linkColor: Color.lerp(linkColor, other.linkColor, t) ?? linkColor, | 153 | linkColor: Color.lerp(linkColor, other.linkColor, t) ?? linkColor, |
| 151 | linkHoverColor: | 154 | linkHoverColor: |
| 1 | name: gpt_markdown | 1 | name: gpt_markdown |
| 2 | description: "Powerful Markdown & LaTeX Renderer for Flutter: Rich Text, Math, Tables, Links, and Text Selection. Ideal for ChatGPT, Gemini, and more." | 2 | description: "Powerful Markdown & LaTeX Renderer for Flutter: Rich Text, Math, Tables, Links, and Text Selection. Ideal for ChatGPT, Gemini, and more." |
| 3 | -version: 1.0.10 | 3 | +version: 1.0.11 |
| 4 | homepage: https://github.com/Infinitix-LLC/gpt_markdown | 4 | homepage: https://github.com/Infinitix-LLC/gpt_markdown |
| 5 | 5 | ||
| 6 | environment: | 6 | environment: |
-
Please register or login to post a comment