Avoid redundant argument values (#114)

If it's ok, I would spend the day enabling linter rules so that the
codebase is more compliant with [Effective Dart](https://dart.dev/guides/language/effective-dart)
and thus more readable for new developers.
pull/116/head^2
Till Friebe 4 years ago committed by GitHub
parent 60c755d86d
commit cd05dfaeb8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      analysis_options.yaml
  2. 1
      example/lib/pages/home_page.dart
  3. 1
      example/lib/pages/read_only_page.dart
  4. 6
      lib/models/documents/document.dart
  5. 2
      lib/models/quill_delta.dart
  6. 1
      lib/widgets/controller.dart
  7. 4
      lib/widgets/editor.dart
  8. 2
      lib/widgets/raw_editor.dart
  9. 2
      lib/widgets/text_block.dart
  10. 3
      lib/widgets/toolbar.dart

@ -8,3 +8,4 @@ analyzer:
linter:
rules:
- avoid_print
- avoid_redundant_argument_values

@ -110,7 +110,6 @@ class _HomePageState extends State<HomePage> {
autoFocus: false,
readOnly: false,
placeholder: 'Add content',
enableInteractiveSelection: true,
expands: false,
padding: EdgeInsets.zero,
customStyles: DefaultStyles(

@ -42,7 +42,6 @@ class _ReadOnlyPageState extends State<ReadOnlyPage> {
focusNode: _focusNode,
autoFocus: true,
readOnly: !_edit,
enableInteractiveSelection: true,
expands: false,
padding: EdgeInsets.zero,
),

@ -183,7 +183,7 @@ class Document {
bool nextOpIsImage =
i + 1 < ops.length && ops[i + 1].isInsert && ops[i + 1].data is! String;
if (nextOpIsImage && !(op.data as String).endsWith('\n')) {
res.push(Operation.insert('\n', null));
res.push(Operation.insert('\n'));
}
// Currently embed is equivalent to image and hence `is! String`
bool opInsertImage = op.isInsert && op.data is! String;
@ -193,7 +193,7 @@ class Document {
(ops[i + 1].data as String).startsWith('\n');
if (opInsertImage && (i + 1 == ops.length - 1 || !nextOpIsLineBreak)) {
// automatically append '\n' for image
res.push(Operation.insert('\n', null));
res.push(Operation.insert('\n'));
}
}
@ -213,7 +213,7 @@ class Document {
_history.clear();
}
String toPlainText() => _root.children.map((e) => e.toPlainText()).join('');
String toPlainText() => _root.children.map((e) => e.toPlainText()).join();
void _loadDocument(Delta doc) {
assert((doc.last.data as String).endsWith('\n'));

@ -520,7 +520,7 @@ class Delta {
if (op.isInsert) {
inverted.delete(op.length!);
} else if (op.isRetain && op.isPlain) {
inverted.retain(op.length!, null);
inverted.retain(op.length!);
baseIndex += op.length!;
} else if (op.isDelete || (op.isRetain && op.isNotPlain)) {
final length = op.length!;

@ -31,7 +31,6 @@ class QuillController extends ChangeNotifier {
TextEditingValue get plainTextEditingValue => TextEditingValue(
text: document.toPlainText(),
selection: selection,
composing: TextRange.empty,
);
Style getSelectionStyle() {

@ -200,7 +200,6 @@ class QuillEditor extends StatefulWidget {
focusNode: FocusNode(),
autoFocus: true,
readOnly: readOnly,
enableInteractiveSelection: true,
expands: false,
padding: EdgeInsets.zero);
}
@ -726,8 +725,7 @@ class RenderEditor extends RenderEditableContainerBox
);
if (position.offset - word.start <= 1) {
_handleSelectionChange(
TextSelection.collapsed(
offset: word.start, affinity: TextAffinity.downstream),
TextSelection.collapsed(offset: word.start),
cause,
);
} else {

@ -382,8 +382,6 @@ class RawEditorState extends EditorState
TextInputConfiguration(
inputType: TextInputType.multiline,
readOnly: widget.readOnly,
obscureText: false,
autocorrect: true,
inputAction: TextInputAction.newline,
keyboardAppearance: widget.keyboardAppearance,
textCapitalization: widget.textCapitalization,

@ -623,7 +623,7 @@ class _NumberPoint extends StatelessWidget {
n = (n / 26).floor();
}
return result.toString().split('').reversed.join('');
return result.toString().split('').reversed.join();
}
String _intToRoman(int input) {

@ -525,7 +525,6 @@ class _ImageButtonState extends State<ImageButton> {
Future<String?> _pickImageWeb() async {
_paths = (await FilePicker.platform.pickFiles(
type: _pickingType,
allowMultiple: false,
allowedExtensions: (_extension?.isNotEmpty ?? false)
? _extension?.replaceAll(' ', '').split(',')
: null,
@ -1163,7 +1162,6 @@ class QuillIconButton extends StatelessWidget {
child: RawMaterialButton(
visualDensity: VisualDensity.compact,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2)),
padding: EdgeInsets.zero,
fillColor: fillColor,
elevation: 0,
hoverElevation: hoverElevation,
@ -1209,7 +1207,6 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
child: RawMaterialButton(
visualDensity: VisualDensity.compact,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(2)),
padding: EdgeInsets.zero,
fillColor: widget.fillColor,
elevation: 0,
hoverElevation: widget.hoverElevation,

Loading…
Cancel
Save