InputOptions.glassmorphic constructor
InputOptions.glassmorphic({})
Creates a glassmorphic input field with a frosted glass effect.
Implementation
factory InputOptions.glassmorphic({
List<Color>? colors,
double borderRadius = 24.0,
double blurStrength = 10.0,
String? hintText,
Color? textColor,
Color? hintColor,
bool useOuterContainer = true,
TextEditingController? textController,
bool sendOnEnter = true,
}) {
final effectiveColors = colors ??
[
Colors.white.withOpacityCompat(0.3),
Colors.white.withOpacityCompat(0.2),
];
return InputOptions(
textController: textController,
useOuterContainer: useOuterContainer,
sendOnEnter: sendOnEnter,
blurStrength: blurStrength,
textStyle: textColor != null ? TextStyle(color: textColor) : null,
containerBackgroundColor: Colors.transparent,
containerDecoration: BoxDecoration(
gradient: LinearGradient(
colors: effectiveColors,
begin: Alignment.topLeft,
end: Alignment.bottomRight,
),
borderRadius: BorderRadius.circular(borderRadius),
border: Border.all(
color: Colors.white.withOpacityCompat(0.2),
width: 1.5,
),
),
decoration: InputDecoration(
hintText: hintText,
hintStyle: hintColor != null ? TextStyle(color: hintColor) : null,
border: InputBorder.none,
contentPadding: const EdgeInsets.symmetric(
horizontal: 16.0,
vertical: 10.0,
),
),
);
}