dartlangeditorflutterflutter-appsflutter-examplesflutter-packageflutter-widgetquillquill-deltaquilljsreactquillrich-textrich-text-editorwysiwygwysiwyg-editor
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
433 B
20 lines
433 B
dynamic getFontSize(dynamic sizeValue) { |
|
if (sizeValue is String && ['small', 'large', 'huge'].contains(sizeValue)) { |
|
return sizeValue; |
|
} |
|
|
|
if (sizeValue is double) { |
|
return sizeValue; |
|
} |
|
|
|
if (sizeValue is int) { |
|
return sizeValue.toDouble(); |
|
} |
|
|
|
assert(sizeValue is String); |
|
final fontSize = double.tryParse(sizeValue); |
|
if (fontSize == null) { |
|
throw 'Invalid size $sizeValue'; |
|
} |
|
return fontSize; |
|
}
|
|
|