Improve error messages for impossible actions during paint mode
This commit is contained in:
@@ -92,6 +92,10 @@ class _SheetViewerPageState extends State<SheetViewerPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _toggleFullscreen() {
|
void _toggleFullscreen() {
|
||||||
|
if (_isPaintMode) {
|
||||||
|
_showSnackBar('Cannot enter fullscreen while in paint mode');
|
||||||
|
return;
|
||||||
|
}
|
||||||
FullScreen.setFullScreen(!widget.config.fullscreen);
|
FullScreen.setFullScreen(!widget.config.fullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,13 +115,7 @@ class _SheetViewerPageState extends State<SheetViewerPage>
|
|||||||
|
|
||||||
void _togglePaintMode() {
|
void _togglePaintMode() {
|
||||||
if (widget.config.twoPageMode) {
|
if (widget.config.twoPageMode) {
|
||||||
// Paint mode only works in single page mode
|
_showSnackBar('Paint mode is only available in single page mode');
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
const SnackBar(
|
|
||||||
content: Text('Paint mode is only available in single page mode'),
|
|
||||||
duration: Duration(seconds: 2),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,19 +123,14 @@ class _SheetViewerPageState extends State<SheetViewerPage>
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _toggleTwoPageMode() {
|
void _toggleTwoPageMode() {
|
||||||
|
if (_isPaintMode) {
|
||||||
|
_showSnackBar('Cannot enter two-page mode while painting');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
widget.config.twoPageMode = !widget.config.twoPageMode;
|
widget.config.twoPageMode = !widget.config.twoPageMode;
|
||||||
_storageService.writeConfig(widget.config);
|
_storageService.writeConfig(widget.config);
|
||||||
|
|
||||||
if (widget.config.twoPageMode && _isPaintMode) {
|
|
||||||
_isPaintMode = false;
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
const SnackBar(
|
|
||||||
content: Text('Paint mode disabled in two-page mode'),
|
|
||||||
duration: Duration(seconds: 2),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -252,4 +245,10 @@ class _SheetViewerPageState extends State<SheetViewerPage>
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void _showSnackBar(String message) {
|
||||||
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
|
SnackBar(content: Text(message), duration: Duration(seconds: 2)),
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user