Skip to content

Editor for web app keeps showing "paste" dialog everytime in a read only content page from IOS web browser  #1567

Closed
@Salvador-dev

Description

@Salvador-dev

Is there an existing issue for this?

Flutter Quill version

8.6.4

Other Flutter Quill packages versions

No response

Steps to reproduce

i'm trying to use the widget in a flutter web app but this issue doesn't have solution since 2022 where another person have the same problem

Expected results

Don't show the dialog or only one time on the first time in the app.

Actual results

Showed the dialog every time.

Code sample

class ReadingDetailDialog extends StatefulWidget {
  final Reading reading;
  final User user;
  final BaseSubCategory? subCategory;

  const ReadingDetailDialog({
    super.key,
    required this.reading,
    required this.user,
    this.subCategory,
  });

  @override
  State<ReadingDetailDialog> createState() => _ReadingDetailDialogState();
}

class _ReadingDetailDialogState extends State<ReadingDetailDialog>
    with Notificable, Tools, UsesBreakpoints {
  final ReadingBloc _readingBloc;

  _ReadingDetailDialogState()
      : _readingBloc = getIt(),
        super();

  @override
  void initState() {
    _readingBloc.add(RequestOne(widget.reading.id));
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return DialogsLayout(
      padding: const EdgeInsets.symmetric(horizontal: 25),
      appBarLeadingWidget: _clientAppBarLeading,
      appBarTitle: _adminAppBarTitle,
      child: BlocBuilder<ReadingBloc, BaseState>(
        bloc: _readingBloc,
        builder: (context, state) {
          if (state is ItemLoaded<DetailedReading>) {
            return _getContent(state.item);
          } else if (state is BaseError) {
            return const TryAgainLaterScreen();
          }
          return LoadingScreen(resource: tr('fields.audio'));
        },
      ),
    );
  }

  Widget get _clientAppBarLeading => widget.user.isClient
      ? CustomDialogDefaults.clientAppBarLeading(
          widget.reading.id,
          getIt<ReadingFavoriteCubit>(),
        )
      : Container();

  Widget? get _adminAppBarTitle =>
      widget.user.isAdmin && widget.subCategory != null
          ? CustomDialogDefaults.adminAppBarTitle(widget.subCategory!)
          : Container();

  Widget _getContent(DetailedReading reading) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.start,
      mainAxisSize: MainAxisSize.max,
      children: [
        Flexible(
          child: NFMarquee(
            text: reading.name,
            style: GoogleFonts.italianno(
              color: Colors.black,
              fontSize: 45,
              fontWeight: FontWeight.bold,
            ),
          ),
        ),
        Flexible(
          child: RichText(
            text: TextSpan(
              children: [
                TextSpan(
                  text: "por",
                  style: GoogleFonts.italianno(
                    color: Colors.black87,
                    fontSize: 30,
                    fontWeight: FontWeight.normal,
                  ),
                ),
                TextSpan(
                  text: " some name",
                  style: GoogleFonts.italianno(
                    color: Colors.black,
                    fontSize: 30,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ],
            ),
            textAlign: TextAlign.right,
          ),
        ),
        const Divider(height: 20),
        QuillProvider(
          configurations: QuillConfigurations(
            controller: _getController(reading),
          ),
          child: Expanded(
            flex: 10,
            // child: QuillEditor.basic(
            //   configurations: const QuillEditorConfigurations(
            //     readOnly: true,
            //     enableInteractiveSelection: false,
            //   ),
            // ),
            child: QuillEditor.basic(
              configurations: const QuillEditorConfigurations(
                readOnly: true,
                showCursor: false,
                enableSelectionToolbar: false,
                scrollable: true,
                autoFocus: false,
              ),
            ),
          ),
        ),
      ],
    );
  }

  QuillController _getController(DetailedReading reading) {
    final controller = QuillController.basic();
    if (reading.format == "html") {
      controller.document = Document.fromDelta(
        HtmlToDeltaConverter.htmlToDelta(
          reading.text!,
        ),
      );
    } else {
      controller.document = Document.fromJson(
        jsonDecode(
          reading.text!,
        ),
      );
    }

    return controller;
  }
}

Screenshots or Video

Logs
Logs
[Paste your logs 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