-
-
Notifications
You must be signed in to change notification settings - Fork 49
/
Copy pathmain.dart
104 lines (94 loc) · 2.64 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import 'package:example/screen/cms_comments_demo.dart';
import 'package:example/screen/github_activity_demo.dart';
import 'package:example/screen/plain_timeline_demo.dart';
import 'package:flutter/material.dart';
void main() {
runApp(TimelineDemoApp());
}
class TimelineDemoApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Timeline',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
routes: {
PlainTimelineDemoScreen.routeName: (c) => PlainTimelineDemoScreen(),
DeskTimelineDemoScreen.routeName: (c) => DeskTimelineDemoScreen(),
GithubActivityDemo.routeName: (c) => GithubActivityDemo(),
},
home: DemoHomePage(title: 'Flutter Timeline Demo'),
);
}
}
List<DemoScreen> demos = [
DemoScreen(
name: "plain timeline",
description: "simplest timeline demo",
cover: null,
route: PlainTimelineDemoScreen.routeName),
DemoScreen(
name: "github activity",
description: "github's activity timeline demo",
cover: null,
route: GithubActivityDemo.routeName),
DemoScreen(
name: "genoplan desk",
description: "genoplan's desk crm app timeline demo",
cover: null,
route: DeskTimelineDemoScreen.routeName),
DemoScreen(
name: "shopify",
description: "timeline demo from shopify admin",
cover: null,
route: PlainTimelineDemoScreen.routeName),
];
class DemoHomePage extends StatefulWidget {
DemoHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
_DemoHomePageState createState() => _DemoHomePageState();
}
class _DemoHomePageState extends State<DemoHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: _buildBody(),
);
}
Widget _buildDemoEntries() {
return ListView.builder(
itemBuilder: (c, i) {
var data = demos[i];
return ListTile(
title: Text(data.name),
subtitle: Text(data.description),
onTap: () {
Navigator.of(context).pushNamed(data.route);
},
);
},
itemCount: demos.length,
);
}
Widget _buildBody() {
return _buildDemoEntries();
}
}
class DemoScreen {
DemoScreen(
{required this.name,
required this.description,
this.cover,
required this.route});
final String name;
final String description;
final String? cover;
final String route;
}