Files
apidash/lib/widgets/form_data_field.dart
Delwin Mathew cd9a3d555a [fix] text obscuring error
This occurs due to padding, externally added specific padding only to bottom.
2024-03-03 20:50:39 +05:30

84 lines
2.3 KiB
Dart

import 'package:apidash/consts.dart';
import 'package:flutter/material.dart';
import 'dropdowns.dart';
class FormDataField extends StatefulWidget {
const FormDataField({
super.key,
required this.keyId,
this.initialValue,
this.hintText,
this.onChanged,
this.colorScheme,
this.formDataType,
this.onFormDataTypeChanged,
});
final String keyId;
final String? initialValue;
final String? hintText;
final void Function(String)? onChanged;
final ColorScheme? colorScheme;
final FormDataType? formDataType;
final void Function(FormDataType?)? onFormDataTypeChanged;
@override
State<FormDataField> createState() => _FormDataFieldState();
}
class _FormDataFieldState extends State<FormDataField> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
var colorScheme = widget.colorScheme ?? Theme.of(context).colorScheme;
return Row(
children: [
Expanded(
flex: 1,
child: TextFormField(
initialValue: widget.initialValue,
key: Key(widget.keyId),
style: kCodeStyle.copyWith(
color: colorScheme.onSurface,
),
decoration: InputDecoration(
hintStyle: kCodeStyle.copyWith(
color: colorScheme.outline.withOpacity(
kHintOpacity,
),
),
hintText: widget.hintText,
contentPadding: const EdgeInsets.only(bottom: 16),
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: colorScheme.primary.withOpacity(
kHintOpacity,
),
),
),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: colorScheme.surfaceVariant,
),
),
suffixIcon: DropdownButtonFormData(
formDataType: widget.formDataType,
onChanged: (p0) {
if (widget.onFormDataTypeChanged != null) {
widget.onFormDataTypeChanged!(p0);
}
},
),
),
onChanged: widget.onChanged,
),
),
],
);
}
}