tablet-app/lib/Components/rounded_input_field.dart
2023-12-01 09:09:16 +01:00

50 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:tablet_app/Components/text_field_container.dart';
import 'package:tablet_app/constants.dart';
class RoundedInputField extends StatelessWidget {
final String? hintText;
final IconData? icon;
final ValueChanged<String>? onChanged;
final String? initialValue;
final Color? color, textColor, iconColor;
final int? maxLength;
final bool isString;
const RoundedInputField({
Key? key,
this.hintText,
this.initialValue,
this.icon,
this.color = kBackgroundGrey,
this.textColor = kMainGrey,
this.iconColor = kMainRed,
this.onChanged,
this.maxLength, // 50
this.isString = true,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return TextFieldContainer(
color: color,
child: TextFormField (
onChanged: onChanged,
initialValue: initialValue,
cursorColor: textColor,
maxLength: maxLength,
keyboardType: isString ? TextInputType.text : TextInputType.number,
style: TextStyle(fontSize: 20, color: textColor),
decoration: InputDecoration(
icon: icon != null ? Icon(
icon,
color: iconColor,
): null,
hintText: hintText,
hintStyle: TextStyle(fontSize: 20.0, color: textColor),
border: InputBorder.none,
)
),
);
}
}