提交 f1271eae authored 作者: yueweilu's avatar yueweilu

1、我的笔记才能删除

2、音频校验空数据 3、解析数据判空
上级 1921b708
...@@ -366,7 +366,9 @@ class NoteModel { ...@@ -366,7 +366,9 @@ class NoteModel {
content = json['content']; content = json['content'];
positioning = json['positioning']; positioning = json['positioning'];
// noteContent = json['note_content']; // noteContent = json['note_content'];
noteContent = json['note_content'] != null ? NoteContentModel.fromJson(json['note_content']) : null; if (types ==3){
noteContent = json['note_content'] != null ? NoteContentModel.fromJson(json['note_content']) : null;
}
color = json['color']; color = json['color'];
chapterName = json['chapter_name']; chapterName = json['chapter_name'];
isMy = json['is_my']; isMy = json['is_my'];
......
...@@ -103,11 +103,13 @@ class NoteController extends GetxController { ...@@ -103,11 +103,13 @@ class NoteController extends GetxController {
); );
for(NoteModel noteModel in result){ for(NoteModel noteModel in result){
if(noteModel.noteContent!.audio!.isNotEmpty){ if(noteModel.noteContent!=null && noteModel.noteContent!.audio != null){
for(MediaModel mediaModel in noteModel.noteContent!.audio!){ if(noteModel.noteContent!.audio!.isNotEmpty){
Duration? duration = await just_audio.AudioPlayer().setUrl(mediaModel.content??''); for(MediaModel? mediaModel in noteModel.noteContent!.audio!){
Duration? duration = await just_audio.AudioPlayer().setUrl(mediaModel?.content??'');
mediaModel.duration = Tools.formatDuration(duration!); mediaModel?.duration = Tools.formatDuration(duration!);
}
} }
} }
} }
...@@ -127,6 +129,7 @@ class NoteController extends GetxController { ...@@ -127,6 +129,7 @@ class NoteController extends GetxController {
refreshController.resetFooter(); refreshController.resetFooter();
} catch (error) { } catch (error) {
refreshController.finishRefresh(IndicatorResult.fail); refreshController.finishRefresh(IndicatorResult.fail);
Console.log('error-----------------------$error');
} }
} }
...@@ -139,6 +142,7 @@ class NoteController extends GetxController { ...@@ -139,6 +142,7 @@ class NoteController extends GetxController {
await _getNotes(); await _getNotes();
refreshController.finishLoad(); refreshController.finishLoad();
} catch (error) { } catch (error) {
Console.log('error-----------------------$error');
refreshController.finishLoad(IndicatorResult.fail); refreshController.finishLoad(IndicatorResult.fail);
} }
} }
......
...@@ -77,11 +77,13 @@ class UserNotesDesController extends GetxController { ...@@ -77,11 +77,13 @@ class UserNotesDesController extends GetxController {
types: tag types: tag
); );
for(NoteModel noteModel in result){ for(NoteModel noteModel in result){
if(noteModel.noteContent!.audio!.isNotEmpty){ if(noteModel.noteContent!=null && noteModel.noteContent!.audio != null){
for(MediaModel mediaModel in noteModel.noteContent!.audio!){ if(noteModel.noteContent!.audio!.isNotEmpty){
Duration? duration = await just_audio.AudioPlayer().setUrl(mediaModel.content??''); for(MediaModel? mediaModel in noteModel.noteContent!.audio!){
Duration? duration = await just_audio.AudioPlayer().setUrl(mediaModel?.content??'');
mediaModel.duration = Tools.formatDuration(duration!); mediaModel?.duration = Tools.formatDuration(duration!);
}
} }
} }
} }
......
...@@ -26,6 +26,7 @@ class BuildHigh extends StatelessWidget { ...@@ -26,6 +26,7 @@ class BuildHigh extends StatelessWidget {
], ],
), ),
child: Slidable( child: Slidable(
enabled: model.isMy == 1 ? true : false,
endActionPane: ActionPane( endActionPane: ActionPane(
motion: const ScrollMotion(), motion: const ScrollMotion(),
children: [ children: [
......
...@@ -26,6 +26,7 @@ class BuildLine extends StatelessWidget { ...@@ -26,6 +26,7 @@ class BuildLine extends StatelessWidget {
], ],
), ),
child: Slidable( child: Slidable(
enabled: model.isMy == 1 ? true : false,
endActionPane: ActionPane( endActionPane: ActionPane(
motion: const ScrollMotion(), motion: const ScrollMotion(),
children: [ children: [
......
...@@ -31,6 +31,7 @@ class BuildNote extends StatelessWidget { ...@@ -31,6 +31,7 @@ class BuildNote extends StatelessWidget {
], ],
), ),
child: Slidable( child: Slidable(
enabled: model.isMy == 1 ? true : false,
endActionPane: ActionPane( endActionPane: ActionPane(
motion: const ScrollMotion(), motion: const ScrollMotion(),
children: [ children: [
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论