THATMobile/lib/core/theme/form_theme.dart
2026-02-26 10:39:42 +07:00

61 lines
3.1 KiB
Dart

import 'package:baseproject/core/theme/custom_color.dart';
import 'package:baseproject/core/theme/text_style.dart';
import 'package:flutter/material.dart';
class FormTheme {
static InputDecoration getInputDecoration({double radius = 6, Color? borderColor}) {
return InputDecoration(
border: OutlineInputBorder(
borderSide: BorderSide(color: borderColor ?? CustomColor.textGray),
borderRadius: BorderRadius.all(Radius.circular(radius)),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: borderColor ?? CustomColor.textGray),
borderRadius: BorderRadius.all(Radius.circular(radius)),
),
errorBorder: OutlineInputBorder(
borderSide: const BorderSide(color: CustomColor.redText),
borderRadius: BorderRadius.all(Radius.circular(radius)),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: borderColor ?? CustomColor.textGray),
borderRadius: BorderRadius.all(Radius.circular(radius)),
),
disabledBorder: OutlineInputBorder(
borderSide: const BorderSide(color: CustomColor.textGray),
borderRadius: BorderRadius.all(Radius.circular(radius)),
),
);
}
static getDefaultInputDecorationTheme({double radius = 6}) => InputDecorationTheme(
floatingLabelBehavior: FloatingLabelBehavior.never,
prefixStyle: textStyleBodySmall.copyWith(color: CustomColor.textGray),
prefixIconColor: CustomColor.textGray,
focusColor: CustomColor.textGray,
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
border: FormTheme.getInputDecoration(radius: radius).border,
enabledBorder: FormTheme.getInputDecoration(radius: radius).enabledBorder,
errorBorder: FormTheme.getInputDecoration(radius: radius).errorBorder,
focusedBorder: FormTheme.getInputDecoration(radius: radius).focusedBorder,
disabledBorder: FormTheme.getInputDecoration(radius: radius).disabledBorder,
floatingLabelStyle: textStyleBodySmall.copyWith(color: CustomColor.textGray),
hintStyle: textStyleBodySmall.copyWith(color: CustomColor.textGray),
);
static getSecondInputDecorationTheme({double radius = 6}) => InputDecorationTheme(
floatingLabelBehavior: FloatingLabelBehavior.never,
prefixStyle: textStyleBodySmall.copyWith(color: CustomColor.textGray),
prefixIconColor: CustomColor.textGray,
focusColor: CustomColor.textGray,
contentPadding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
border: FormTheme.getInputDecoration(radius: 6, borderColor: CustomColor.textGray).border,
enabledBorder: FormTheme.getInputDecoration(radius: 6, borderColor: CustomColor.textGray).enabledBorder,
errorBorder: FormTheme.getInputDecoration(radius: 6).errorBorder,
focusedBorder: FormTheme.getInputDecoration(radius: 6).focusedBorder,
disabledBorder: FormTheme.getInputDecoration(radius: 6).disabledBorder,
floatingLabelStyle: textStyleBodySmall.copyWith(color: CustomColor.textGray),
hintStyle: textStyleBodySmall.copyWith(color: CustomColor.textGray),
fillColor: Colors.white);
}