Skip to content

Commit e286045

Browse files
committed
Applied dartfmt
1 parent fb04663 commit e286045

10 files changed

+215
-146
lines changed

example/lib/GraphViewClusterPage.dart

+32-31
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
import 'dart:math';
32

43
import 'package:flutter/material.dart';
@@ -14,49 +13,51 @@ class _GraphClusterViewPageState extends State<GraphClusterViewPage> {
1413
Widget build(BuildContext context) {
1514
return Scaffold(
1615
body: Column(
17-
children: [
18-
InteractiveViewer(
19-
constrained: true,
20-
boundaryMargin: EdgeInsets.all(8),
21-
minScale: 0.001,
22-
maxScale: 100,
23-
child: GraphView(
24-
graph: graph,
25-
algorithm: builder,
26-
paint: Paint()..color = Colors.green..strokeWidth = 1..style = PaintingStyle.fill,
27-
)),
28-
],
29-
));
16+
children: [
17+
InteractiveViewer(
18+
constrained: true,
19+
boundaryMargin: EdgeInsets.all(8),
20+
minScale: 0.001,
21+
maxScale: 100,
22+
child: GraphView(
23+
graph: graph,
24+
algorithm: builder,
25+
paint: Paint()
26+
..color = Colors.green
27+
..strokeWidth = 1
28+
..style = PaintingStyle.fill,
29+
)),
30+
],
31+
));
3032
}
3133

3234
int n = 8;
3335
Random r = Random();
3436

3537
Widget getNodeText(int i) {
3638
return GestureDetector(
37-
onLongPressStart: (details){
39+
onLongPressStart: (details) {
3840
var x = details.globalPosition.dx;
3941
var y = details.globalPosition.dy;
40-
Offset(x,y);
42+
Offset(x, y);
4143
},
42-
43-
onPanStart: (details){
44+
onPanStart: (details) {
4445
var x = details.globalPosition.dx;
4546
var y = details.globalPosition.dy;
4647
setState(() {
47-
builder.setFocusedNode(graph.getNodeAtPosition(i-1));
48-
graph.getNodeAtPosition(i-1).position = Offset(x,y);
48+
builder.setFocusedNode(graph.getNodeAtPosition(i - 1));
49+
graph.getNodeAtPosition(i - 1).position = Offset(x, y);
4950
});
5051
},
5152
onPanUpdate: (details) {
5253
var x = details.globalPosition.dx;
5354
var y = details.globalPosition.dy;
5455
setState(() {
55-
builder.setFocusedNode(graph.getNodeAtPosition(i-1));
56-
graph.getNodeAtPosition(i-1).position = Offset(x,y);
56+
builder.setFocusedNode(graph.getNodeAtPosition(i - 1));
57+
graph.getNodeAtPosition(i - 1).position = Offset(x, y);
5758
});
5859
},
59-
onPanEnd: (details){
60+
onPanEnd: (details) {
6061
builder.setFocusedNode(null);
6162
},
6263
child: Container(
@@ -76,14 +77,14 @@ class _GraphClusterViewPageState extends State<GraphClusterViewPage> {
7677

7778
@override
7879
void initState() {
79-
final a = Node(getNodeText(1));
80-
final b = Node(getNodeText(2));
81-
final c = Node(getNodeText(3));
82-
final d = Node(getNodeText(4));
83-
final e = Node(getNodeText(5));
84-
final f = Node(getNodeText(6));
85-
final g = Node(getNodeText(7));
86-
final h = Node(getNodeText(8));
80+
final a = Node(getNodeText(1));
81+
final b = Node(getNodeText(2));
82+
final c = Node(getNodeText(3));
83+
final d = Node(getNodeText(4));
84+
final e = Node(getNodeText(5));
85+
final f = Node(getNodeText(6));
86+
final g = Node(getNodeText(7));
87+
final h = Node(getNodeText(8));
8788

8889
graph.addEdge(a, b, paint: Paint()..color = Colors.red);
8990
graph.addEdge(a, c);

example/lib/LayerGraphView.dart

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ class _LayeredGraphViewPageState extends State<LayeredGraphViewPage> {
5959
child: GraphView(
6060
graph: graph,
6161
algorithm: SugiyamaAlgorithm(builder),
62-
paint: Paint()..color = Colors.green..strokeWidth = 1..style = PaintingStyle.stroke,
62+
paint: Paint()
63+
..color = Colors.green
64+
..strokeWidth = 1
65+
..style = PaintingStyle.stroke,
6366
)),
6467
],
6568
));

example/lib/TreeViewPage.dart

+72-70
Original file line numberDiff line numberDiff line change
@@ -13,79 +13,81 @@ class _TreeViewPageState extends State<TreeViewPage> {
1313
Widget build(BuildContext context) {
1414
return Scaffold(
1515
body: Column(
16-
mainAxisSize: MainAxisSize.max,
16+
mainAxisSize: MainAxisSize.max,
17+
children: [
18+
Wrap(
1719
children: [
18-
Wrap(
19-
children: [
20-
Container(
21-
width: 100,
22-
child: TextFormField(
23-
initialValue: builder.siblingSeparation.toString(),
24-
decoration: InputDecoration(labelText: "Sibling Separation"),
25-
onChanged: (text) {
26-
builder.siblingSeparation = int.tryParse(text) ?? 100;
27-
this.setState(() {});
28-
},
29-
),
30-
),
31-
Container(
32-
width: 100,
33-
child: TextFormField(
34-
initialValue: builder.levelSeparation.toString(),
35-
decoration: InputDecoration(labelText: "Level Separation"),
36-
onChanged: (text) {
37-
builder.levelSeparation = int.tryParse(text) ?? 100;
38-
this.setState(() {});
39-
},
40-
),
41-
),
42-
Container(
43-
width: 100,
44-
child: TextFormField(
45-
initialValue: builder.subtreeSeparation.toString(),
46-
decoration: InputDecoration(labelText: "Subtree separation"),
47-
onChanged: (text) {
48-
builder.subtreeSeparation = int.tryParse(text) ?? 100;
49-
this.setState(() {});
50-
},
51-
),
52-
),
53-
Container(
54-
width: 100,
55-
child: TextFormField(
56-
initialValue: builder.orientation.toString(),
57-
decoration: InputDecoration(labelText: "Orientation"),
58-
onChanged: (text) {
59-
builder.orientation = int.tryParse(text) ?? 100;
60-
this.setState(() {});
61-
},
62-
),
63-
),
64-
RaisedButton(
65-
onPressed: () {
66-
final Node node12 = Node(getNodeText());
67-
var edge = graph.getNodeAtPosition(r.nextInt(graph.nodeCount()));
68-
print(edge);
69-
graph.addEdge(edge, node12);
70-
setState(() {});
71-
},
72-
child: Text("Add"),
73-
)
74-
],
20+
Container(
21+
width: 100,
22+
child: TextFormField(
23+
initialValue: builder.siblingSeparation.toString(),
24+
decoration: InputDecoration(labelText: "Sibling Separation"),
25+
onChanged: (text) {
26+
builder.siblingSeparation = int.tryParse(text) ?? 100;
27+
this.setState(() {});
28+
},
29+
),
7530
),
76-
InteractiveViewer(
77-
constrained: true,
78-
boundaryMargin: EdgeInsets.all(100),
79-
minScale: 0.01,
80-
maxScale: 5.6,
81-
child: GraphView(
82-
graph: graph,
83-
algorithm: BuchheimWalkerAlgorithm(builder, TreeEdgeRenderer(builder)),
84-
paint: Paint()..color = Colors.green..strokeWidth = 1..style = PaintingStyle.stroke,
85-
)),
31+
Container(
32+
width: 100,
33+
child: TextFormField(
34+
initialValue: builder.levelSeparation.toString(),
35+
decoration: InputDecoration(labelText: "Level Separation"),
36+
onChanged: (text) {
37+
builder.levelSeparation = int.tryParse(text) ?? 100;
38+
this.setState(() {});
39+
},
40+
),
41+
),
42+
Container(
43+
width: 100,
44+
child: TextFormField(
45+
initialValue: builder.subtreeSeparation.toString(),
46+
decoration: InputDecoration(labelText: "Subtree separation"),
47+
onChanged: (text) {
48+
builder.subtreeSeparation = int.tryParse(text) ?? 100;
49+
this.setState(() {});
50+
},
51+
),
52+
),
53+
Container(
54+
width: 100,
55+
child: TextFormField(
56+
initialValue: builder.orientation.toString(),
57+
decoration: InputDecoration(labelText: "Orientation"),
58+
onChanged: (text) {
59+
builder.orientation = int.tryParse(text) ?? 100;
60+
this.setState(() {});
61+
},
62+
),
63+
),
64+
RaisedButton(
65+
onPressed: () {
66+
final Node node12 = Node(getNodeText());
67+
var edge = graph.getNodeAtPosition(r.nextInt(graph.nodeCount()));
68+
print(edge);
69+
graph.addEdge(edge, node12);
70+
setState(() {});
71+
},
72+
child: Text("Add"),
73+
)
8674
],
87-
)
88-
);
75+
),
76+
InteractiveViewer(
77+
constrained: true,
78+
boundaryMargin: EdgeInsets.all(100),
79+
minScale: 0.01,
80+
maxScale: 5.6,
81+
child: GraphView(
82+
graph: graph,
83+
algorithm: BuchheimWalkerAlgorithm(builder, TreeEdgeRenderer(builder)),
84+
paint: Paint()
85+
..color = Colors.green
86+
..strokeWidth = 1
87+
..style = PaintingStyle.stroke,
88+
)),
89+
],
90+
));
8991
}
9092

9193
Random r = Random();

example/lib/example.dart

+22-22
Original file line numberDiff line numberDiff line change
@@ -29,39 +29,39 @@ class Home extends StatelessWidget {
2929
child: Column(children: [
3030
FlatButton(
3131
onPressed: () => Navigator.push(
32-
context,
33-
MaterialPageRoute(
34-
builder: (context) => Scaffold(
35-
appBar: AppBar(),
36-
body: TreeViewPage(),
37-
)),
38-
),
32+
context,
33+
MaterialPageRoute(
34+
builder: (context) => Scaffold(
35+
appBar: AppBar(),
36+
body: TreeViewPage(),
37+
)),
38+
),
3939
child: Text(
4040
"Tree View (BuchheimWalker)",
4141
style: TextStyle(color: Theme.of(context).primaryColor),
4242
)),
4343
FlatButton(
4444
onPressed: () => Navigator.push(
45-
context,
46-
MaterialPageRoute(
47-
builder: (context) => Scaffold(
48-
appBar: AppBar(),
49-
body: GraphClusterViewPage(),
50-
)),
51-
),
45+
context,
46+
MaterialPageRoute(
47+
builder: (context) => Scaffold(
48+
appBar: AppBar(),
49+
body: GraphClusterViewPage(),
50+
)),
51+
),
5252
child: Text(
5353
"Graph Cluster View (FruchtermanReingold)",
5454
style: TextStyle(color: Theme.of(context).primaryColor),
5555
)),
5656
FlatButton(
5757
onPressed: () => Navigator.push(
58-
context,
59-
MaterialPageRoute(
60-
builder: (context) => Scaffold(
61-
appBar: AppBar(),
62-
body: LayeredGraphViewPage(),
63-
)),
64-
),
58+
context,
59+
MaterialPageRoute(
60+
builder: (context) => Scaffold(
61+
appBar: AppBar(),
62+
body: LayeredGraphViewPage(),
63+
)),
64+
),
6565
child: Text(
6666
"Layered View (Sugiyama)",
6767
style: TextStyle(color: Theme.of(context).primaryColor),
@@ -70,4 +70,4 @@ class Home extends StatelessWidget {
7070
),
7171
);
7272
}
73-
}
73+
}

0 commit comments

Comments
 (0)