Skip to content

ShortcutEvents are not working on mobile platform. #2370

Open
@hjkim-mango

Description

@hjkim-mango

Is there an existing issue for this?

Flutter Quill version

10.8.5

Steps to reproduce

  1. Write '' at first and then jot something down and write '' at last.
  2. Write '-' at first and then press the Spacebar.
  3. Write '#' at first and then press the Spacebar.

Expected results

On Step 1, characters should be changed to Italic style.
On Step 2, the block style of this line should be changed to the bulleted list.
On Step 3, the block style of this line should be changed to the numbered list.

Actual results

Nothing are changed.

Additional Context

Screenshots / Video demonstration
shortcutEventIssueOniOS.mov
shortcutEventIssueOnAndroid.mov
Source Codes
import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart' as quill;

class FlutterQuillWidget extends StatefulWidget {
  const FlutterQuillWidget({super.key});

  @override
  State<FlutterQuillWidget> createState() => _FlutterQuillWidgetState();
}

class _FlutterQuillWidgetState extends State<FlutterQuillWidget> {
  late quill.QuillController _controller;
  final _editorFocusNode = FocusNode();
  final _editorScrollController = ScrollController();
  bool canScroll = false;

  @override
  void initState() {
    super.initState();
    _controller = quill.QuillController(
        document: quill.Document(),
        selection: const TextSelection.collapsed(offset: 0));
  }

  @override
  void dispose() {
    _controller.dispose();
    _editorFocusNode.dispose();
    _editorScrollController.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        resizeToAvoidBottomInset: false,
        appBar: AppBar(
          title: const Text('Flutter Quill'),
        ),
        body: Column(
          children: [
            Expanded(
                child: SingleChildScrollView(
                    controller: _editorScrollController,
                    child: Column(children: [
                      quill.QuillToolbar.simple(controller: _controller),
                      quill.QuillEditor(
                        controller: _controller,
                        scrollController: _editorScrollController,
                        focusNode: FocusNode(),
                        configurations: quill.QuillEditorConfigurations(
                            scrollable: false,
                            characterShortcutEvents:
                                quill.standardCharactersShortcutEvents,
                            spaceShortcutEvents:
                                quill.standardSpaceShorcutEvents,
                            expands: false,
                            placeholder: "Add your data here..."),
                      ),
                    ])))
          ],
        ));
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions