daohoangson / flutter_widget_from_html

Flutter package to render html as widgets that supports hyperlink, image, audio, video, iframe and many other tags.
https://pub.dev/packages/flutter_widget_from_html
MIT License
635 stars 235 forks source link

The text copied in the html widget inside SelectionArea don't add break lines between elements (headers, paragraphs, etc). #1314

Closed MiniSuperDev closed 1 month ago

MiniSuperDev commented 2 months ago

Try the following sample in https://try.fwfh.dev/

import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart';

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

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

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Center(
          child: SelectionArea(
            child: HtmlWidget(
              r'''
<h1>Header 1</h1>
<p>Paragraph 1</p>
<p>Paragraph 2</p>
<p>Paragraph 3</p>
<h2>Header 2</h2>
<p>Paragraph 4</p>
<p>Paragraph 5</p>
''',
            ),
          ),
        ),
      ),
    );
  }
}

Output when copy:

Header 1Paragraph 1Paragraph 2Paragraph 3Header 2Paragraph 4Paragraph 5

Expected:

Header 1
Paragraph 1
Paragraph 2
Paragraph 3
Header 2
Paragraph 4
Paragraph 5

Is there any way to make it copy as expected?

Thanks.

daohoangson commented 1 month ago

This is a duplicate of #882. We need Flutter support to improve the behavior here. I'm closing this issue now, please follow the other issue to receive updates related to this feature.