Skip to content

Commit

Permalink
Create EXAMPLE.md
Browse files Browse the repository at this point in the history
  • Loading branch information
chulwoo-park committed Nov 23, 2020
1 parent ce5c778 commit ade052d
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions example/EXAMPLE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<!-- TODO: sync with readme.md example section -->
This example shows a simple timeline that has text contents alternating:

![timeline_status](https://raw.github.com/chulwoo-park/timelines/release/0.1.0/screenshots/example.png)


``` dart
import 'package:flutter/material.dart';
import 'package:timelines/timelines.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Timelines Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Timelines Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Timeline.tileBuilder(
builder: TimelineTileBuilder.fromStyle(
contentsAlign: ContentsAlign.alternating,
contentsBuilder: (context, index) => Padding(
padding: const EdgeInsets.all(24.0),
child: Text('Timeline Event $index'),
),
itemCount: 10,
),
),
);
}
}
```
Binary file added screenshots/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ade052d

Please sign in to comment.