Remove prints (#110)

pull/113/head
Till Friebe 4 years ago committed by GitHub
parent ceb191b26b
commit 8efa97ec12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      analysis_options.yaml
  2. 1
      lib/models/rules/rule.dart
  3. 10
      lib/widgets/controller.dart
  4. 35
      lib/widgets/toolbar.dart

@ -5,3 +5,6 @@ analyzer:
undefined_prefixed_name: ignore undefined_prefixed_name: ignore
omit_local_variable_types: ignore omit_local_variable_types: ignore
unsafe_html: ignore unsafe_html: ignore
linter:
rules:
- avoid_print

@ -61,7 +61,6 @@ class Rules {
final result = rule.apply(delta, index, final result = rule.apply(delta, index,
len: len, data: data, attribute: attribute); len: len, data: data, attribute: attribute);
if (result != null) { if (result != null) {
print('Rule $rule applied');
return result..trim(); return result..trim();
} }
} catch (e) { } catch (e) {

@ -78,12 +78,7 @@ class QuillController extends ChangeNotifier {
Delta? delta; Delta? delta;
if (len > 0 || data is! String || data.isNotEmpty) { if (len > 0 || data is! String || data.isNotEmpty) {
try {
delta = document.replace(index, len, data); delta = document.replace(index, len, data);
} catch (e) {
print('document.replace failed: $e');
rethrow;
}
bool shouldRetainDelta = toggledStyle.isNotEmpty && bool shouldRetainDelta = toggledStyle.isNotEmpty &&
delta.isNotEmpty && delta.isNotEmpty &&
delta.length <= 2 && delta.length <= 2 &&
@ -112,7 +107,6 @@ class QuillController extends ChangeNotifier {
if (delta == null || delta.isEmpty) { if (delta == null || delta.isEmpty) {
_updateSelection(textSelection, ChangeSource.LOCAL); _updateSelection(textSelection, ChangeSource.LOCAL);
} else { } else {
try {
Delta user = Delta() Delta user = Delta()
..retain(index) ..retain(index)
..insert(data) ..insert(data)
@ -125,10 +119,6 @@ class QuillController extends ChangeNotifier {
), ),
ChangeSource.LOCAL, ChangeSource.LOCAL,
); );
} catch (e) {
print('getPositionDelta or getPositionDelta error: $e');
rethrow;
}
} }
} }
notifyListeners(); notifyListeners();

@ -4,7 +4,6 @@ import 'package:file_picker/file_picker.dart';
import 'package:filesystem_picker/filesystem_picker.dart'; import 'package:filesystem_picker/filesystem_picker.dart';
import 'package:flutter/foundation.dart'; import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_colorpicker/flutter_colorpicker.dart'; import 'package:flutter_colorpicker/flutter_colorpicker.dart';
import 'package:flutter_quill/models/documents/attribute.dart'; import 'package:flutter_quill/models/documents/attribute.dart';
import 'package:flutter_quill/models/documents/nodes/embed.dart'; import 'package:flutter_quill/models/documents/nodes/embed.dart';
@ -520,19 +519,10 @@ class _ImageButtonState extends State<ImageButton> {
final File file = File(pickedFile.path); final File file = File(pickedFile.path);
// We simply return the absolute path to selected file. return widget.onImagePickCallback!(file);
try {
String url = await widget.onImagePickCallback!(file);
print('Image uploaded and its url is $url');
return url;
} catch (error) {
print('Upload image error $error');
}
return null;
} }
Future<String?> _pickImageWeb() async { Future<String?> _pickImageWeb() async {
try {
_paths = (await FilePicker.platform.pickFiles( _paths = (await FilePicker.platform.pickFiles(
type: _pickingType, type: _pickingType,
allowMultiple: false, allowMultiple: false,
@ -541,25 +531,13 @@ class _ImageButtonState extends State<ImageButton> {
: null, : null,
)) ))
?.files; ?.files;
} on PlatformException catch (e) {
print('Unsupported operation' + e.toString());
} catch (ex) {
print(ex);
}
var _fileName = var _fileName =
_paths != null ? _paths!.map((e) => e.name).toString() : '...'; _paths != null ? _paths!.map((e) => e.name).toString() : '...';
if (_paths != null) { if (_paths != null) {
File file = File(_fileName); File file = File(_fileName);
// We simply return the absolute path to selected file. // We simply return the absolute path to selected file.
try { return widget.onImagePickCallback!(file);
String url = await widget.onImagePickCallback!(file);
print('Image uploaded and its url is $url');
return url;
} catch (error) {
print('Upload image error $error');
}
return null;
} else { } else {
// User canceled the picker // User canceled the picker
} }
@ -567,7 +545,6 @@ class _ImageButtonState extends State<ImageButton> {
} }
Future<String> _pickImageDesktop() async { Future<String> _pickImageDesktop() async {
try {
var filePath = await FilesystemPicker.open( var filePath = await FilesystemPicker.open(
context: context, context: context,
rootDirectory: await getApplicationDocumentsDirectory(), rootDirectory: await getApplicationDocumentsDirectory(),
@ -577,13 +554,7 @@ class _ImageButtonState extends State<ImageButton> {
if (filePath != null && filePath.isEmpty) return ''; if (filePath != null && filePath.isEmpty) return '';
final File file = File(filePath!); final File file = File(filePath!);
String url = await widget.onImagePickCallback!(file); return widget.onImagePickCallback!(file);
print('Image uploaded and its url is $url');
return url;
} catch (error) {
print('Upload image error $error');
}
return '';
} }
@override @override

Loading…
Cancel
Save