mirror of
https://github.com/foss42/apidash.git
synced 2025-05-21 16:26:37 +08:00
48 lines
1.2 KiB
Dart
48 lines
1.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:apidash/consts.dart';
|
|
|
|
class DropdownButtonFormData extends StatelessWidget {
|
|
const DropdownButtonFormData({
|
|
super.key,
|
|
this.formDataType,
|
|
this.onChanged,
|
|
});
|
|
|
|
final FormDataType? formDataType;
|
|
final void Function(FormDataType?)? onChanged;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final surfaceColor = Theme.of(context).colorScheme.surface;
|
|
return DropdownButton<FormDataType>(
|
|
dropdownColor: surfaceColor,
|
|
focusColor: surfaceColor,
|
|
value: formDataType,
|
|
icon: const Icon(
|
|
Icons.unfold_more_rounded,
|
|
size: 16,
|
|
),
|
|
elevation: 4,
|
|
style: kCodeStyle.copyWith(
|
|
color: Theme.of(context).colorScheme.primary,
|
|
),
|
|
underline: const IgnorePointer(),
|
|
onChanged: onChanged,
|
|
borderRadius: kBorderRadius12,
|
|
items: FormDataType.values
|
|
.map<DropdownMenuItem<FormDataType>>((FormDataType value) {
|
|
return DropdownMenuItem<FormDataType>(
|
|
value: value,
|
|
child: Padding(
|
|
padding: kPs8,
|
|
child: Text(
|
|
value.name,
|
|
style: kTextStyleButton,
|
|
),
|
|
),
|
|
);
|
|
}).toList(),
|
|
);
|
|
}
|
|
}
|