Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 288 Vote(s) - 3.41 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add border Radius in the Inkwell widget in flutter

#1
I want to add a hover color property to a container using the inkwell widget but the container has its own border-radius and when I am using the hover property using inkwell it is taking its custom shape and making it look rectangle in shape after hovering on the inkwell.

Here's my code snippet:

InkWell(

onTap: () {},
hoverColor: Colors.red[200],
child: Container(
width: 70.w,
height: 60.h,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
),
child: Row(
children: [
Image.asset(
'images/call.png',
height: 30.h,
),
Text(
'Call',
style: white,
),
],
),
),
),

I hope I made you understand the problem well

Please help me solve the issue or provide an alternate to it.

Reply

#2
The `Inkwell` widget has a property `customBorder` of type `ShapeBorder`. You can use that to provide a `borderRadius` to your `Inkwell`.

E.g.:

customBorder: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20),
),
Reply

#3
```
InkWell(
borderRadius: BorderRadius.circular(12),
child: // ...
);
```
Reply

#4
To make splash also rounded, use suitable options of `clipBehavior` for `Material` widget.
Reply

#5
**Simple and New Approach/Solution**

I somehow agree with **@Matthias's** answer but if you need more realistic answer rather than giving `RoundedRectangleBorder` to `customBorder` property, then simply use `CircleBorder()` like an example below:

`InkWell(customBorder: CircleBorder(),
// ...
);`
Reply

#6
The **Inkwell** widget has a property **borderRadius** of type **BorderRadius**

InkWell(
borderRadius: BorderRadius.circular(25),
// ...
);

OR

InkWell(
customBorder: CircleBorder(),
// ...
);
Reply

#7
You can use the clip behavior to not have hard coded values when you have a widget that already has a border radius, eg a `Card` for example:

return Card(
clipBehavior: Clip.antiAlias,
child: InkWell(

Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through