Upgrade version to 1.4.0

pull/271/head
Xin Yao 4 years ago
parent 6ac1490281
commit e8c0c484a4
  1. 3
      CHANGELOG.md
  2. 28
      example/lib/pages/home_page.dart
  3. 15
      example/lib/widgets/demo_scaffold.dart
  4. 2
      lib/src/widgets/toolbar.dart
  5. 6
      lib/src/widgets/toolbar/image_button.dart
  6. 2
      pubspec.yaml

@ -1,3 +1,6 @@
## [1.4.0]
* Remove path_provider dependency.
## [1.3.4]
* Add option to paintCursorAboveText.

@ -138,6 +138,16 @@ class _HomePageState extends State<HomePage> {
),
embedBuilder: defaultEmbedBuilderWeb);
}
var toolbar = QuillToolbar.basic(
controller: _controller!, onImagePickCallback: _onImagePickCallback);
const isDesktop = !kIsWeb && !Platform.isAndroid && !Platform.isIOS;
if (isDesktop) {
toolbar = QuillToolbar.basic(
controller: _controller!,
onImagePickCallback: _onImagePickCallback,
applicationPath: getApplicationDirectoryForDesktop());
}
return SafeArea(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -155,23 +165,9 @@ class _HomePageState extends State<HomePage> {
child: Container(
padding:
const EdgeInsets.symmetric(vertical: 16, horizontal: 8),
child: QuillToolbar.basic(
controller: _controller!,
onImagePickCallback: _onImagePickCallback,
applicationPath:
!(kIsWeb || Platform.isAndroid || Platform.isIOS)
? null
: getApplicationDirectoryForDesktop()),
child: toolbar,
))
: Container(
child: QuillToolbar.basic(
controller: _controller!,
onImagePickCallback: _onImagePickCallback,
applicationPath:
!(kIsWeb || Platform.isAndroid || Platform.isIOS)
? null
: getApplicationDirectoryForDesktop()),
),
: Container(child: toolbar)
],
),
);

@ -80,6 +80,13 @@ class _DemoScaffoldState extends State<DemoScaffold> {
@override
Widget build(BuildContext context) {
final actions = widget.actions ?? <Widget>[];
var toolbar = QuillToolbar.basic(controller: _controller!);
const isDesktop = !kIsWeb && !Platform.isAndroid && !Platform.isIOS;
if (isDesktop) {
toolbar = QuillToolbar.basic(
controller: _controller!,
applicationPath: getApplicationDirectoryForDesktop());
}
return Scaffold(
key: _scaffoldKey,
appBar: AppBar(
@ -95,13 +102,7 @@ class _DemoScaffoldState extends State<DemoScaffold> {
),
onPressed: () => Navigator.pop(context),
),
title: _loading || widget.showToolbar == false
? null
: QuillToolbar.basic(controller: _controller!,
applicationPath:
!(kIsWeb || Platform.isAndroid || Platform.isIOS)
? null
: getApplicationDirectoryForDesktop()),
title: _loading || widget.showToolbar == false ? null : toolbar,
actions: actions,
),
floatingActionButton: widget.floatingActionButton,

@ -283,7 +283,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
/// is given.
final Color? color;
final Directory? applicationPath;
final Future<Directory>? applicationPath;
@override
Size get preferredSize => Size.fromHeight(toolBarHeight);

@ -68,7 +68,7 @@ class ImageButton extends StatelessWidget {
imageUrl = await _pickImage(imageSource);
} else {
assert(applicationPath != null,
'Desktop must provide application document directory');
'Desktop must provide application document directory');
imageUrl = await _pickImageDesktop(context, applicationPath!);
}
}
@ -100,8 +100,8 @@ class ImageButton extends StatelessWidget {
return onImagePickCallback!(File(pickedFile.path));
}
Future<String?> _pickImageDesktop(BuildContext context,
Future<Directory> applicationPath) async {
Future<String?> _pickImageDesktop(
BuildContext context, Future<Directory> applicationPath) async {
final filePath = await FilesystemPicker.open(
context: context,
rootDirectory: await applicationPath,

@ -1,6 +1,6 @@
name: flutter_quill
description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us)
version: 1.3.4
version: 1.4.0
#author: bulletjournal
homepage: https://bulletjournal.us/home/index.html
repository: https://github.com/singerdmx/flutter-quill

Loading…
Cancel
Save