diff --git a/lib/screens/SiteLogsScreen.dart b/lib/screens/SiteLogsScreen.dart index 4b0b216..78c75a0 100644 --- a/lib/screens/SiteLogsScreen.dart +++ b/lib/screens/SiteLogsScreen.dart @@ -45,6 +45,7 @@ class _SiteLogsScreenState extends State { return SimplePage( title: title, + trailingActions: [Padding(padding: const EdgeInsets.only(right: 8), child: _buildTextWrapToggle())], scrollable: SimpleScrollable.both, scrollController: controller, onRefresh: () async { @@ -64,6 +65,37 @@ class _SiteLogsScreenState extends State { ); } + Widget _buildTextWrapToggle() { + return Platform.isIOS + ? Tooltip( + message: "Turn ${settings.logWrap ? "off" : "on"} text wrapping", + child: CupertinoButton.tinted( + // Use the default tint when enabled, match the background when not. + color: settings.logWrap ? null : CupertinoColors.systemBackground, + sizeStyle: CupertinoButtonSize.small, + borderRadius: const BorderRadius.all(Radius.circular(8)), + child: const Icon(Icons.wrap_text), + onPressed: () => { + setState(() { + settings.logWrap = !settings.logWrap; + }) + }, + ), + ) + : IconButton.filledTonal( + isSelected: settings.logWrap, + tooltip: "Turn ${settings.logWrap ? "off" : "on"} text wrapping", + // The variants of wrap_text seem to be the same, but this seems most correct. + selectedIcon: const Icon(Icons.wrap_text_outlined), + icon: const Icon(Icons.wrap_text), + onPressed: () => { + setState(() { + settings.logWrap = !settings.logWrap; + }) + }, + ); + } + Widget _buildBottomBar() { var borderSide = BorderSide( color: CupertinoColors.separator,