When I tap on a item on tab bar a circle will appear and disappear, please tell me name of this animation and how could I implement it in a flutter
click for seeing sample
The effect is called a ripple. And you can get it by wrapping a widget in an Inkwell.
See more here about it here: https://docs.flutter.dev/cookbook/gestures/ripples
Hi In Scaffold BottomNavigationBar() has inbuilt properties of circle appear and disappear
You can use a widget called Gesture Detector which also has ripple effect
I've been trying to make Bookmark button's onTap work because it was working only sometimes.
I'm using the Expanded widget in the Bookmark button but when I toggle debug point on, I saw that its area is shrunk and that's why taps are not working. I give this widget size and added HitTestBehavior.translucent on GestureDetector but no luck.
Any idea how I can fit this button without losing its tap area?
I am using this
ColorFiltered(
colorFilter: ColorFilter.mode(Colors.black54, BlendMode.srcOut),
....
In order to create an overlay over my entire screen and then I cut out a section of it in order go highlight a widget which is below this overlay. Something similar to this:
My problem is that the widget behind it, is not clickable. The overlay consumes the click. How can I mark just that particular zone, to be clickable ? Nothing more, nothing less.
EDIT
I know I could use IgnorePointer but ... if I set it as a parent to ColorFiltered it'll just allow all the widget behind the overlay to be clicked. I need it to work ONLY on the highlighted area.
I'm starting to thing I need to rethink the highlighter, in order to achieve this functionality. Am I right ?
I would like to make a custom checkbox button with rounded corners.
Because I wasn't able to do it with a CheckBox widget, I simply created a container with rounded corners (and some styling depending on whether the "value" is true) and wrapped it in InkWell.
InkWell
Container
The problem is that the checkbox (container) is quite small and you have to tap precisely on the Container. When you use CheckBox or any other button, there is some tolerance (meaning that you can click slightly off the button). How can I achieve this with InkWell?
The only idea I have is to wrap the Container in Padding first:
InkWell
Padding
Container
Is this the only solution, or is there another way of making a "button" with InkWell, where the onTap function will execute even if you don't touch the button precisely?
When we want to achieve a button, we can choose raisedButton in flutter lib, also can a Container with onTap() function. So what's the difference between the two and which one should we choose in different situation?
Container function doesnot have onTap option, but you can achieve it by wrapping it in Guesture detector or Inkwell. There are no changes in the backend. But Raised button gives you the elevation, and animation on tap. You can also do it in the container, but it requires you to manually do it.
If you want a simple button quickly use RaisedButton.
If you want a more complex one, use Container or mixture of Containers, RaisedButton etc.
I am gonna offer something different... A tale of a treasure that is known to have answers to many questions, use cases and sometimes even examples. The name of this treasure is: official documentation. ;)
RaisedButton
A raised button is based on a Material widget whose Material.elevation increases when the button is pressed. Use raised buttons to add dimension to otherwise mostly flat layouts, e.g. in long busy lists of content, or in wide spaces. Avoid using raised buttons on already-raised content such as dialogs or cards.
Container
A convenience widget that combines common painting, positioning, and
sizing widgets.
GestureDetector
A widget that detects gestures. Attempts to recognize gestures that
correspond to its non-null callbacks. If this widget has a child, it
defers to that child for its sizing behavior. If it does not have a
child, it grows to fit the parent instead. By default a
GestureDetector with an invisible child ignores touches; this behavior
can be controlled with behavior. GestureDetector also listens for
accessibility events and maps them to the callbacks. To ignore
accessibility events, set excludeFromSemantics to true. See
flutter.dev/gestures/ for additional information. Material design
applications typically react to touches with ink splash effects. The
InkWell class implements this effect and can be used in place of a
GestureDetector for handling taps.
InkWell
A rectangular area of a Material that responds to touch. For a variant
of this widget that does not clip splashes, see InkResponse... The
InkWell widget must have a Material widget as an ancestor. The
Material widget is where the ink reactions are actually painted. This
matches the material design premise wherein the Material is what is
actually reacting to touches by spreading ink.
Well, technically you are right, they can both react to a click event. But a RaisedButton will have all the styles specific to the target platform taken care of for you (it inherits from MaterialButton).
note that it's the same in html: you can use a regular div with a click handler or use a button tag. The button will have a few styles already taken care of for you...