fix: ui cleanup

This commit is contained in:
2025-08-27 21:49:30 +02:00
parent 40e7cc0461
commit 31e1b4f0bb

View File

@@ -272,125 +272,140 @@ class _SimpleSyncSettingsScreenState extends State<SimpleSyncSettingsScreen> {
} }
Widget _buildConfigurationSection(SimpleSyncProvider syncProvider) { Widget _buildConfigurationSection(SimpleSyncProvider syncProvider) {
return Card( return Column(
child: Padding( crossAxisAlignment: CrossAxisAlignment.stretch,
padding: const EdgeInsets.all(16.0), children: [
child: Column( Card(
crossAxisAlignment: CrossAxisAlignment.start, child: Padding(
children: [ padding: const EdgeInsets.all(12.0),
Text( child: Column(
'Sync Configuration', crossAxisAlignment: CrossAxisAlignment.start,
style: Theme.of(context).textTheme.titleLarge, children: [
), Text(
const SizedBox(height: 16), 'Sync Configuration',
_buildAutoSyncSection(), style: Theme.of(context).textTheme.titleLarge,
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),
),
), ),
child: Column( const SizedBox(height: 8),
crossAxisAlignment: CrossAxisAlignment.start, _buildAutoSyncSection(),
children: [ ],
Text( ),
'WebDAV URL Preview:', ),
style: Theme.of(context).textTheme.labelMedium, ),
), const SizedBox(height: 12),
const SizedBox(height: 4), Card(
SelectableText( child: Padding(
_previewUrl, padding: const EdgeInsets.all(12.0),
style: Theme.of(context).textTheme.bodySmall?.copyWith( child: Column(
fontFamily: 'monospace', crossAxisAlignment: CrossAxisAlignment.start,
color: Theme.of(context).colorScheme.primary, 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), child: Column(
Row( crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: [ children: [
ElevatedButton.icon( Text(
onPressed: syncProvider.isSyncing ? null : _testConnection, 'WebDAV URL Preview:',
icon: const Icon(Icons.link), style: Theme.of(context).textTheme.labelMedium,
label: const Text('Test'), ),
style: ElevatedButton.styleFrom( const SizedBox(height: 4),
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)), SelectableText(
elevation: 0, _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: 8),
], TextFormField(
const SizedBox(height: 16), controller: _remotePathController,
TextFormField( decoration: const InputDecoration(
controller: _passwordController, labelText: 'Remote Path (optional)',
decoration: const InputDecoration( hintText: 'Supplements/',
labelText: 'Password', border: OutlineInputBorder(),
border: OutlineInputBorder(), ),
), ),
obscureText: true, ],
validator: (value) {
if (value == null || value.isEmpty) {
return 'Please enter a password';
}
return null;
},
), ),
const SizedBox(height: 16), ),
TextFormField(
controller: _remotePathController,
decoration: const InputDecoration(
labelText: 'Remote Path (optional)',
hintText: 'Supplements/',
border: OutlineInputBorder(),
),
),
],
), ),
), ],
); );
} }