-
Notifications
You must be signed in to change notification settings - Fork 1
/
audio_tab.dart
66 lines (62 loc) · 2.13 KB
/
audio_tab.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
import 'package:flutter/material.dart';
import 'package:start_note/data/entities/note_entity.dart';
import 'package:start_note/data/models/note_audio.dart';
import '../../services/date_service.dart';
import '../../widget/common/audio_text_widget.dart';
class AudioTab extends StatefulWidget {
const AudioTab(
{Key? key,
required this.noteEntity,
required this.focusNode,
required this.noteController,
required this.onChanged})
: super(key: key);
final NoteEntity noteEntity;
final FocusNode focusNode;
final TextEditingController noteController;
final Function(int) onChanged;
@override
State<AudioTab> createState() => _AudioTabState();
}
class _AudioTabState extends State<AudioTab> {
List<NoteAudio> get noteAudios => widget.noteEntity.noteAudios;
List<AudioTextWidget> get _audioTextWidgets =>
noteAudios.map((e) => AudioTextWidget(noteAudio: e)).toList();
List<AudioTextWidget> get audioTextWidgets =>
_audioTextWidgets.isEmpty ? [AudioTextWidget()] : _audioTextWidgets;
@override
Widget build(BuildContext context) {
return ListView(
children: [
...audioTextWidgets,
Row(
children: [
Padding(
padding: const EdgeInsets.only(bottom: 8.0, left: 8),
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
"Created on: ",
style: TextStyle(fontSize: 14, color: Colors.black87),
),
Text(
DateService.dateTimeToWeekDay(
widget.noteEntity.createDate) +
", " +
DateService.dateTimeToString(
widget.noteEntity.createDate),
style: TextStyle(fontSize: 14, color: Colors.black87),
),
],
),
),
),
],
),
],
);
}
}