I’m trying to recreate this roadmap-style UI:
I thought tentatively:
children: [
index 1: ListTile
index 2: dotted
index 3: ListTile
index 4: dotted
...
But in the picture, the intersecting line looks as if it goes under the circle and comes out.
I would be grateful if I could be helped to achieve the same result. Thanks.
2
Answers
check
this sample
import ‘package:flutter/material.dart’;
I have created a road map widget based on this solution for the dash line.
The road map widget consists of two main parts: the dashed line section and the section for drawing icons on the dashed line.
Dashed curve line
Icon on the dotted line
I use a
Stack
to display the icon with calculated width and height to ensure that it fits the dash line path perfectly.Icon list wrapped by
Positioned
You can set the value to your preference or make it the parameter of the widget.
Below is the complete source code that you can easily copy and paste to run on dartpad.dev.
Updated Version
There is a different version where you can set a specific color for each path. If no colors are set for the path index, it will take the
pathColor
as default.