Skip to content

Commit 2d70cbe

Browse files
committed
Run dart format .
1 parent cc2f69f commit 2d70cbe

File tree

6 files changed

+29
-15
lines changed

6 files changed

+29
-15
lines changed

example/lib/main.dart

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ class _MyHomePageState extends State<MyHomePage> {
3939
@override
4040
void initState() {
4141
WidgetsBinding.instance.addPostFrameCallback((_) async {
42-
final strOrganizationChart = await rootBundle.loadString('assets/organization_chart.json');
42+
final strOrganizationChart =
43+
await rootBundle.loadString('assets/organization_chart.json');
4344
final organizationChartJson = json.decode(strOrganizationChart);
4445
final organizationChart = OrganizationChart(
4546
data: (organizationChartJson['data'] as List<dynamic>?)?.map((e) {
@@ -58,7 +59,8 @@ class _MyHomePageState extends State<MyHomePage> {
5859
super.initState();
5960
}
6061

61-
TreeNodeData mapOrganizationChartToTreeNodeData(ItemOrganizationChart itemOrganizationChart, TreeNodeData? parent) {
62+
TreeNodeData mapOrganizationChartToTreeNodeData(
63+
ItemOrganizationChart itemOrganizationChart, TreeNodeData? parent) {
6264
final children = itemOrganizationChart.children ?? [];
6365
final treeNodeData = TreeNodeData(
6466
title: itemOrganizationChart.name ?? '-',
@@ -70,7 +72,9 @@ class _MyHomePageState extends State<MyHomePage> {
7072
);
7173
final nestedChildren = children.isEmpty
7274
? <TreeNodeData>[]
73-
: children.map((e) => mapOrganizationChartToTreeNodeData(e, treeNodeData)).toList();
75+
: children
76+
.map((e) => mapOrganizationChartToTreeNodeData(e, treeNodeData))
77+
.toList();
7478
treeNodeData.children = nestedChildren;
7579
return treeNodeData;
7680
}
@@ -153,7 +157,8 @@ class ItemOrganizationChart {
153157
pid: json['id'],
154158
name: json['name'],
155159
children: (json['children'] as List<dynamic>?)
156-
?.map((e) => ItemOrganizationChart.fromJson(e as Map<String, dynamic>))
160+
?.map(
161+
(e) => ItemOrganizationChart.fromJson(e as Map<String, dynamic>))
157162
.toList(),
158163
);
159164
}

lib/bloc/treeview_bloc.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ class TreeviewBloc extends Bloc<TreeviewEvent, TreeviewState> {
1111
on<UpdateTreeviewEvent>(_onUpdateTreeviewEvent);
1212
}
1313

14-
FutureOr<void> _onUpdateTreeviewEvent(UpdateTreeviewEvent event, Emitter<TreeviewState> emit) {
14+
FutureOr<void> _onUpdateTreeviewEvent(
15+
UpdateTreeviewEvent event, Emitter<TreeviewState> emit) {
1516
emit(UpdatedTreeviewState());
1617
}
1718
}

lib/bloc/treeview_event.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ part of 'treeview_bloc.dart';
22

33
abstract class TreeviewEvent {}
44

5-
class UpdateTreeviewEvent extends TreeviewEvent {}
5+
class UpdateTreeviewEvent extends TreeviewEvent {}

lib/bloc/treeview_state.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ abstract class TreeviewState {}
44

55
class InitialTreeviewState extends TreeviewState {}
66

7-
class UpdatedTreeviewState extends TreeviewState {}
7+
class UpdatedTreeviewState extends TreeviewState {}

lib/src/flutter_treeview_plus.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ class _FlutterTreeviewPlusState extends State<FlutterTreeviewPlus> {
7979
tempNode.children = _filter(val, tempNode.children);
8080
}
8181

82-
if (tempNode.title.contains(RegExp(val, caseSensitive: false)) || tempNode.children.isNotEmpty) {
82+
if (tempNode.title.contains(RegExp(val, caseSensitive: false)) ||
83+
tempNode.children.isNotEmpty) {
8384
tempNodes.add(tempNode);
8485
}
8586
}
@@ -173,7 +174,7 @@ class _FlutterTreeviewPlusState extends State<FlutterTreeviewPlus> {
173174
),
174175
...List.generate(
175176
_renderList.length,
176-
(int index) {
177+
(int index) {
177178
return TreeNode(
178179
load: load,
179180
remove: remove,

lib/src/tree_node.dart

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ class TreeNode extends StatefulWidget {
6060
State<TreeNode> createState() => _TreeNodeState();
6161
}
6262

63-
class _TreeNodeState extends State<TreeNode> with SingleTickerProviderStateMixin {
63+
class _TreeNodeState extends State<TreeNode>
64+
with SingleTickerProviderStateMixin {
6465
bool _isExpanded = false;
6566
bool? _isChecked = false;
6667
bool _showLoading = false;
@@ -118,15 +119,18 @@ class _TreeNodeState extends State<TreeNode> with SingleTickerProviderStateMixin
118119
Widget build(BuildContext context) {
119120
if (widget.parentState != null) _isChecked = widget.data.checked;
120121

121-
bool hasData = widget.data.children.isNotEmpty || (widget.lazy && !_isExpanded);
122+
bool hasData =
123+
widget.data.children.isNotEmpty || (widget.lazy && !_isExpanded);
122124

123125
return Column(
124126
crossAxisAlignment: CrossAxisAlignment.start,
125127
children: <Widget>[
126128
InkWell(
127129
splashColor: widget.contentTappable ? null : Colors.transparent,
128130
highlightColor: widget.contentTappable ? null : Colors.transparent,
129-
mouseCursor: widget.contentTappable ? SystemMouseCursors.click : MouseCursor.defer,
131+
mouseCursor: widget.contentTappable
132+
? SystemMouseCursors.click
133+
: MouseCursor.defer,
130134
onTap: widget.contentTappable
131135
? () {
132136
if (hasData) {
@@ -175,7 +179,8 @@ class _TreeNodeState extends State<TreeNode> with SingleTickerProviderStateMixin
175179
if (widget.parentState != null) {
176180
_checkUncheckChildren(widget.data.children);
177181
_checkUncheckParent(widget.parent);
178-
BlocProvider.of<TreeviewBloc>(context).add(UpdateTreeviewEvent());
182+
BlocProvider.of<TreeviewBloc>(context)
183+
.add(UpdateTreeviewEvent());
179184
}
180185
widget.onCheck(_isChecked, widget.data);
181186
setState(() {});
@@ -223,9 +228,11 @@ class _TreeNodeState extends State<TreeNode> with SingleTickerProviderStateMixin
223228
widget.remove(widget.data);
224229
widget.onRemove(widget.data, widget.parent);
225230
},
226-
child: const Text('Remove', style: TextStyle(fontSize: 12.0)),
231+
child:
232+
const Text('Remove', style: TextStyle(fontSize: 12.0)),
227233
),
228-
if (widget.data.customActions?.isNotEmpty == true) ...widget.data.customActions!,
234+
if (widget.data.customActions?.isNotEmpty == true)
235+
...widget.data.customActions!,
229236
],
230237
),
231238
),

0 commit comments

Comments
 (0)