mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-06-29 18:38:36 +08:00
Do not show Tag Editing screen if the Note cannot have metadata
In the case of '.txt' notes or markdown notes without a yaml header.
This commit is contained in:
@ -103,6 +103,7 @@ class EditorBottomBar extends StatelessWidget {
|
|||||||
final bool allowEdits;
|
final bool allowEdits;
|
||||||
final bool zenMode;
|
final bool zenMode;
|
||||||
final Func0<void> onZenModeChanged;
|
final Func0<void> onZenModeChanged;
|
||||||
|
final bool metaDataEditable;
|
||||||
|
|
||||||
EditorBottomBar({
|
EditorBottomBar({
|
||||||
@required this.editor,
|
@required this.editor,
|
||||||
@ -111,6 +112,7 @@ class EditorBottomBar extends StatelessWidget {
|
|||||||
@required this.allowEdits,
|
@required this.allowEdits,
|
||||||
@required this.zenMode,
|
@required this.zenMode,
|
||||||
@required this.onZenModeChanged,
|
@required this.onZenModeChanged,
|
||||||
|
@required this.metaDataEditable,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -137,6 +139,7 @@ class EditorBottomBar extends StatelessWidget {
|
|||||||
editorState,
|
editorState,
|
||||||
zenMode,
|
zenMode,
|
||||||
onZenModeChanged,
|
onZenModeChanged,
|
||||||
|
metaDataEditable,
|
||||||
),
|
),
|
||||||
elevation: 0,
|
elevation: 0,
|
||||||
);
|
);
|
||||||
@ -236,6 +239,7 @@ Widget _buildBottomMenuSheet(
|
|||||||
EditorState editorState,
|
EditorState editorState,
|
||||||
bool zenModeEnabled,
|
bool zenModeEnabled,
|
||||||
Func0<void> zenModeChanged,
|
Func0<void> zenModeChanged,
|
||||||
|
bool metaDataEditable,
|
||||||
) {
|
) {
|
||||||
return Container(
|
return Container(
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -262,19 +266,20 @@ Widget _buildBottomMenuSheet(
|
|||||||
Share.share(note.body);
|
Share.share(note.body);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ProOverlay(
|
if (metaDataEditable)
|
||||||
feature: Feature.tags,
|
ProOverlay(
|
||||||
child: ListTile(
|
feature: Feature.tags,
|
||||||
leading: const FaIcon(FontAwesomeIcons.tag),
|
child: ListTile(
|
||||||
title: Text(tr('editors.common.tags')),
|
leading: const FaIcon(FontAwesomeIcons.tag),
|
||||||
onTap: () {
|
title: Text(tr('editors.common.tags')),
|
||||||
var note = editorState.getNote();
|
onTap: () {
|
||||||
Navigator.of(context).pop();
|
var note = editorState.getNote();
|
||||||
|
Navigator.of(context).pop();
|
||||||
|
|
||||||
editor.editTagsSelected(note);
|
editor.editTagsSelected(note);
|
||||||
},
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.edit),
|
leading: const Icon(Icons.edit),
|
||||||
title: Text(tr('editors.common.editFileName')),
|
title: Text(tr('editors.common.editFileName')),
|
||||||
|
@ -57,9 +57,7 @@ class _EditorScaffoldState extends State<EditorScaffold> {
|
|||||||
editingMode = true;
|
editingMode = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (editingMode == false) {
|
note = widget.editorState.getNote();
|
||||||
note = widget.editorState.getNote();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -149,6 +147,7 @@ class _EditorScaffoldState extends State<EditorScaffold> {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
metaDataEditable: note.canHaveMetadata,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user