flutter_widget_from_html icon indicating copy to clipboard operation
flutter_widget_from_html copied to clipboard

Expose scroll alignment for the anchor

Open limitless-brain opened this issue 2 years ago • 8 comments

Use case

Scrolling to the currently highlighted text (anchor), since the alignment is set to 1.0 the item is shown at the top of the view. Screenshot_20230427_090449

Proposal

Expose the alignment parameter for the scrollToAnchor method, so the developer can set the alignment for the anchor.

limitless-brain avatar Apr 27 '23 06:04 limitless-brain

I think this is useful and should be fairly straightforward to implement.

daohoangson avatar May 11 '23 10:05 daohoangson

Our main developer said this would be very helpful for our software as well. However, we use another method right now.

bksubhuti avatar Jun 01 '23 12:06 bksubhuti

What did you do? @bksubhuti

daohoangson avatar Jun 01 '23 16:06 daohoangson

https://github.com/bksubhuti/tipitaka-pali-reader/blob/master/lib/ui/screens/reader/widgets/pali_page_widget.dart

search for #goto

and textToHighlight

bksubhuti avatar Jun 01 '23 16:06 bksubhuti

https://github.com/bksubhuti/tipitaka-pali-reader/blob/master/lib/ui/screens/reader/widgets/pali_page_widget.dart

search for #goto

and textToHighlight

@bksubhuti hi, i see the code ,it is good idea to highlight by edit html
I want to implement text highlighting in selected sections

  • how to position selecting text in which html elements?

then edit html like this?

<h4 data-id="heading-0"><strong>正文:</strong></h4>
<p>高尔夫运动中,分数最小者胜出。</p>

if i select 文:\n高尔夫运动 , the text is in different tag , so hight:

<h4 data-id="heading-0">
<strong>正<span style="background-color: #f00">文:</span></strong>
</h4>

<p>
 <span style="background-color: #f00">高尔夫</span>运动中,分数最小者胜出。
</p>


lwj1994 avatar Oct 13 '23 08:10 lwj1994

Our main programmer is a little sick right now. I will send him. I think you are asking us how to do what we do. There are many different highlighting situations.. for instance when we highlight a search word, and highlight a toc item and also highlight on a word that is clicked. I'm not so smart in this stuff and can only edit small sections at my level. I'm more of a manager.

Perhaps you can tell me what feature you are using on our app and then i can try to find more information for you on what we do. I think what we do is change the html tags as you said in the case of search scroll to highlight.

The latest version 3.13.6 has some highlighting issues for our right click context menu. It works differently than older versions of flutter. 3.10.6

bksubhuti avatar Oct 13 '23 09:10 bksubhuti