Skip to content

Commit

Permalink
3++
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellet committed Dec 5, 2023
1 parent d67bd71 commit ec38dee
Show file tree
Hide file tree
Showing 51 changed files with 143 additions and 203 deletions.
54 changes: 21 additions & 33 deletions example/lib/presentation/quill/quill_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dart:convert' show jsonEncode;
import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill_extensions/flutter_quill_extensions.dart'
show FlutterQuillEmbeds, QuillSharedExtensionsConfigurations;
show FlutterQuillEmbeds;

import 'package:quill_html_converter/quill_html_converter.dart';
import 'package:share_plus/share_plus.dart' show Share;
Expand Down Expand Up @@ -100,40 +100,28 @@ class _QuillScreenState extends State<QuillScreen> {
const HomeScreenButton(),
],
),
body: QuillProvider(
configurations: const QuillConfigurations(
sharedConfigurations: QuillSharedConfigurations(
extraConfigurations: {
QuillSharedExtensionsConfigurations.key:
QuillSharedExtensionsConfigurations(
assetsPrefix: 'assets',
),
body: Column(
children: [
if (!_isReadOnly)
MyQuillToolbar(
controller: _controller,
focusNode: _editorFocusNode,
),
Builder(
builder: (context) {
return Expanded(
child: MyQuillEditor(
configurations: QuillEditorConfigurations(
controller: _controller,
readOnly: _isReadOnly,
),
scrollController: _editorScrollController,
focusNode: _editorFocusNode,
),
);
},
),
),
child: Column(
children: [
if (!_isReadOnly)
MyQuillToolbar(
controller: _controller,
focusNode: _editorFocusNode,
),
Builder(
builder: (context) {
return Expanded(
child: MyQuillEditor(
configurations: QuillEditorConfigurations(
controller: _controller,
readOnly: _isReadOnly,
),
scrollController: _editorScrollController,
focusNode: _editorFocusNode,
),
);
},
),
],
),
],
),
floatingActionButton: FloatingActionButton(
child: Icon(_isReadOnly ? Icons.lock : Icons.edit),
Expand Down
23 changes: 23 additions & 0 deletions flutter_quill_extensions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ to support embedding widgets like images, formulas, videos, and more.
- [Embed Blocks](#embed-blocks)
- [Element properties](#element-properties)
- [Custom Element properties](#custom-element-properties)
- [Image Assets](#image-assets)
- [Drag and drop feature](#drag-and-drop-feature)
- [Features](#features)
- [Contributing](#contributing)
Expand Down Expand Up @@ -165,6 +166,28 @@ Define flutterAlignment` as follows:

This works for all platforms except Web

### Image Assets

If you want to use image assets in the Quill Editor, you need to make sure your assets folder is `assets` otherwise:

```dart
QuillProvider(
configurations: const QuillConfigurations(
sharedConfigurations: QuillSharedConfigurations(
extraConfigurations: {
QuillSharedExtensionsConfigurations.key:
QuillSharedExtensionsConfigurations(
assetsPrefix: 'your-assets-folder-name', // Defaults to assets
),
},
),
),
child: ...,
)
```

This info is needed by the package to check if it asset image to use the `AssetImage` provider

### Drag and drop feature
Currently, the drag-and-drop feature is not officially supported, but you can achieve this very easily in the following steps:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,8 @@ class QuillToolbarFormulaButton extends StatelessWidget {
}

return QuillToolbarIconButton(
icon: Icon(iconData, size: iconSize, color: iconColor),
icon: Icon(iconData, size: iconSize * 1.77, color: iconColor),
tooltip: tooltip,
size: iconSize * 1.77,
onPressed: () => _sharedOnPressed(context),
isFilled: false,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class QuillEditorImageEmbedBuilder extends EmbedBuilder {
bool inline,
TextStyle textStyle,
) {
assert(!kIsWeb, 'Please provide image EmbedBuilder for Web');
// assert(!kIsWeb, 'Please provide image EmbedBuilder for Web');

final imageSource = standardizeImageUrl(node.value.data);
final ((imageSize), margin, alignment) = getElementAttributes(node);
Expand Down
30 changes: 15 additions & 15 deletions flutter_quill_extensions/lib/embeds/image/editor/image_menu.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/cupertino.dart' show showCupertinoModalPopup;
import 'package:flutter/foundation.dart' show kIsWeb;
import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart'
show ImageUrl, QuillController, StyleAttribute, getEmbedNode;
Expand Down Expand Up @@ -130,7 +131,7 @@ class ImageOptionsMenu extends StatelessWidget {
await configurations.onImageRemovedCallback.call(imageSource);
},
),
...[
if (!kIsWeb)
ListTile(
leading: const Icon(Icons.save),
title: Text(context.loc.save),
Expand Down Expand Up @@ -172,23 +173,22 @@ class ImageOptionsMenu extends StatelessWidget {
);
},
),
ListTile(
leading: const Icon(Icons.zoom_in),
title: Text(context.loc.zoom),
onTap: () => Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => ImageTapWrapper(
assetsPrefix: QuillSharedExtensionsConfigurations.get(
context: context)
.assetsPrefix,
imageUrl: imageSource,
configurations: configurations,
),
ListTile(
leading: const Icon(Icons.zoom_in),
title: Text(context.loc.zoom),
onTap: () => Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (_) => ImageTapWrapper(
assetsPrefix:
QuillSharedExtensionsConfigurations.get(context: context)
.assetsPrefix,
imageUrl: imageSource,
configurations: configurations,
),
),
),
],
),
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,10 @@ class QuillToolbarImageButton extends StatelessWidget {
return QuillToolbarIconButton(
icon: Icon(
iconData,
size: iconSize,
size: iconSize * 1.77,
color: iconColor,
),
tooltip: tooltip,
size: iconSize * 1.77,
isFilled: false,
onPressed: () => _sharedOnPressed(context),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ class QuillToolbarCameraButton extends StatelessWidget {
final iconColor = iconTheme?.iconUnselectedColor ?? theme.iconTheme.color;

return QuillToolbarIconButton(
icon: Icon(iconData, size: iconSize, color: iconColor),
icon: Icon(iconData, size: iconSize * 1.77, color: iconColor),
tooltip: tooltip,
size: iconSize * 1.77,
isFilled: false,
// isDesktop(supportWeb: false) ? null :
onPressed: () => _sharedOnPressed(context),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,8 @@ class QuillToolbarVideoButton extends StatelessWidget {
}

return QuillToolbarIconButton(
icon: Icon(iconData, size: iconSize, color: iconColor),
icon: Icon(iconData, size: iconSize * 1.77, color: iconColor),
tooltip: tooltip,
size: iconSize * 1.77,
isFilled: false,
onPressed: () => _sharedOnPressed(context),
);
Expand Down
6 changes: 3 additions & 3 deletions flutter_quill_extensions/lib/flutter_quill_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ class FlutterQuillEmbeds {
/// videos iframe on the web.
///
static List<EmbedBuilder> editorWebBuilders(
{QuillEditorWebImageEmbedConfigurations? imageEmbedConfigurations =
const QuillEditorWebImageEmbedConfigurations(),
{QuillEditorImageEmbedConfigurations? imageEmbedConfigurations =
const QuillEditorImageEmbedConfigurations(),
QuillEditorWebVideoEmbedConfigurations? videoEmbedConfigurations =
const QuillEditorWebVideoEmbedConfigurations()}) {
if (!kIsWeb) {
Expand All @@ -125,7 +125,7 @@ class FlutterQuillEmbeds {
}
return [
if (imageEmbedConfigurations != null)
QuillEditorWebImageEmbedBuilder(
QuillEditorImageEmbedBuilder(
configurations: imageEmbedConfigurations,
),
if (videoEmbedConfigurations != null)
Expand Down
4 changes: 2 additions & 2 deletions lib/src/l10n/generated/quill_localizations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ abstract class FlutterQuillLocalizations {
/// No description provided for @takeAPhotoUsingYourCamera.
///
/// In en, this message translates to:
/// **'Take a photo using your phone camera'**
/// **'Take a photo using your camera'**
String get takeAPhotoUsingYourCamera;

/// No description provided for @pasteAPhotoUsingALink.
Expand All @@ -652,7 +652,7 @@ abstract class FlutterQuillLocalizations {
/// No description provided for @recordAVideoUsingYourCamera.
///
/// In en, this message translates to:
/// **'Record a video using your phone camera'**
/// **'Record a video using your camera'**
String get recordAVideoUsingYourCamera;

/// No description provided for @pasteAVideoUsingALink.
Expand Down
6 changes: 2 additions & 4 deletions lib/src/l10n/generated/quill_localizations_ar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ class FlutterQuillLocalizationsAr extends FlutterQuillLocalizations {
String get pickAPhotoFromYourGallery => 'Pick a photo from your gallery';

@override
String get takeAPhotoUsingYourCamera =>
'Take a photo using your phone camera';
String get takeAPhotoUsingYourCamera => 'Take a photo using your camera';

@override
String get pasteAPhotoUsingALink => 'Paste a photo using a link';
Expand All @@ -253,8 +252,7 @@ class FlutterQuillLocalizationsAr extends FlutterQuillLocalizations {
String get pickAVideoFromYourGallery => 'Pick a video from your gallery';

@override
String get recordAVideoUsingYourCamera =>
'Record a video using your phone camera';
String get recordAVideoUsingYourCamera => 'Record a video using your camera';

@override
String get pasteAVideoUsingALink => 'Paste a video using a link';
Expand Down
6 changes: 2 additions & 4 deletions lib/src/l10n/generated/quill_localizations_bg.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ class FlutterQuillLocalizationsBg extends FlutterQuillLocalizations {
String get pickAPhotoFromYourGallery => 'Pick a photo from your gallery';

@override
String get takeAPhotoUsingYourCamera =>
'Take a photo using your phone camera';
String get takeAPhotoUsingYourCamera => 'Take a photo using your camera';

@override
String get pasteAPhotoUsingALink => 'Paste a photo using a link';
Expand All @@ -255,8 +254,7 @@ class FlutterQuillLocalizationsBg extends FlutterQuillLocalizations {
String get pickAVideoFromYourGallery => 'Pick a video from your gallery';

@override
String get recordAVideoUsingYourCamera =>
'Record a video using your phone camera';
String get recordAVideoUsingYourCamera => 'Record a video using your camera';

@override
String get pasteAVideoUsingALink => 'Paste a video using a link';
Expand Down
6 changes: 2 additions & 4 deletions lib/src/l10n/generated/quill_localizations_bn.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ class FlutterQuillLocalizationsBn extends FlutterQuillLocalizations {
String get pickAPhotoFromYourGallery => 'Pick a photo from your gallery';

@override
String get takeAPhotoUsingYourCamera =>
'Take a photo using your phone camera';
String get takeAPhotoUsingYourCamera => 'Take a photo using your camera';

@override
String get pasteAPhotoUsingALink => 'Paste a photo using a link';
Expand All @@ -255,8 +254,7 @@ class FlutterQuillLocalizationsBn extends FlutterQuillLocalizations {
String get pickAVideoFromYourGallery => 'Pick a video from your gallery';

@override
String get recordAVideoUsingYourCamera =>
'Record a video using your phone camera';
String get recordAVideoUsingYourCamera => 'Record a video using your camera';

@override
String get pasteAVideoUsingALink => 'Paste a video using a link';
Expand Down
6 changes: 2 additions & 4 deletions lib/src/l10n/generated/quill_localizations_cs.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ class FlutterQuillLocalizationsCs extends FlutterQuillLocalizations {
String get pickAPhotoFromYourGallery => 'Pick a photo from your gallery';

@override
String get takeAPhotoUsingYourCamera =>
'Take a photo using your phone camera';
String get takeAPhotoUsingYourCamera => 'Take a photo using your camera';

@override
String get pasteAPhotoUsingALink => 'Paste a photo using a link';
Expand All @@ -255,8 +254,7 @@ class FlutterQuillLocalizationsCs extends FlutterQuillLocalizations {
String get pickAVideoFromYourGallery => 'Pick a video from your gallery';

@override
String get recordAVideoUsingYourCamera =>
'Record a video using your phone camera';
String get recordAVideoUsingYourCamera => 'Record a video using your camera';

@override
String get pasteAVideoUsingALink => 'Paste a video using a link';
Expand Down
6 changes: 2 additions & 4 deletions lib/src/l10n/generated/quill_localizations_da.dart
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ class FlutterQuillLocalizationsDa extends FlutterQuillLocalizations {
String get pickAPhotoFromYourGallery => 'Pick a photo from your gallery';

@override
String get takeAPhotoUsingYourCamera =>
'Take a photo using your phone camera';
String get takeAPhotoUsingYourCamera => 'Take a photo using your camera';

@override
String get pasteAPhotoUsingALink => 'Paste a photo using a link';
Expand All @@ -253,8 +252,7 @@ class FlutterQuillLocalizationsDa extends FlutterQuillLocalizations {
String get pickAVideoFromYourGallery => 'Pick a video from your gallery';

@override
String get recordAVideoUsingYourCamera =>
'Record a video using your phone camera';
String get recordAVideoUsingYourCamera => 'Record a video using your camera';

@override
String get pasteAVideoUsingALink => 'Paste a video using a link';
Expand Down
6 changes: 2 additions & 4 deletions lib/src/l10n/generated/quill_localizations_de.dart
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,7 @@ class FlutterQuillLocalizationsDe extends FlutterQuillLocalizations {
String get pickAPhotoFromYourGallery => 'Pick a photo from your gallery';

@override
String get takeAPhotoUsingYourCamera =>
'Take a photo using your phone camera';
String get takeAPhotoUsingYourCamera => 'Take a photo using your camera';

@override
String get pasteAPhotoUsingALink => 'Paste a photo using a link';
Expand All @@ -254,8 +253,7 @@ class FlutterQuillLocalizationsDe extends FlutterQuillLocalizations {
String get pickAVideoFromYourGallery => 'Pick a video from your gallery';

@override
String get recordAVideoUsingYourCamera =>
'Record a video using your phone camera';
String get recordAVideoUsingYourCamera => 'Record a video using your camera';

@override
String get pasteAVideoUsingALink => 'Paste a video using a link';
Expand Down
6 changes: 2 additions & 4 deletions lib/src/l10n/generated/quill_localizations_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,7 @@ class FlutterQuillLocalizationsEn extends FlutterQuillLocalizations {
String get pickAPhotoFromYourGallery => 'Pick a photo from your gallery';

@override
String get takeAPhotoUsingYourCamera =>
'Take a photo using your phone camera';
String get takeAPhotoUsingYourCamera => 'Take a photo using your camera';

@override
String get pasteAPhotoUsingALink => 'Paste a photo using a link';
Expand All @@ -255,8 +254,7 @@ class FlutterQuillLocalizationsEn extends FlutterQuillLocalizations {
String get pickAVideoFromYourGallery => 'Pick a video from your gallery';

@override
String get recordAVideoUsingYourCamera =>
'Record a video using your phone camera';
String get recordAVideoUsingYourCamera => 'Record a video using your camera';

@override
String get pasteAVideoUsingALink => 'Paste a video using a link';
Expand Down
Loading

0 comments on commit ec38dee

Please sign in to comment.