Refactor SpaceNameTextField: Update text styling and border handling to utilize context-based theming. This improves consistency with the app's theme and enhances maintainability by centralizing border styling logic.

This commit is contained in:
Faris Armoush
2025-07-03 15:37:06 +03:00
parent 1fccd51440
commit b857736e10

View File

@ -56,7 +56,7 @@ class _SpaceNameTextFieldState extends State<SpaceNameTextField> {
UpdateSpaceDetailsName(value),
),
validator: _validateName,
style: Theme.of(context).textTheme.bodyMedium,
style: context.textTheme.bodyMedium,
decoration: InputDecoration(
hintText: 'Please enter the name',
hintStyle: context.textTheme.bodyMedium!.copyWith(
@ -64,21 +64,22 @@ class _SpaceNameTextFieldState extends State<SpaceNameTextField> {
),
filled: true,
fillColor: ColorsManager.boxColor,
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(width: 1.5),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: const BorderSide(
color: ColorsManager.boxColor,
),
),
enabledBorder: _buildBorder(context, ColorsManager.vividBlue),
focusedBorder: _buildBorder(context, ColorsManager.primaryColor),
errorBorder: _buildBorder(context, context.theme.colorScheme.error),
focusedErrorBorder: _buildBorder(context, context.theme.colorScheme.error),
errorStyle: context.textTheme.bodySmall?.copyWith(
color: ColorsManager.red,
color: context.theme.colorScheme.error,
),
),
),
);
}
OutlineInputBorder _buildBorder(BuildContext context, [Color? color]) {
return OutlineInputBorder(
borderRadius: BorderRadius.circular(10),
borderSide: BorderSide(width: 1, color: color ?? ColorsManager.boxColor),
);
}
}