how to customise the toolbar for a flutter SelectableRegion - flutter

When text in a SelectableRegion widget is selected, the toolbar generated by materialTextSelectionControls has options for 'Copy' and 'SelectAll'. What is the best way to disable 'SelectAll' and how can the styling (in particular, text color) of the options be changed?

So far, my answer to my question is to copy the relevant flutter files for the SelectableRegion widget and customise them to make a MySelectableRegion widget.
But surely there is a better way?
For anyone wanting to do the same as me, the files I copied and am editing are
flutter/packages/flutter/lib/src/widgets/selectable_region.dart
flutter/packages/flutter/lib/src/material/text_selection.dart
flutter/packages/flutter/lib/src/material/text_selection_toolbar.dart

Related

How to create dropdown widget in flutter

I am trying to make a dropdown widget that appears from the location of the clicked widget. I know there are a lot of solutions on the internet already regarding this, however, none of the ones I found serve my specific needs.
Using dropdown packages: This does not work, as these widgets do not provide any way of customization. They are always just lists of items. What I want is a dropdown Container that I can fully customize.
Using dialogs: It is tough to customize the location of these dialogs. I want it to appear right at the location of the clicked button/widget.
The white circle here is the widget that is supposed to be clicked on
This is what is supposed to appear after clicking the circle. As you can see here it is not placed correctly. The circle in the widget and the circle we click should be on top of each other. And the dropdown itself should be a container not a list of widgets like here as opposed to a dropdown list.
I believe this question should provide you with an answer.
If not, feel free to say so.
(The answer points to this package: flutter_portal)

How to edit flutter_clean_calendar package?

So i want to customize some widget in this package. I want to change selectedDay(the big red circle) size.
So i go to it's definition and try to change it. I just need to add some width as argument to Container, but i can't.
I also try to wraps widget by using the bell icon, but it doesn't work. I can't choose any widget, other than getX
I try to type, but no option shows up
My flutter plugins work just fine in other file. So is it mean that i can't edit or add any widget in lib file? How to edit this file?

Flutter: Make text/images selectable in whole web app

In the Flutter web apps, there is no default functionality which makes text and images in the app selectable.
Is there a way to enable selection functionality for text/image on web?
I did check SelectableText widget but it is only for text and I would need to use it over every text. Also, you can't select text in multiple SelectableText widgets at once, you can only select text in one of them. I'm looking for a solution to select all text in the app without making change to every text widget.
Let me know if there’s one step solution to achieve this thing in whole web app.
In Flutter 3.3, with the introduction of the SelectableArea widget, any child of the SelectableArea widget has selection enabled for free!
To take advantage of this powerful new feature, simply wrap your route body (such as the Scaffold) with the SelectionArea widget and let Flutter do the rest.
For a more comprehensive deep dive into this awesome new feature, please visit the SelectableArea API page.
Flutter Web currently does not support multiple text selection across SelectableText widgets.
However, there are some experimental widgets that people are currently working on. According to a guide available at:
Custom SelectableScope Widget
They have proposed a custom widget, a Selectable scope, which basically allows for anything within it to be selectable (currently text and images)
NOTE: THIS IS CURRENTLY UNDER EXPERIMENTATION AND MIGHT CHANGE AS MENTIONED IN THE PROVIDED LINK.

How do you hide widgets when you are using/tapped into a TextFormField in flutter?

I would like to hide a Text widget when a user is currently tapped into a TextFormField to type. And when they aren't using it, I would like for it to be visible again. Only problem is I don't see a way to accomplish this. Any help is appreciated!
The easiest way is to check whether the user is using TextField or not is by detecting whether the keyboard is visible or not. For that follow this stack-overflow post. Once you know whether keyboard is visible or not, you can simply update the state(setState()) and decide whether to hide the widget or not. Follow this stack-overflow post as a reference to hide and un-hide widgets in flutter.

How to recreate a TextField widget with my own behavior?

I would like to create a test application with PyGTK.
My goal is to create a textfield widget 100% customized. Indeed, I would like to fully change the default behavior of a textfield widget.
Is it possible to fully change the behavior of a textfield (like shortcuts/keymaps, scroll behavior, etc.) ?
Is it possible to recreate the widget from scratch ? If yes, how can I do that ?
Thanks.
Are you referring to a gtk.Entry or a gtk.TextView?
In any case, you are going to want to subclass the widget you want to customize and override any methods that you need to change. If you can read C code, that would be helpful as you can look over the widget source code. If you've never written your own widgets, you might want to start with a tutorial like http://www.learningpython.com/2006/07/25/writing-a-custom-widget-using-pygtk/
Don't recreate it from scratch. Derive from it instead and overload what you intend to change.