From 31e1b4f0bb5d3a86b85ebb819ca1ae4412795a24 Mon Sep 17 00:00:00 2001 From: Menno van Leeuwen Date: Wed, 27 Aug 2025 21:49:30 +0200 Subject: [PATCH] fix: ui cleanup --- lib/screens/simple_sync_settings_screen.dart | 231 ++++++++++--------- 1 file changed, 123 insertions(+), 108 deletions(-) diff --git a/lib/screens/simple_sync_settings_screen.dart b/lib/screens/simple_sync_settings_screen.dart index d9e0a5b..6667634 100644 --- a/lib/screens/simple_sync_settings_screen.dart +++ b/lib/screens/simple_sync_settings_screen.dart @@ -272,125 +272,140 @@ class _SimpleSyncSettingsScreenState extends State { } Widget _buildConfigurationSection(SimpleSyncProvider syncProvider) { - return Card( - child: Padding( - padding: const EdgeInsets.all(16.0), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Sync Configuration', - style: Theme.of(context).textTheme.titleLarge, - ), - const SizedBox(height: 16), - _buildAutoSyncSection(), - const SizedBox(height: 24), - Text( - 'WebDAV Settings', - style: Theme.of(context).textTheme.titleMedium, - ), - const SizedBox(height: 16), - TextFormField( - controller: _serverUrlController, - decoration: const InputDecoration( - labelText: 'Server URL', - hintText: 'your-nextcloud.com', - helperText: 'Enter just the hostname. We\'ll auto-detect the full WebDAV path.', - border: OutlineInputBorder(), - ), - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter a server URL'; - } - return null; - }, - ), - const SizedBox(height: 16), - TextFormField( - controller: _usernameController, - decoration: const InputDecoration( - labelText: 'Username', - border: OutlineInputBorder(), - ), - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter a username'; - } - return null; - }, - ), - if (_previewUrl.isNotEmpty) ...[ - const SizedBox(height: 8), - Container( - padding: const EdgeInsets.all(12), - decoration: BoxDecoration( - color: Theme.of(context).colorScheme.surfaceContainerHighest.withValues(alpha: 0.3), - borderRadius: BorderRadius.circular(8), - border: Border.all( - color: Theme.of(context).colorScheme.outline.withValues(alpha: 0.5), - ), + return Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Card( + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'Sync Configuration', + style: Theme.of(context).textTheme.titleLarge, ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'WebDAV URL Preview:', - style: Theme.of(context).textTheme.labelMedium, - ), - const SizedBox(height: 4), - SelectableText( - _previewUrl, - style: Theme.of(context).textTheme.bodySmall?.copyWith( - fontFamily: 'monospace', - color: Theme.of(context).colorScheme.primary, + const SizedBox(height: 8), + _buildAutoSyncSection(), + ], + ), + ), + ), + const SizedBox(height: 12), + Card( + child: Padding( + padding: const EdgeInsets.all(12.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + 'WebDAV Settings', + style: Theme.of(context).textTheme.titleMedium, + ), + const SizedBox(height: 8), + TextFormField( + controller: _serverUrlController, + decoration: const InputDecoration( + labelText: 'Server URL', + hintText: 'your-nextcloud.com', + helperText: 'Enter just the hostname. We\'ll auto-detect the full WebDAV path.', + border: OutlineInputBorder(), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter a server URL'; + } + return null; + }, + ), + const SizedBox(height: 8), + TextFormField( + controller: _usernameController, + decoration: const InputDecoration( + labelText: 'Username', + border: OutlineInputBorder(), + ), + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter a username'; + } + return null; + }, + ), + if (_previewUrl.isNotEmpty) ...[ + const SizedBox(height: 6), + Container( + padding: const EdgeInsets.all(8), + decoration: BoxDecoration( + color: Theme.of(context).colorScheme.surfaceContainerHighest.withValues(alpha: 0.3), + borderRadius: BorderRadius.circular(8), + border: Border.all( + color: Theme.of(context).colorScheme.outline.withValues(alpha: 0.5), ), ), - const SizedBox(height: 8), - Row( - mainAxisAlignment: MainAxisAlignment.end, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ - ElevatedButton.icon( - onPressed: syncProvider.isSyncing ? null : _testConnection, - icon: const Icon(Icons.link), - label: const Text('Test'), - style: ElevatedButton.styleFrom( - shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), - elevation: 0, + Text( + 'WebDAV URL Preview:', + style: Theme.of(context).textTheme.labelMedium, + ), + const SizedBox(height: 4), + SelectableText( + _previewUrl, + style: Theme.of(context).textTheme.bodySmall?.copyWith( + fontFamily: 'monospace', + color: Theme.of(context).colorScheme.primary, ), ), + const SizedBox(height: 6), + Row( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + ElevatedButton.icon( + onPressed: syncProvider.isSyncing ? null : _testConnection, + icon: const Icon(Icons.link), + label: const Text('Test'), + style: ElevatedButton.styleFrom( + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), + elevation: 0, + ), + ), + ], + ), ], ), - ], + ), + ], + const SizedBox(height: 8), + TextFormField( + controller: _passwordController, + decoration: const InputDecoration( + labelText: 'Password', + border: OutlineInputBorder(), + ), + obscureText: true, + validator: (value) { + if (value == null || value.isEmpty) { + return 'Please enter a password'; + } + return null; + }, ), - ), - ], - const SizedBox(height: 16), - TextFormField( - controller: _passwordController, - decoration: const InputDecoration( - labelText: 'Password', - border: OutlineInputBorder(), - ), - obscureText: true, - validator: (value) { - if (value == null || value.isEmpty) { - return 'Please enter a password'; - } - return null; - }, + const SizedBox(height: 8), + TextFormField( + controller: _remotePathController, + decoration: const InputDecoration( + labelText: 'Remote Path (optional)', + hintText: 'Supplements/', + border: OutlineInputBorder(), + ), + ), + ], ), - const SizedBox(height: 16), - TextFormField( - controller: _remotePathController, - decoration: const InputDecoration( - labelText: 'Remote Path (optional)', - hintText: 'Supplements/', - border: OutlineInputBorder(), - ), - ), - ], + ), ), - ), + ], ); }