parent
e5044d9e34
commit
c32e6b0098
2 changed files with 64 additions and 1 deletions
@ -0,0 +1,22 @@ |
|||||||
|
import 'package:flutter_quill/models/documents/attribute.dart'; |
||||||
|
|
||||||
|
/* Collection of style attributes */ |
||||||
|
class Style { |
||||||
|
final Map<String, Attribute> _attributes; |
||||||
|
|
||||||
|
Style.attr(this._attributes); |
||||||
|
|
||||||
|
Style() : _attributes = <String, Attribute>{}; |
||||||
|
|
||||||
|
static Style fromJson(Map<String, dynamic> attributes) { |
||||||
|
if (attributes == null) { |
||||||
|
return Style(); |
||||||
|
} |
||||||
|
|
||||||
|
Map<String, Attribute> result = attributes.map((String key, dynamic value) { |
||||||
|
var attr = Attribute.fromKeyValue(key, value); |
||||||
|
return MapEntry<String, Attribute>(key, attr); |
||||||
|
}); |
||||||
|
return Style.attr(result); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue