Skip to content

Commit 27e5ab2

Browse files
committed
added shout example
1 parent 46867a7 commit 27e5ab2

File tree

5 files changed

+82
-0
lines changed

5 files changed

+82
-0
lines changed

web/target06/shout/build.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import 'package:web_ui/component_build.dart';
2+
import 'dart:io';
3+
4+
void main() {
5+
build (new Options().arguments, ['web/shout.html']);
6+
}

web/target06/shout/pubspec.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
name: Shout
2+
description: Shout! Shout! Let it all out!
3+
4+
dependencies:
5+
web_ui: any

web/target06/shout/web/shout.css

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
2+
body {
3+
background-color: #F8F8F8;
4+
font-family: 'Open Sans', sans-serif;
5+
font-size: 14px;
6+
font-weight: normal;
7+
line-height: 1.5em;
8+
margin: 15px;
9+
}
10+
11+
p {
12+
color: #333;
13+
}
14+
15+
input {
16+
padding: 5px;
17+
margin: 20px 0px 20px 0px;
18+
}
19+
20+
#container {
21+
width: 100%;
22+
height: 400px;
23+
position: relative;
24+
border: 1px solid #ccc;
25+
background-color: #fff;
26+
}
27+
28+
#text {
29+
font-size: 24pt;
30+
text-align: center;
31+
margin-top: 140px;
32+
}

web/target06/shout/web/shout.dart

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import 'package:web_ui/watcher.dart' as watchers;
2+
String shoutThis='';
3+
4+
void main() {
5+
}
6+
7+
String palindrome() {
8+
var buffer = new StringBuffer(shoutThis);
9+
for (int i = shoutThis.length - 1; i >= 0; i--) {
10+
buffer.add(shoutThis[i]);
11+
}
12+
shoutThis = buffer.toString();
13+
return buffer.toString();
14+
}

web/target06/shout/web/shout.html

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<!DOCTYPE html>
2+
3+
<html>
4+
<head>
5+
<meta charset="utf-8">
6+
<title>Shout This!</title>
7+
<link rel="stylesheet" href="shout.css">
8+
</head>
9+
<body>
10+
<h1>Shout This!</h1>
11+
12+
<input type="text" bind-value="shoutThis" placeholder="Shout This!">
13+
14+
<div> Length: {{ shoutThis.length }} </div>
15+
<div> Shouted: {{ shoutThis.toUpperCase() }} </div>
16+
<div> Substring: {{ (shoutThis.length >= 6) ?
17+
shoutThis.substring(1, 5) :
18+
shoutThis.substring(0, 0) }} </div>
19+
<div> Palindromic: {{ palindrome() }} </div>
20+
<div> Palindromic: {{ [1,2,3,4].reduce(0, (a, b) => a + b) }} </div>
21+
22+
<script type="application/dart" src="shout.dart"></script>
23+
<script type="text/javascript" src="https://dart.googlecode.com/svn/branches/bleeding_edge/dart/client/dart.js"></script>
24+
</body>
25+
</html>

0 commit comments

Comments
 (0)