I am building a list of boxes layouts in my app using flutter. I want dotted border around the box. I have used card
widget to create the boxes. But, how can I get dotted border around the boxes?
相关问题
- Flutter : Prepare list data from http request
- How to schedule an alarm on specific time in Flutt
- MappedListIterable is not a SubType
- 'firebase_messaging/FirebaseMessagingPlugin.h&
- What is the difference between generics and dynami
相关文章
- Observatory server failed to start - Fails to crea
- Flutter error retrieving device properties for ro.
- Adding Shadows at the bottom of a container in flu
- Flutter. Check if a file exists before loading it
- Flutter - http.get fails on macos build target: Co
- Receive share file intents with Flutter
- Do stateless widgets dispose on their own?
- How to clean your build with Flutter RP2 in Androi
Currently, there is no support for a dashed border in Flutter, since there are only two styles:
Solid or None
To add a border to your widget you need to do the following:
Part of the properties of BoxDecoration is border
I also found out this SO question which demonstrates how to add a circular dashed border.
EDIT
I have added this as a package in pub.
Now, all you need to do is
Working Solution [Outdated]
Like tomerpacific said in this answer, Flutter does not have a default implementation for dashed border at the moment.
I worked for some time yesterday and was able to come up with a solution using
CustomPainter
. Hope this helps someone.Add the
DashedRect
to your container, like soDashedRect.dart
I do not expect this to fit in with all use cases and there is a lot of room for customization and improvement. Comment if you find any bugs.