Skip to content

Commit d0a9c39

Browse files
committed
feat(master): v2.0.3
1. Set actions text to 12.0. 2. Add example loading.
1 parent 6875b5c commit d0a9c39

File tree

5 files changed

+206
-82
lines changed

5 files changed

+206
-82
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## [2.0.3] - 2022.03.24
2+
1. Set actions text to 12.0.
3+
2. Add example loading.
14
## [2.0.2] - 2022.03.23
25

36
1. Fix title overflow.

example/pubspec.lock

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ packages:
8080
path: ".."
8181
relative: true
8282
source: path
83-
version: "2.0.2"
83+
version: "2.0.3"
8484
lints:
8585
dependency: transitive
8686
description:

example/web/index.html

+198-66
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<!--
3+
<head>
4+
<!--
55
If you are serving your web app in a path other than the root, change the
66
href value below to reflect the base path you are serving from.
77
@@ -14,55 +14,182 @@
1414
This is a placeholder for base href that will be replaced by the value of
1515
the `--base-href` argument provided to `flutter build`.
1616
-->
17-
<base href="$FLUTTER_BASE_HREF">
18-
19-
<meta charset="UTF-8">
20-
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
21-
<meta name="description" content="A new Flutter project.">
22-
23-
<!-- iOS meta tags & icons -->
24-
<meta name="apple-mobile-web-app-capable" content="yes">
25-
<meta name="apple-mobile-web-app-status-bar-style" content="black">
26-
<meta name="apple-mobile-web-app-title" content="example">
27-
<link rel="apple-touch-icon" href="icons/Icon-192.png">
28-
29-
<!-- Favicon -->
30-
<link rel="icon" type="image/png" href="favicon.png"/>
31-
32-
<title>example</title>
33-
<link rel="manifest" href="manifest.json">
34-
</head>
35-
<body>
36-
<!-- This script installs service_worker.js to provide PWA functionality to
17+
<base href="$FLUTTER_BASE_HREF" />
18+
19+
<meta charset="UTF-8" />
20+
<meta content="IE=Edge" http-equiv="X-UA-Compatible" />
21+
<meta name="description" content="A new Flutter project." />
22+
23+
<!-- iOS meta tags & icons -->
24+
<meta name="apple-mobile-web-app-capable" content="yes" />
25+
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
26+
<meta name="apple-mobile-web-app-title" content="example" />
27+
<link rel="apple-touch-icon" href="icons/Icon-192.png" />
28+
29+
<!-- Favicon -->
30+
<link rel="icon" type="image/png" href="favicon.png" />
31+
32+
<title>flutter Tree Example</title>
33+
<link rel="manifest" href="manifest.json" />
34+
<style type="text/css">
35+
html,
36+
body {
37+
height: 100%;
38+
width: 100%;
39+
}
40+
.center {
41+
align-items: center;
42+
display: flex;
43+
justify-content: center;
44+
height: 100%;
45+
width: 100%;
46+
}
47+
48+
/* Credits: https://tobiasahlin.com/spinkit/ */
49+
50+
.sk-chase {
51+
width: 40px;
52+
height: 40px;
53+
position: relative;
54+
left: 0;
55+
right: 0;
56+
top: 0;
57+
bottom: 0;
58+
animation: sk-chase 2.5s infinite linear both;
59+
}
60+
61+
.sk-chase-dot {
62+
width: 100%;
63+
height: 100%;
64+
position: absolute;
65+
left: 0;
66+
top: 0;
67+
animation: sk-chase-dot 2s infinite ease-in-out both;
68+
}
69+
70+
.sk-chase-dot:before {
71+
content: "";
72+
display: block;
73+
width: 25%;
74+
height: 25%;
75+
border-radius: 100%;
76+
background-color: #1389fd;
77+
animation: sk-chase-dot-before 2s infinite ease-in-out both;
78+
}
79+
80+
.sk-chase-dot:nth-child(1) {
81+
animation-delay: -1.1s;
82+
}
83+
84+
.sk-chase-dot:nth-child(2) {
85+
animation-delay: -1s;
86+
}
87+
88+
.sk-chase-dot:nth-child(3) {
89+
animation-delay: -0.9s;
90+
}
91+
92+
.sk-chase-dot:nth-child(4) {
93+
animation-delay: -0.8s;
94+
}
95+
96+
.sk-chase-dot:nth-child(5) {
97+
animation-delay: -0.7s;
98+
}
99+
100+
.sk-chase-dot:nth-child(6) {
101+
animation-delay: -0.6s;
102+
}
103+
104+
.sk-chase-dot:nth-child(1):before {
105+
animation-delay: -1.1s;
106+
}
107+
108+
.sk-chase-dot:nth-child(2):before {
109+
animation-delay: -1s;
110+
}
111+
112+
.sk-chase-dot:nth-child(3):before {
113+
animation-delay: -0.9s;
114+
}
115+
116+
.sk-chase-dot:nth-child(4):before {
117+
animation-delay: -0.8s;
118+
}
119+
120+
.sk-chase-dot:nth-child(5):before {
121+
animation-delay: -0.7s;
122+
}
123+
124+
.sk-chase-dot:nth-child(6):before {
125+
animation-delay: -0.6s;
126+
}
127+
128+
@keyframes sk-chase {
129+
100% {
130+
transform: rotate(360deg);
131+
}
132+
}
133+
134+
@keyframes sk-chase-dot {
135+
80%,
136+
100% {
137+
transform: rotate(360deg);
138+
}
139+
}
140+
141+
@keyframes sk-chase-dot-before {
142+
50% {
143+
transform: scale(0.4);
144+
}
145+
100%,
146+
0% {
147+
transform: scale(1);
148+
}
149+
}
150+
</style>
151+
</head>
152+
<body>
153+
<div class="center" id="loading">
154+
<div class="sk-chase">
155+
<div class="sk-chase-dot"></div>
156+
<div class="sk-chase-dot"></div>
157+
<div class="sk-chase-dot"></div>
158+
<div class="sk-chase-dot"></div>
159+
<div class="sk-chase-dot"></div>
160+
<div class="sk-chase-dot"></div>
161+
</div>
162+
</div>
163+
<!-- This script installs service_worker.js to provide PWA functionality to
37164
application. For more information, see:
38165
https://developers.google.com/web/fundamentals/primers/service-workers -->
39-
<script>
40-
var serviceWorkerVersion = null;
41-
var scriptLoaded = false;
42-
function loadMainDartJs() {
43-
if (scriptLoaded) {
44-
return;
45-
}
46-
scriptLoaded = true;
47-
var scriptTag = document.createElement('script');
48-
scriptTag.src = 'main.dart.js';
49-
scriptTag.type = 'application/javascript';
50-
document.body.append(scriptTag);
51-
}
52-
53-
if ('serviceWorker' in navigator) {
54-
// Service workers are supported. Use them.
55-
window.addEventListener('load', function () {
56-
// Wait for registration to finish before dropping the <script> tag.
57-
// Otherwise, the browser will load the script multiple times,
58-
// potentially different versions.
59-
var serviceWorkerUrl = 'flutter_service_worker.js?v=' + serviceWorkerVersion;
60-
navigator.serviceWorker.register(serviceWorkerUrl)
61-
.then((reg) => {
166+
<script>
167+
var serviceWorkerVersion = null;
168+
var scriptLoaded = false;
169+
function loadMainDartJs() {
170+
if (scriptLoaded) {
171+
return;
172+
}
173+
scriptLoaded = true;
174+
var scriptTag = document.createElement("script");
175+
scriptTag.src = "main.dart.js";
176+
scriptTag.type = "application/javascript";
177+
document.body.append(scriptTag);
178+
}
179+
180+
if ("serviceWorker" in navigator) {
181+
// Service workers are supported. Use them.
182+
window.addEventListener("load", function () {
183+
// Wait for registration to finish before dropping the <script> tag.
184+
// Otherwise, the browser will load the script multiple times,
185+
// potentially different versions.
186+
var serviceWorkerUrl =
187+
"flutter_service_worker.js?v=" + serviceWorkerVersion;
188+
navigator.serviceWorker.register(serviceWorkerUrl).then((reg) => {
62189
function waitForActivation(serviceWorker) {
63-
serviceWorker.addEventListener('statechange', () => {
64-
if (serviceWorker.state == 'activated') {
65-
console.log('Installed new service worker.');
190+
serviceWorker.addEventListener("statechange", () => {
191+
if (serviceWorker.state == "activated") {
192+
console.log("Installed new service worker.");
66193
loadMainDartJs();
67194
}
68195
});
@@ -74,31 +201,36 @@
74201
} else if (!reg.active.scriptURL.endsWith(serviceWorkerVersion)) {
75202
// When the app updates the serviceWorkerVersion changes, so we
76203
// need to ask the service worker to update.
77-
console.log('New service worker available.');
204+
console.log("New service worker available.");
78205
reg.update();
79206
waitForActivation(reg.installing);
80207
} else {
81208
// Existing service worker is still good.
82-
console.log('Loading app from service worker.');
209+
console.log("Loading app from service worker.");
83210
loadMainDartJs();
84211
}
85212
});
86213

87-
// If service worker doesn't succeed in a reasonable amount of time,
88-
// fallback to plaint <script> tag.
89-
setTimeout(() => {
90-
if (!scriptLoaded) {
91-
console.warn(
92-
'Failed to load app from service worker. Falling back to plain <script> tag.',
93-
);
94-
loadMainDartJs();
95-
}
96-
}, 4000);
214+
// If service worker doesn't succeed in a reasonable amount of time,
215+
// fallback to plaint <script> tag.
216+
setTimeout(() => {
217+
if (!scriptLoaded) {
218+
console.warn(
219+
"Failed to load app from service worker. Falling back to plain <script> tag."
220+
);
221+
loadMainDartJs();
222+
}
223+
}, 4000);
224+
});
225+
} else {
226+
// Service workers not supported. Just drop the <script> tag.
227+
loadMainDartJs();
228+
}
229+
230+
window.addEventListener("flutter-first-frame", function () {
231+
console.log("flutter app loaded.");
232+
document.getElementById("loading").remove();
97233
});
98-
} else {
99-
// Service workers not supported. Just drop the <script> tag.
100-
loadMainDartJs();
101-
}
102-
</script>
103-
</body>
234+
</script>
235+
</body>
104236
</html>

lib/src/tree_node.dart

+3-14
Original file line numberDiff line numberDiff line change
@@ -191,27 +191,16 @@ class _TreeNodeState extends State<TreeNode>
191191
widget.append(widget.data);
192192
widget.onAppend(widget.data, widget.parent);
193193
},
194-
child: Text(
195-
'Add',
196-
style: TextStyle(
197-
fontSize:
198-
Theme.of(context).textTheme.labelSmall?.fontSize,
199-
),
200-
),
194+
child: const Text('Add', style: TextStyle(fontSize: 12.0)),
201195
),
202196
if (widget.showActions)
203197
TextButton(
204198
onPressed: () {
205199
widget.remove(widget.data);
206200
widget.onRemove(widget.data, widget.parent);
207201
},
208-
child: Text(
209-
'Remove',
210-
style: TextStyle(
211-
fontSize:
212-
Theme.of(context).textTheme.labelSmall?.fontSize,
213-
),
214-
),
202+
child:
203+
const Text('Remove', style: TextStyle(fontSize: 12.0)),
215204
),
216205
],
217206
),

pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: flutter_tree
22
description: Flutter tree widget plugin, you can use this plugin to show a tree like layout, some thing a department tree.
3-
version: 2.0.2
3+
version: 2.0.3
44
homepage: https://github.com/xrr2016/flutter_tree
55

66
environment:

0 commit comments

Comments
 (0)