I want to include a outlined material card with flutter, but since the card widget doesn't have a style element or something similar, I am not sure how to implement this.
I tried using the shape:
property but wasn't very successful, mostly because I didn't understand how it works.
Steps to add border to container in Flutter:Step 1: Go to the Container in which you want to add a border. Step 2: Add the decoration parameter and assign the BoxDecoration class. Inside the BoxDecoration add the parameter border and set it to Border. all().
Key class Null safety A Key is an identifier for Widgets, Elements and SemanticsNodes. A new widget will only be used to update an existing element if its key is the same as the key of the current widget associated with the element. Your browser can't play this video.
Output:
It has shape
property which takes a Border
you can change that.
Card(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40), // if you need this
side: BorderSide(
color: Colors.grey.withOpacity(0.2),
width: 1,
),
),
child: Container(
color: Colors.white,
width: 200,
height: 200,
),
)
I think the screenshot you showed can also be achieved by just using elevation
property of the Card
.
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