Problem: When I run a Flutter app as a web app in a browser, I can use the browser's text search function Ctrl + F to search for text on the page. The search function finds all of the instances of the search term that are currently shown on screen, but it does not find all of the other instances of the text that are currently out of view.
Example: In the example below I am searching for the word tile, which is used 8 times in total: 4 times in the blue tiles and another 4 times in the purple tiles. However, when I search for the word tile, the browser only finds the 4 instances of the word that are currently shown on the screen at the time of the search. It ignores all instances of the word that are not rendered on the screen at the time of the search.
Documentation: The Flutter and Dart documentation does not have any information on searchable text and I do not see any other similar widgets or properties available.
Attempts: I have tried using a SelectableText widget, but the same problem persists.
The extensive features of Flutter make it one of the best choices for the development of native apps for Android and iOS. With Flutter web development, designing applications across different platforms become a streamlined, smooth process.
Flutter for web is a code-compatible implementation of Flutter that is rendered using standards-based web technologies: HTML, CSS and JavaScript. With Flutter for web, you can compile existing Flutter code written in Dart into a client experience that can be embedded in the browser and deployed to any web server.
Since Flutter is written in Dart, a language that offers JavaScript compilation, it was a natural next step to explore the web as a target. This also builds towards our vision of providing a portable framework for building beautiful UI wherever you want to paint pixels.
You can use element = document.getElementById('searchable_text')
and element.textContent || a.innerText
. See JavaScript tutorial on W3Schools.
Resources:
querySelector
on Dart docs.Tell us what worked for your!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With