singerdmx / flutter-quill

Rich text editor for Flutter
https://pub.dev/packages/flutter_quill
MIT License
2.6k stars 839 forks source link

Regression in 10.4.0: TabView within Flutter loses horizontal swipe functionality when containing multiple Quill editors #2376

Open aitaro opened 1 week ago

aitaro commented 1 week ago

Is there an existing issue for this?

Flutter Quill version

10.8.5

Steps to reproduce

  1. Clone the following repository with the reproduction setup: https://github.com/aitaro/flutter_quill_example.
  2. Run the app on a device or emulator.
  3. Swipe horizontally between tabs containing individual Quill editors.
import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill_example/samples/quill_text_sample.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      home: DefaultTabController(
        length: 2,
        child: Scaffold(
          backgroundColor: Colors.white,
          appBar: AppBar(
            title: const Text('home'),
            bottom: const TabBar(
              tabs: <Widget>[
                Tab(text: 'quillTextSample1'),
                Tab(text: 'quillTextSample2'),
              ],
            ),
          ),
          body: TabBarView(
            children: [
              SingleChildScrollView(
                padding: const EdgeInsets.all(16),
                child: MyQuillEditor(
                  document: Document.fromJson(quillTextSample),
                ),
              ),
              SingleChildScrollView(
                padding: const EdgeInsets.all(16),
                child: MyQuillEditor(
                  document: Document.fromJson(quillTextSample),
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

class MyQuillEditor extends StatelessWidget {
  const MyQuillEditor({
    required this.document,
    super.key,
  });

  final Document document;

  @override
  Widget build(BuildContext context) {
    final controller = QuillController(
      document: document,
      selection: const TextSelection.collapsed(offset: 0),
      readOnly: true,
    );

    return QuillEditor(
      scrollController: ScrollController(),
      focusNode: FocusNode(),
      controller: controller,
      configurations: const QuillEditorConfigurations(
        scrollable: false,
        showCursor: false,
      ),
    );
  }
}

Expected results

Swiping horizontally should change the active tab as usual, allowing seamless tab switching.

Actual results

Horizontal swiping no longer works to change tabs when each tab contains a Quill editor, blocking the TabView’s normal navigation behavior.

Additional Context