chulwoo-park / timelines

A powerful & easy to use timeline package for Flutter! 🚀
https://pub.dev/packages/timelines
MIT License
721 stars 147 forks source link

Question : How to align the nodes to the left ? #34

Closed adbonnin closed 3 years ago

adbonnin commented 3 years ago

Hi,

I would like to align the nodes to the left in order to have a fixed size for the content and the remaining space for the opposite content. There is a property nodeAlign in TimelineTile that used to compute the effective node position :

  double _getEffectiveNodePosition(BuildContext context) {
    if (nodeAlign == TimelineNodeAlign.start) return 0.0;
    if (nodeAlign == TimelineNodeAlign.end) return 1.0;
    var nodePosition = this.nodePosition;
    nodePosition ??= (node is TimelineTileNode)
        ? (node as TimelineTileNode).getEffectivePosition(context)
        : TimelineTheme.of(context).nodePosition;
    return nodePosition;
  }

This property can't be used in TimelineTileBuilder so please what is the simplest way to define the nodeAlign ?

chulwoo-park commented 3 years ago

Try using nodePosition in TimelineTheme?

Check how it works here (Theme)

pierre-gancel commented 3 years ago

Great package !


Timeline.tileBuilder(theme: TimelineThemeData(connectorTheme: ConnectorThemeData(space: 51)))
adbonnin commented 3 years ago

Try using nodePosition in TimelineTheme?

Check how it works here (Theme)

nodePosition works but it's the a percentage between 0 and 1. If the screen is too small then the oppositeContent width will shrink it's content. What I'm looking for is a fixed width for oppositeContent and the remaining width for the content.

Timeline.tileBuilder(theme: TimelineThemeData(connectorTheme: ConnectorThemeData(space: 51)))

Connector's space is the space between the content and the oppositeContent, it's not the width of the oppositeContent.

chulwoo-park commented 3 years ago

@adbonnin

I got it.

There is no option yet to provide the feature you are talking about.😢

Since it uses Flexible internally, I think it is necessary to explicitly limit the size of the opossite content.

adbonnin commented 3 years ago

ok thank you 😄