mind_map 0.0.1 mind_map: ^0.0.1 copied to clipboard
Mind map is a library that helps users create mind trees
import 'package:flutter/material.dart';
import 'package:mind_map/mind_map.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: const MyHomePage(title: 'Mind map'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
int _counter = 0;
void _incrementCounter() {
setState(() {
_counter++;
});
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance as done
// by the _incrementCounter method above.
//
// The Flutter framework has been optimized to make rerunning build methods
// fast, so that you can just rebuild anything that needs updating rather
// than having to individually change instances of widgets.
return Scaffold(
appBar: AppBar(
// Here we take the value from the MyHomePage object that was created by
// the App.build method, and use it to set our appbar title.
title: Text(widget.title),
),
body: Row(
children: [
Container(
decoration: BoxDecoration(
color: Colors.grey, borderRadius: BorderRadius.circular(10)),
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
margin: const EdgeInsets.only(left: 10),
child: const Text('Parent MindMap'),
),
Expanded(
child: MindMap(
padding: const EdgeInsets.only(left: 50),
dotRadius: 4,
children: [
Container(
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.circular(10)),
padding:
const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
margin:
const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: const Text('Component 1'),
),
GestureDetector(
onTap: () {
debugPrint('12313');
},
child: Container(
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.circular(10)),
padding: const EdgeInsets.symmetric(
vertical: 10, horizontal: 10),
margin: const EdgeInsets.symmetric(
vertical: 10, horizontal: 10),
child: const Text('Component 2'),
),
),
Container(
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.circular(10)),
margin:
const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding:
const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: const Text('Component 3'),
),
Container(
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.circular(10),
),
margin:
const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding:
const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: const Text('Component 4'),
),
Container(
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.circular(10),
),
margin:
const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
padding:
const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: const Text('Component 5'),
),
Container(
decoration: BoxDecoration(
color: Colors.grey,
borderRadius: BorderRadius.circular(10)),
padding:
const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
margin:
const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
child: const Text('Component 6 '),
),
],
),
)
],
),
floatingActionButton: FloatingActionButton(
onPressed: _incrementCounter,
tooltip: 'Increment',
child: const Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}