Files
pipelines/app/lib/features/settings/storage/storage_controls.dart
T
alan 502027b602 Remove Cupertino branches from server settings
Keep the public compatibility parameters while retaining only the Material UI path. Remove Cupertino-only tests so the reviewed settings and server code matches the app's Material-only runtime.
2026-11-11 01:39:39 +00:00

80 lines
1.9 KiB
Dart

import 'package:flutter/material.dart';
class StorageAction extends StatelessWidget {
const StorageAction({
super.key,
required this.label,
required this.onPressed,
this.destructive = false,
});
final String label;
final VoidCallback? onPressed;
final bool destructive;
@override
Widget build(BuildContext context) => TextButton(
onPressed: onPressed,
style: destructive
? TextButton.styleFrom(
foregroundColor: Theme.of(context).colorScheme.error,
)
: null,
child: Text(label),
);
}
class StorageSwitch extends StatelessWidget {
const StorageSwitch({
super.key,
required this.label,
required this.value,
required this.onChanged,
});
final String label;
final bool value;
final ValueChanged<bool>? onChanged;
@override
Widget build(BuildContext context) => Row(
children: [
Expanded(child: Text(label)),
Semantics(
label: label,
child: Switch(value: value, onChanged: onChanged),
),
],
);
}
class StorageInput extends StatelessWidget {
const StorageInput({
super.key,
required this.label,
required this.controller,
required this.onChanged,
required this.enabled,
this.decimal = false,
});
final String label;
final TextEditingController controller;
final ValueChanged<String> onChanged;
final bool enabled;
final bool decimal;
@override
Widget build(BuildContext context) {
final keyboard = TextInputType.numberWithOptions(decimal: decimal);
return TextField(
controller: controller,
enabled: enabled,
keyboardType: keyboard,
onChanged: onChanged,
decoration: InputDecoration(
labelText: label,
hintText: 'No limit',
border: const OutlineInputBorder(),
),
);
}
}
Widget storagePadding(Widget child) =>
Padding(padding: const EdgeInsets.all(16), child: child);