-
Notifications
You must be signed in to change notification settings - Fork 847
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improving flutter quill extensions (#1564)
* organizations for flutter quill extensions
- Loading branch information
Showing
99 changed files
with
1,441 additions
and
625 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 9 additions & 9 deletions
18
example/lib/presentation/quill/samples/quill_images_sample.dart
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tation/embeds/toolbar/formula_button.dart → ...mbeds/formula/toolbar/formula_button.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
flutter_quill_extensions/lib/embeds/image/editor/image_embed.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import 'package:flutter/foundation.dart' show kIsWeb; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_quill/flutter_quill.dart' hide OptionalSize; | ||
import 'package:flutter_quill/translations.dart'; | ||
|
||
import '../../../models/config/editor/image/image.dart'; | ||
import '../../../models/config/shared_configurations.dart'; | ||
import '../../../utils/element_utils/element_utils.dart'; | ||
import '../../widgets/image.dart'; | ||
import 'image_menu.dart'; | ||
|
||
class QuillEditorImageEmbedBuilder extends EmbedBuilder { | ||
QuillEditorImageEmbedBuilder({ | ||
required this.configurations, | ||
}); | ||
final QuillEditorImageEmbedConfigurations configurations; | ||
|
||
@override | ||
String get key => BlockEmbed.imageType; | ||
|
||
@override | ||
bool get expanded => false; | ||
|
||
@override | ||
Widget build( | ||
BuildContext context, | ||
QuillController controller, | ||
Embed node, | ||
bool readOnly, | ||
bool inline, | ||
TextStyle textStyle, | ||
) { | ||
assert(!kIsWeb, 'Please provide image EmbedBuilder for Web'); | ||
|
||
final imageSource = standardizeImageUrl(node.value.data); | ||
final ((imageSize), margin, alignment) = getElementAttributes(node); | ||
|
||
final width = imageSize.width; | ||
final height = imageSize.height; | ||
|
||
final image = getImageWidgetByImageSource( | ||
imageSource, | ||
imageProviderBuilder: configurations.imageProviderBuilder, | ||
imageErrorWidgetBuilder: configurations.imageErrorWidgetBuilder, | ||
alignment: alignment, | ||
height: height, | ||
width: width, | ||
assetsPrefix: QuillSharedExtensionsConfigurations.get(context: context) | ||
.assetsPrefix, | ||
); | ||
|
||
final imageSaverService = | ||
QuillSharedExtensionsConfigurations.get(context: context) | ||
.imageSaverService; | ||
return GestureDetector( | ||
onTap: configurations.onImageClicked ?? | ||
() => showDialog( | ||
context: context, | ||
builder: (_) => QuillProvider.value( | ||
value: context.requireQuillProvider, | ||
child: FlutterQuillLocalizationsWidget( | ||
child: ImageOptionsMenu( | ||
controller: controller, | ||
configurations: configurations, | ||
imageSource: imageSource, | ||
imageSize: imageSize, | ||
isReadOnly: readOnly, | ||
imageSaverService: imageSaverService, | ||
), | ||
), | ||
), | ||
), | ||
child: Builder( | ||
builder: (context) { | ||
if (margin != null) { | ||
return Padding( | ||
padding: EdgeInsets.all(margin), | ||
child: image, | ||
); | ||
} | ||
return image; | ||
}, | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...esentation/embeds/embed_types/camera.dart → ...ds/others/camera_button/camera_types.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.