nabil6391 / graphview

Flutter GraphView is used to display data in graph structures. It can display Tree layout, Directed and Layered graph. Useful for Family Tree, Hierarchy View.
MIT License
424 stars 117 forks source link

Adjustment for Phone #14

Closed gfiury closed 3 years ago

gfiury commented 3 years ago

Hi,

Currently I'm trying to graph a Top to Bottom diagram. I'm having trouble to make the nodes visible on a phone, they are somewhere else placed on the screen. The picture is the example of TreeViewPage without changes

Phone: Galaxy S10 Android: 10

Phone

On the contrary on a Android Tablet works just fine with Android 9

Tablet

What I need to change/configure to fix the Phone view?

Regards, William

gfiury commented 3 years ago

There is a problem with the constrains or size of the Graph

I/flutter (29557): ══╡ EXCEPTION CAUGHT BY RENDERING LIBRARY ╞═════════════════════════════════════════════════════════
I/flutter (29557): The following assertion was thrown during performLayout():
I/flutter (29557): RenderCustomLayoutBox does not meet its constraints.
I/flutter (29557): Constraints:
I/flutter (29557):   BoxConstraints(0.0<=w<=411.4, h=710.0)
I/flutter (29557): Size:
I/flutter (29557):   Size(487.0, 310.0)

If the graph is small enough it can be seen correctly, but If I add another level (leaf), it doesn't work

Left to Right

gfiury commented 3 years ago

Fixed it, it would be great if the example has comments, the important changes are the Expandedand the constrained: false and also scaleEnabled: false

Expanded(child: InteractiveViewer(
              constrained: false,
              scaleEnabled: false,
                    boundaryMargin: EdgeInsets.all(100),
                    minScale: 0.01,
                    maxScale: 5.6,
                    child: GraphView(
                      graph: graph,
                      algorithm: BuchheimWalkerAlgorithm(
                          builder, TreeEdgeRenderer(builder)),
                      paint: Paint()
                        ..color = Colors.green
                        ..strokeWidth = 1
                        ..style = PaintingStyle.stroke,
                    )))