Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to upstream cbb68f3a5b09b8659e97b62df0f68c21e069483d #27

Merged
merged 4 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 5 additions & 20 deletions example/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: "bae5e49bc2a867403c43b2aae2de8f8c33b037e4"
revision: "761747bfc538b5af34aa0d3fac380f1bc331ec49"
channel: "stable"

project_type: app
Expand All @@ -13,26 +13,11 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
base_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
- platform: android
create_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
base_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
- platform: ios
create_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
base_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
- platform: linux
create_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
base_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
- platform: macos
create_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
base_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
- platform: web
create_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
base_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
- platform: windows
create_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
base_revision: bae5e49bc2a867403c43b2aae2de8f8c33b037e4
create_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49
base_revision: 761747bfc538b5af34aa0d3fac380f1bc331ec49

# User provided section

Expand Down
5 changes: 5 additions & 0 deletions example/lib/pages/components/calendar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class _CalendarDemoState extends State<CalendarDemo> {
child: const Text('increase day')),
ZdsCalendar(
selectedDay: focusedDate,
showSelectedDateHeader: true,
events: [
CalendarEvent(id: 'a', date: DateTime.now()),
CalendarEvent(id: 'b', date: DateTime.now().subtract(const Duration(days: 1))),
Expand All @@ -43,6 +44,7 @@ class _CalendarDemoState extends State<CalendarDemo> {
),
const SizedBox(height: 50),
ZdsCalendar.monthly(
showSelectedDateHeader: true,
isRangeSelectable: true,
events: [
CalendarEvent(id: 'a', date: DateTime.now()),
Expand All @@ -57,6 +59,7 @@ class _CalendarDemoState extends State<CalendarDemo> {
height: 50,
),
ZdsCalendar.weekly(
showSelectedDateHeader: true,
startingDayOfWeek: StartingDayOfWeek.thursday,
initialSelectedDay: DateTime(currentDate.year, currentDate.month, currentDate.day + 1),
events: [
Expand All @@ -75,6 +78,7 @@ class _CalendarDemoState extends State<CalendarDemo> {
const SizedBox(height: 50),
ZdsCalendar.weekly(
initialSelectedWeek: DateTime(2022, 09, 10),
showSelectedDateHeader: true,
startingDayOfWeek: StartingDayOfWeek.wednesday,
showAllButton: true,
events: const [],
Expand All @@ -88,6 +92,7 @@ class _CalendarDemoState extends State<CalendarDemo> {
),
const SizedBox(height: 50),
ZdsCalendar.monthly(
showSelectedDateHeader: true,
headerPadding: const EdgeInsets.fromLTRB(4, 14, 8, 14),
events: [
CalendarEvent(id: 'a', date: DateTime.now()),
Expand Down
237 changes: 186 additions & 51 deletions example/lib/pages/components/quill_editor_demo.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import 'package:flutter/material.dart';
import 'package:flutter_quill/extensions.dart';
import 'package:flutter_quill/flutter_quill.dart';
import 'package:zds_flutter/zds_flutter.dart';
import 'package:flutter_quill_extensions/flutter_quill_extensions.dart';

///Example for htmlEditor
class QuillEditorDemo extends StatefulWidget {
Expand All @@ -13,70 +15,203 @@ class QuillEditorDemo extends StatefulWidget {
class _QuillEditorDemoState extends State<QuillEditorDemo> {
final controller = QuillController.basic();

var _htmlPreview = true;

get htmlPreview => _htmlPreview;

set htmlPreview(value) {
if (htmlPreview == value) return;
setState(() {
_htmlPreview = value;
});
}

var _loading = true;

get loading => _loading;

set loading(value) {
if (loading == value) return;
setState(() {
_loading = value;
});
}

@override
void initState() {
super.initState();
ZdsQuillDelta.fromHtml('''
<h1>H1 heading</h1><h2>H2 Heading</h2><h3>H3 Heading</h3><p>Normal <br/><strong>Because</strong></p>
''').then((value) {
loading = true;
ZdsQuillDelta.fromHtml(editorData).then((value) {
controller.document = value.document;
}).whenComplete(() {
loading = false;
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Quill Editor'),
actions: [
IconButton(
icon: const Icon(Icons.html),
onPressed: () {
showDialog(
context: context,
builder: (context) {
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.7),
child: Dialog(
child: ZdsCard(
child: Text(ZdsQuillDelta(document: controller.document).toHtml()),
return Column(
children: [
Expanded(
child: Scaffold(
backgroundColor: Zeta.of(context).colors.surfacePrimary,
appBar: AppBar(
title: const Text('Quill Editor'),
actions: [
Row(
children: [
Text('HTML'),
Switch(
value: htmlPreview,
onChanged: (value) {
setState(() {
htmlPreview = !htmlPreview;
});
},
),
],
)
],
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.edit),
onPressed: () {
ZdsQuillEditorPage.edit(
context,
title: 'Edit Notes',
embedBuilders: getEmbedBuilders(),
initialDelta: ZdsQuillDelta(document: controller.document),
charLimit: 20000,
embedButtons: FlutterQuillEmbeds.toolbarButtons(
videoButtonOptions: null,
imageButtonOptions: QuillToolbarImageButtonOptions(
imageButtonConfigurations: QuillToolbarImageConfigurations(
onImageInsertCallback: (image, controller) async {
// Upload to cloud
controller.insertImageBlock(imageSource: image);
},
),
),
);
},
);
},
),
],
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.edit),
onPressed: () {
ZdsQuillEditorPage.edit(
context,
title: 'Edit Notes',
initialDelta: ZdsQuillDelta(document: controller.document),
charLimit: 20000,
).then((value) {
if (value != null) {
controller.document = value.document;
}
});
},
),
body: Column(
children: [
Expanded(
child: QuillEditor.basic(
configurations: QuillEditorConfigurations(
padding: const EdgeInsets.all(16),
controller: controller,
),
focusNode: FocusNode(canRequestFocus: false),
),
).then((value) {
if (value != null) {
setState(() {
controller.document = value.document;
});
}
});
},
),
body: Stack(
children: [
ZdsQuillEditor(
controller: controller,
readOnly: true,
padding: const EdgeInsets.all(16),
embedBuilders: getEmbedBuilders(),
focusNode: FocusNode(canRequestFocus: false),
),
if (loading) const LinearProgressIndicator(),
],
),
),
),
const Divider(),
Expanded(
child: Scaffold(
backgroundColor: Zeta.of(context).colors.surfacePrimary,
body: Builder(builder: (context) {
final html = ZdsQuillDelta(document: controller.document).toHtml();
return SingleChildScrollView(
padding: EdgeInsets.all(14),
physics: ClampingScrollPhysics(),
child: htmlPreview ? ZdsHtmlContainer(html, expanded: true, showReadMore: false) : Text(html),
);
}),
),
],
),
)
],
);
}
}

/// default embed builders
List<EmbedBuilder> getEmbedBuilders() {
if (isWeb()) {
return FlutterQuillEmbeds.editorWebBuilders();
} else {
return FlutterQuillEmbeds.editorBuilders();
}
}

const editorData = """
<p><img style="max-width: 100%;object-fit: contain"
src="https://www.google.com/logos/doodles/2024/double-cicada-brood-2024-6753651837110499-2xa.gif" /> </p>
<ul>
<li>Apple</li>
<li>Banana</li>
<li>Cherry</li>
</ul>
<br />
<ol>
<li>Plan the trip<ol>
<li>Book flights</li>
</ol>
</li>
<li>Reserve hotel<ol>
<li>Something</li>
</ol>
</li>
<li>Check review<ol>
<li>Read recent comments</li>
</ol>
</li>
<li>Compare prices<ol>
<li>Use comparison websites</li>
</ol>
</li>
<li>Pack luggage<ol>
<li>Clothes</li>
</ol>
</li>
</ol>
<br />
<ul>
<li>Toiletries<ul>
<li>Shampoo</li>
<li>Toothbrush</li>
</ul>
</li>
<li>Gadgets<ul>
<li>Phone</li>
<li>Charger</li>
</ul>
</li>
</ul>
<br />
<pre>Code snippet example:
Line 1: Initialize the project
Line 2: Write some code
Line 3: Test the code</pre>
<br />
<blockquote style="border-left: 4px solid #ccc;padding-left: 16px">“The only limit to our realization of tomorrow is our
doubts of today.”<br />– Franklin D. Roosevelt</blockquote>
<br />
<h1>Main Title</h1>
<br />
<h2>Subtitle</h2>
<br />
<h3>Section Title</h3>
<p><br /><strong>Bold text example</strong><br /><br /><em>Italic text example</em><br /><u>Underlined text example</u><br /><br /><s>Strikethrough text
example</s><br /><br />Small text example<br /><br /><code>Inline code example</code><br /><br /><span
style="color:#e53935">Red colored text</span><br /><br /><span style="background-color:#fdd835">Yellow
background text</span><br /><br />Indented paragraph example. Lorem ipsum dolor sit amet, consectetur adipiscing
elit. Vivamus lacinia odio vitae vestibulum vestibulum.<br /><br />Another indented paragraph. Cras placerat
ultricies orci nec vestibulum.<br /><br />Left aligned text example<br /></p>
<p style="text-align:right">Right aligned text example</p>
<br />
<p style="text-align:center">Center aligned text example</p>
<br />
<p style="direction:rtl; text-align:inherit">Right to left text example</p>
<p><br /> <s>Multi-line strikethrough example:</s><br /><s>Line 1</s><br /><s>Line 2</s><br /><s>Line 3</s></p>
""";
2 changes: 2 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import device_info_plus
import file_selector_macos
import flutter_image_compress_macos
import flutter_inappwebview_macos
import gal
import irondash_engine_context
import just_audio
import package_info_plus
Expand All @@ -30,6 +31,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FlutterImageCompressMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterImageCompressMacosPlugin"))
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
GalPlugin.register(with: registry.registrar(forPlugin: "GalPlugin"))
IrondashEngineContextPlugin.register(with: registry.registrar(forPlugin: "IrondashEngineContextPlugin"))
JustAudioPlugin.register(with: registry.registrar(forPlugin: "JustAudioPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
Expand Down
7 changes: 7 additions & 0 deletions example/macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ PODS:
- FlutterMacOS
- OrderedSet (~> 5.0)
- FlutterMacOS (1.0.0)
- gal (1.0.0):
- Flutter
- FlutterMacOS
- irondash_engine_context (0.0.1):
- FlutterMacOS
- just_audio (0.0.1):
Expand Down Expand Up @@ -51,6 +54,7 @@ DEPENDENCIES:
- flutter_image_compress_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_image_compress_macos/macos`)
- flutter_inappwebview_macos (from `Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview_macos/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- gal (from `Flutter/ephemeral/.symlinks/plugins/gal/darwin`)
- irondash_engine_context (from `Flutter/ephemeral/.symlinks/plugins/irondash_engine_context/macos`)
- just_audio (from `Flutter/ephemeral/.symlinks/plugins/just_audio/macos`)
- package_info_plus (from `Flutter/ephemeral/.symlinks/plugins/package_info_plus/macos`)
Expand Down Expand Up @@ -82,6 +86,8 @@ EXTERNAL SOURCES:
:path: Flutter/ephemeral/.symlinks/plugins/flutter_inappwebview_macos/macos
FlutterMacOS:
:path: Flutter/ephemeral
gal:
:path: Flutter/ephemeral/.symlinks/plugins/gal/darwin
irondash_engine_context:
:path: Flutter/ephemeral/.symlinks/plugins/irondash_engine_context/macos
just_audio:
Expand Down Expand Up @@ -116,6 +122,7 @@ SPEC CHECKSUMS:
flutter_image_compress_macos: c26c3c13ea0f28ae6dea4e139b3292e7729f99f1
flutter_inappwebview_macos: 9600c9df9fdb346aaa8933812009f8d94304203d
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
gal: 61e868295d28fe67ffa297fae6dacebf56fd53e1
irondash_engine_context: da62996ee25616d2f01bbeb85dc115d813359478
just_audio: 9b67ca7b97c61cfc9784ea23cd8cc55eb226d489
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
Expand Down
Loading