forked from chulwoo-park/timelines
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ce5c778
commit ade052d
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
), | ||
), | ||
); | ||
} | ||
} | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.