-
Notifications
You must be signed in to change notification settings - Fork 3
/
basic_example_page.dart
73 lines (69 loc) · 3.19 KB
/
basic_example_page.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
import 'package:flutter/material.dart';
import 'package:scrollable_timeline/scrollable_timeline.dart';
import '../tickers/broadcast_ticker.dart';
class BasicExamplePage extends StatefulWidget {
@override
_BasicExamplePageState createState() => _BasicExamplePageState();
}
class _BasicExamplePageState extends State<BasicExamplePage> {
double? selectedTimeFromTopLine;
double? selectedTimeFromBottomline;
final broadcastticker = BroadcastTicker(0.0, 100.0);
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: ScrollableTimelineSharedDragging(
child: SingleChildScrollView(
padding: EdgeInsets.all(10),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ScrollableTimeline(
lengthSecs: 100,
stepSecs: 10,
height: 120,
rulerOutsidePadding: 10,
timeStream: broadcastticker.stream, //ticker.tick(ticks: 1000
showCursor: true,
backgroundColor: Colors.lightBlue.shade50,
activeItemTextColor: Colors.blue.shade800,
itemTextColor: Colors.blue.shade300,
onDragEnd: (double t) {
print(
"*FLT* drag detected for ScrollableTimelineF to target time $t");
broadcastticker.curt = t.roundToDouble();
setState(() {
selectedTimeFromTopLine = t;
});
}),
Text(selectedTimeFromTopLine.toString()),
Divider(),
ScrollableTimeline(
lengthSecs: 100,
stepSecs: 2,
height: 120,
rulerOutsidePadding: 10,
timeStream: broadcastticker.stream, ////ticker2.tick(ticks: 1000
showCursor: true,
showMinutes: false,
backgroundColor: Colors.lightBlue.shade50,
activeItemTextColor: Colors.blue.shade800,
itemTextColor: Colors.blue.shade300,
onDragEnd: (double t) {
print(
"*FLT* drag detected for ScrollableTimelineF to target time $t");
broadcastticker.curt = t.roundToDouble();
setState(() {
selectedTimeFromBottomline = t;
});
}),
Text(selectedTimeFromBottomline.toString()),
]
)
)
)
)
);
}
}