mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 10:17:16 +08:00
GraphView: Show the Node's label
This commit is contained in:
@ -502,7 +502,7 @@ class _GraphStackViewState extends State<GraphStackView> {
|
|||||||
for (var node in widget.graph.nodes) {
|
for (var node in widget.graph.nodes) {
|
||||||
var w = Positioned(
|
var w = Positioned(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
child: NodeWidget(),
|
child: NodeWidget(node),
|
||||||
onPanStart: (details) {
|
onPanStart: (details) {
|
||||||
node.x = details.globalPosition.dx;
|
node.x = details.globalPosition.dx;
|
||||||
node.y = details.globalPosition.dy;
|
node.y = details.globalPosition.dy;
|
||||||
@ -538,15 +538,25 @@ class _GraphStackViewState extends State<GraphStackView> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class NodeWidget extends StatelessWidget {
|
class NodeWidget extends StatelessWidget {
|
||||||
|
final Node node;
|
||||||
|
|
||||||
|
NodeWidget(this.node);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Column(
|
||||||
width: 50,
|
children: [
|
||||||
height: 50,
|
Container(
|
||||||
decoration: const BoxDecoration(
|
width: 50,
|
||||||
color: Colors.orange,
|
height: 50,
|
||||||
shape: BoxShape.circle,
|
decoration: const BoxDecoration(
|
||||||
),
|
color: Colors.orange,
|
||||||
|
shape: BoxShape.circle,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(node.label),
|
||||||
|
],
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user