platform/packages/jael/jael_web/example/main.dart

32 lines
585 B
Dart
Raw Normal View History

2021-12-19 16:22:12 +00:00
import 'package:jael3_web/jael3_web.dart';
import 'package:jael3_web/elements.dart';
2019-03-23 18:49:37 +00:00
part 'main.g.dart';
2019-03-23 14:07:40 +00:00
2019-03-23 18:50:01 +00:00
@Jael(template: '''
2019-03-23 18:49:37 +00:00
<div>
<h1>Hello, Jael!</h1>
2019-03-23 18:50:01 +00:00
<i>Current time: {{now}}</i>
2019-03-23 18:49:37 +00:00
</div>
''')
class Hello extends Component with _HelloJaelTemplate {
2021-12-19 16:22:12 +00:00
@override
2019-03-23 18:49:37 +00:00
DateTime get now => DateTime.now();
}
// Could also have been:
class Hello2 extends Component {
DateTime get now => DateTime.now();
@override
DomNode render() {
return div(c: [
h1(c: [
text('Hello, Jael!'),
]),
i(c: [
text('Current time: $now'),
]),
]);
}
}