✨ Site mode
This commit is contained in:
@@ -23,6 +23,7 @@ class SiteForm extends HookConsumerWidget {
|
||||
final slugController = useTextEditingController();
|
||||
final nameController = useTextEditingController();
|
||||
final descriptionController = useTextEditingController();
|
||||
final modeController = useState<int>(0); // Default to fully managed (0)
|
||||
final isLoading = useState(false);
|
||||
|
||||
final saveSite = useCallback(() async {
|
||||
@@ -36,6 +37,7 @@ class SiteForm extends HookConsumerWidget {
|
||||
final payload = <String, dynamic>{
|
||||
'slug': slugController.text,
|
||||
'name': nameController.text,
|
||||
'mode': modeController.value,
|
||||
if (descriptionController.text.isNotEmpty)
|
||||
'description': descriptionController.text,
|
||||
};
|
||||
@@ -106,6 +108,7 @@ class SiteForm extends HookConsumerWidget {
|
||||
slugController.text = fetchedSite.slug;
|
||||
nameController.text = fetchedSite.name;
|
||||
descriptionController.text = fetchedSite.description ?? '';
|
||||
modeController.value = fetchedSite.mode ?? 0;
|
||||
}
|
||||
} catch (e) {
|
||||
errorMessage.value = e.toString();
|
||||
@@ -144,6 +147,7 @@ class SiteForm extends HookConsumerWidget {
|
||||
slugController.text = fetchedSite.slug;
|
||||
nameController.text = fetchedSite.name;
|
||||
descriptionController.text = fetchedSite.description ?? '';
|
||||
modeController.value = fetchedSite.mode ?? 0;
|
||||
} catch (e) {
|
||||
errorMessage.value = e.toString();
|
||||
} finally {
|
||||
@@ -213,6 +217,25 @@ class SiteForm extends HookConsumerWidget {
|
||||
onTapOutside: (_) => FocusManager.instance.primaryFocus?.unfocus(),
|
||||
maxLines: 3,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
DropdownButtonFormField<int>(
|
||||
value: modeController.value,
|
||||
decoration: const InputDecoration(
|
||||
labelText: 'Mode',
|
||||
border: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(12)),
|
||||
),
|
||||
),
|
||||
items: const [
|
||||
DropdownMenuItem(value: 0, child: Text('Fully Managed')),
|
||||
DropdownMenuItem(value: 1, child: Text('Self-Managed')),
|
||||
],
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
modeController.value = value;
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
).padding(all: 20);
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ part of 'site_list.dart';
|
||||
// RiverpodGenerator
|
||||
// **************************************************************************
|
||||
|
||||
String _$siteListNotifierHash() => r'5cd2d75f13b6e7d4910dc66a24bbd6508fc4175d';
|
||||
String _$siteListNotifierHash() => r'1670cadcc0c7ccbd98bc33bbf5b4af21e9cb166c';
|
||||
|
||||
/// Copied from Dart SDK
|
||||
class _SystemHash {
|
||||
|
||||
Reference in New Issue
Block a user