mirror of
https://github.com/chaos-zhu/easynode.git
synced 2026-10-07 13:18:34 +08:00
feat: 优化警告
This commit is contained in:
@@ -508,7 +508,7 @@ class _CardSection extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
if (trailing != null) trailing!,
|
||||
?trailing,
|
||||
],
|
||||
),
|
||||
if (children.isNotEmpty) const SizedBox(height: 14),
|
||||
@@ -1096,55 +1096,6 @@ class _ProxyField extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _DropdownField<T> extends StatelessWidget {
|
||||
const _DropdownField({
|
||||
required this.label,
|
||||
required this.value,
|
||||
required this.items,
|
||||
required this.onChanged,
|
||||
this.validator,
|
||||
this.icon,
|
||||
this.enabled = true,
|
||||
this.emptyText,
|
||||
this.selectedItemBuilder,
|
||||
});
|
||||
|
||||
final String label;
|
||||
final T? value;
|
||||
final List<DropdownMenuItem<T>> items;
|
||||
final ValueChanged<T?> onChanged;
|
||||
final String? Function(T?)? validator;
|
||||
final IconData? icon;
|
||||
final bool enabled;
|
||||
final String? emptyText;
|
||||
final DropdownButtonBuilder? selectedItemBuilder;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return _LabeledBlock(
|
||||
label: label,
|
||||
child: DropdownButtonFormField<T>(
|
||||
initialValue: value,
|
||||
isExpanded: true,
|
||||
items: items,
|
||||
onChanged: enabled ? onChanged : null,
|
||||
validator: validator,
|
||||
hint: emptyText == null
|
||||
? null
|
||||
: Text(
|
||||
emptyText!,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: const TextStyle(color: _FormColors.label),
|
||||
),
|
||||
selectedItemBuilder: selectedItemBuilder,
|
||||
icon: Icon(icon ?? Icons.keyboard_arrow_down, color: _FormColors.label),
|
||||
style: const TextStyle(color: _FormColors.text, fontSize: 15),
|
||||
decoration: _fieldDecoration(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _PickerField extends StatelessWidget {
|
||||
const _PickerField({
|
||||
required this.label,
|
||||
|
||||
@@ -44,6 +44,16 @@ class _ServersTabState extends ConsumerState<ServersTab> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
void toggleServerExpanded(String id) {
|
||||
setState(() {
|
||||
if (_expandedServerIds.contains(id)) {
|
||||
_expandedServerIds.remove(id);
|
||||
} else {
|
||||
_expandedServerIds.add(id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _refresh() async {
|
||||
await refreshServerSharedData(ref);
|
||||
}
|
||||
@@ -782,15 +792,7 @@ class _ServerCard extends StatelessWidget {
|
||||
? Icons.keyboard_arrow_up
|
||||
: Icons.keyboard_arrow_down,
|
||||
highlighted: expanded,
|
||||
onTap: () {
|
||||
state.setState(() {
|
||||
if (expanded) {
|
||||
state._expandedServerIds.remove(server.id);
|
||||
} else {
|
||||
state._expandedServerIds.add(server.id);
|
||||
}
|
||||
});
|
||||
},
|
||||
onTap: () => state.toggleServerExpanded(server.id),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
import 'strings_en.dart';
|
||||
|
||||
@@ -22,6 +22,7 @@ class _FakeRepository implements ServerRepository {
|
||||
this.hosts = const [],
|
||||
this.groups = const [],
|
||||
this.fetchError,
|
||||
// ignore: unused_element_parameter
|
||||
this.groupFetchError,
|
||||
SshConnectionConfig? config,
|
||||
this.sshError,
|
||||
|
||||
Reference in New Issue
Block a user