refactor: format files with dartFmt

This commit is contained in:
jideguru 2021-06-03 00:42:53 +01:00
parent 75ae842f4b
commit 4097c7c746
7 changed files with 4 additions and 157 deletions

View File

@ -5,7 +5,7 @@ import 'package:flutter/material.dart';
extension ColorX on Color {
String toHexColorString() {
String hex = value.toRadixString(16).replaceAll('ff', '');
if(hex.isEmpty) hex = '000000';
if (hex.isEmpty) hex = '000000';
return '#$hex';
}
}

View File

@ -27,4 +27,3 @@ class EditorState {
return data;
}
}

View File

@ -37,10 +37,7 @@ enum CommandName {
INSERTIMAGE,
INSERTCHECKBOX,
// pseudo commands for toggling grouped command views
ENTER_VIEWING_MODE,
EXPANDING_SEARCH_VIEWING,
TOGGLE_GROUPED_TEXT_STYLES_COMMANDS_VIEW,
TOGGLE_GROUPED_INSERT_COMMANDS_COMMANDS_VIEW
}
enum BarPosition {TOP, BOTTOM}
enum BarPosition { TOP, BOTTOM }

View File

@ -12,12 +12,11 @@ class Family {
name = json['name'];
if (json['font'] != null) {
fonts = <Font>[];
if(json['font'] is List) {
if (json['font'] is List) {
json['font'].forEach((v) {
fonts!.add(new Font.fromJson(v));
});
}
}
lang = json['lang'];
variant = json['variant'];

View File

@ -1,148 +1 @@
import 'package:flutter/material.dart';
import 'package:rich_editor/src/models/button.dart';
import 'javascript_executor_base.dart';
List<Button> buttons = [
Button(
icon: Icons.format_bold,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.setBold(),
),
Button(
icon: Icons.format_italic,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.setItalic(),
),
Button(
icon: Icons.link,
onTap: (JavascriptExecutorBase javascriptExecutorBase, String link, String title) async {
await javascriptExecutorBase.insertLink(
'https://github.com/JideGuru',
'Sample',
);
},
),
Button(
icon: Icons.image,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async {
await javascriptExecutorBase.insertImage(
'https://avatars.githubusercontent.com/u/24323581?v=4',
alt: 'Jide',
height: 200,
width: 200,
);
},
),
Button(
icon: Icons.format_underline,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.setUnderline(),
),
Button(
icon: Icons.format_strikethrough,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.setStrikeThrough(),
),
Button(
icon: Icons.superscript,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.setSuperscript(),
),
Button(
icon: Icons.subscript,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.setSubscript(),
),
Button(
icon: Icons.format_clear,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.removeFormat(),
),
Button(
icon: Icons.undo,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.undo(),
),
Button(
icon: Icons.redo,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.redo(),
),
Button(
icon: Icons.format_quote,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.setBlockQuote(),
),
Button(
icon: Icons.text_format,
onTap: (JavascriptExecutorBase javascriptExecutorBase, String name) async =>
await javascriptExecutorBase.setPreformat(),
),
Button(
icon: Icons.font_download,
onTap: (JavascriptExecutorBase javascriptExecutorBase, String name) async =>
await javascriptExecutorBase.setFontName(name),
),
Button(
icon: Icons.format_size,
onTap: (JavascriptExecutorBase javascriptExecutorBase, int size) async =>
await javascriptExecutorBase.setFontSize(size),
),
Button(
icon: Icons.format_color_text,
onTap: (JavascriptExecutorBase javascriptExecutorBase, Color color) async =>
await javascriptExecutorBase.setTextColor(color),
),
Button(
icon: Icons.format_color_fill,
onTap: (JavascriptExecutorBase javascriptExecutorBase, Color color) async =>
await javascriptExecutorBase.setTextBackgroundColor(color),
),
Button(
icon: Icons.format_indent_increase,
onTap: (JavascriptExecutorBase javascriptExecutorBase, int size) async =>
await javascriptExecutorBase.setIndent(),
),
Button(
icon: Icons.format_indent_decrease,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.setOutdent(),
),
Button(
icon: Icons.format_align_left_outlined,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.setJustifyLeft(),
),
Button(
icon: Icons.format_align_center,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.setJustifyCenter(),
),
Button(
icon: Icons.format_align_right,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.setJustifyRight(),
),
Button(
icon: Icons.format_align_justify,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.setJustifyFull(),
),
Button(
icon: Icons.format_list_bulleted,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.insertBulletList(),
),
Button(
icon: Icons.format_list_numbered,
onTap: (JavascriptExecutorBase javascriptExecutorBase) async =>
await javascriptExecutorBase.insertNumberedList(),
),
Button(
icon: Icons.check_box_outlined,
onTap: (JavascriptExecutorBase javascriptExecutorBase, String text) async =>
await javascriptExecutorBase.insertCheckbox(text),
),
Button(icon: Icons.search),
];

View File

@ -5,7 +5,6 @@ class CustomDialogTemplate extends StatelessWidget {
final Function? onDone;
final Function? onCancel;
CustomDialogTemplate({this.body, this.onDone, this.onCancel});
@override