diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 8450d13..e70cc9a 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -109,4 +109,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: e8d4fb1ed5b0713de2623a28dfae2585e15c0d00 -COCOAPODS: 1.9.0 +COCOAPODS: 1.10.0 diff --git a/lib/screens/SettingsScreen.dart b/lib/screens/SettingsScreen.dart index 75e6985..956bd25 100644 --- a/lib/screens/SettingsScreen.dart +++ b/lib/screens/SettingsScreen.dart @@ -66,7 +66,27 @@ class _SettingsScreenState extends State { List items = []; items.add(ConfigSection(children: colorSection)); - items.add(ConfigSection(children: [ConfigPageItem(label: Text('About'), onPressed: () => Utils.openPage(context, (context) => AboutScreen()),)])); + items.add(ConfigItem( + label: Text('Wrap log output'), + labelWidth: 200, + content: Align( + alignment: Alignment.centerRight, + child: Switch.adaptive( + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + value: settings.logWrap, + onChanged: (value) { + setState(() { + settings.logWrap = value; + }); + }, + )), + )); + items.add(ConfigSection(children: [ + ConfigPageItem( + label: Text('About'), + onPressed: () => Utils.openPage(context, (context) => AboutScreen()), + ) + ])); return SimplePage( title: 'Settings', diff --git a/lib/screens/SiteLogsScreen.dart b/lib/screens/SiteLogsScreen.dart index b40774b..d6e26e5 100644 --- a/lib/screens/SiteLogsScreen.dart +++ b/lib/screens/SiteLogsScreen.dart @@ -7,6 +7,7 @@ import 'package:flutter_platform_widgets/flutter_platform_widgets.dart'; import 'package:mobile_nebula/components/SimplePage.dart'; import 'package:mobile_nebula/components/SpecialSelectableText.dart'; import 'package:mobile_nebula/models/Site.dart'; +import 'package:mobile_nebula/services/settings.dart'; import 'package:mobile_nebula/services/share.dart'; import 'package:mobile_nebula/services/utils.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart'; @@ -25,6 +26,7 @@ class _SiteLogsScreenState extends State { ScrollController controller = ScrollController(); RefreshController refreshController = RefreshController(initialRefresh: false); + var settings = Settings(); @override void initState() { loadLogs(); @@ -52,10 +54,7 @@ class _SiteLogsScreenState extends State { refreshController.loadComplete(); }, refreshController: refreshController, - child: Container( - padding: EdgeInsets.all(5), - constraints: BoxConstraints(minWidth: MediaQuery.of(context).size.width), - child: SpecialSelectableText(logs.trim(), style: TextStyle(fontFamily: 'RobotoMono', fontSize: 14))), + child: Container(padding: EdgeInsets.all(5), constraints: logBoxConstraints(context), child: SpecialSelectableText(logs.trim(), style: TextStyle(fontFamily: 'RobotoMono', fontSize: 14))), bottomBar: _buildBottomBar(), ); } @@ -95,8 +94,7 @@ class _SiteLogsScreenState extends State { padding: padding, icon: Icon(context.platformIcons.downArrow, size: 30), onPressed: () async { - controller.animateTo(controller.position.maxScrollExtent, - duration: const Duration(milliseconds: 500), curve: Curves.linearToEaseOut); + controller.animateTo(controller.position.maxScrollExtent, duration: const Duration(milliseconds: 500), curve: Curves.linearToEaseOut); }, )), ])); @@ -120,4 +118,12 @@ class _SiteLogsScreenState extends State { await file.writeAsBytes([]); await loadLogs(); } + + logBoxConstraints(BuildContext context) { + if (settings.logWrap) { + return BoxConstraints(maxWidth: MediaQuery.of(context).size.width); + } else { + return BoxConstraints(minWidth: MediaQuery.of(context).size.width); + } + } } diff --git a/lib/services/settings.dart b/lib/services/settings.dart index 2ee09f7..e8a9d01 100644 --- a/lib/services/settings.dart +++ b/lib/services/settings.dart @@ -30,6 +30,14 @@ class Settings { _set('darkMode', enabled); } + bool get logWrap { + return _getBool('logWrap', false); + } + + set logWrap(bool enabled) { + _set('logWrap', enabled); + } + String _getString(String key, String defaultValue) { final val = _settings[key]; if (val is String) {