-
Notifications
You must be signed in to change notification settings - Fork 12
/
recording_row.dart
51 lines (48 loc) · 1.42 KB
/
recording_row.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
import 'package:flutter/material.dart';
import 'package:iamrick/utilities/constants.dart';
import 'package:timeago/timeago.dart' as timeago;
class RecordingRow extends StatelessWidget {
final String filename;
final String currentlyPlayingFilename;
final Function onTap;
RecordingRow({
@required this.filename,
@required this.currentlyPlayingFilename,
@required this.onTap,
});
@override
Widget build(BuildContext context) {
return GestureDetector(
child: Container(
color: currentlyPlayingFilename == filename
? kColourPrimary
: kColourBackground,
padding: EdgeInsets.all(16.0),
child: Row(
children: <Widget>[
Icon(
currentlyPlayingFilename == filename
? Icons.pause_circle_filled
: Icons.play_circle_filled,
size: 36.0,
color: currentlyPlayingFilename == filename
? Colors.white
: kColourPrimary,
),
SizedBox(width: 16.0),
Text(
timeago.format(
DateTime.parse(filename.split('_').last.substring(0, 25))),
style: currentlyPlayingFilename == filename
? kTextStyleRecordingPlaying
: kTextStyleRecording,
),
],
),
),
onTap: () {
onTap(filename);
},
);
}
}