fix: 修复 MaterialInput 组件的三个问题
1. 统一输入框大小 - 所有输入框使用相同的 padding (16px) 2. 移除容器外边框 - 去掉 filled 和 fillColor 3. 修复 padding 问题 - 使用固定的 16px padding 4. 统一字体大小 - 使用 16px 字体确保高度一致 5. 统一圆角 - 使用固定的 12px 圆角
This commit is contained in:
@@ -80,10 +80,11 @@ class MaterialInput extends StatelessWidget {
|
||||
onTap: onTap,
|
||||
onFieldSubmitted: onSubmitted,
|
||||
inputFormatters: inputFormatters,
|
||||
style: AppTextStyles.headlineMedium(context).copyWith(
|
||||
style: AppTextStyles.bodyLarge(context).copyWith(
|
||||
color: enabled
|
||||
? colorScheme.onSurface
|
||||
: colorScheme.onSurface.withValues(alpha: 0.5),
|
||||
fontSize: 16, // 统一字体大小
|
||||
),
|
||||
cursorColor: primaryColor,
|
||||
cursorWidth: 2.0,
|
||||
@@ -123,25 +124,24 @@ class MaterialInput extends StatelessWidget {
|
||||
// 后置图标
|
||||
suffixIcon: suffixIcon,
|
||||
|
||||
// 填充颜色
|
||||
filled: true,
|
||||
fillColor: fillColor,
|
||||
// 填充颜色(移除,不需要)
|
||||
filled: false,
|
||||
|
||||
// 内容内边距
|
||||
// 内容内边距(统一使用 16px)
|
||||
contentPadding: const EdgeInsets.symmetric(
|
||||
horizontal: AppSpacing.lg,
|
||||
vertical: AppSpacing.md,
|
||||
horizontal: 16,
|
||||
vertical: 16,
|
||||
),
|
||||
|
||||
// Material Design 3 边框样式
|
||||
border: _buildBorder(borderColor, AppRadius.lg),
|
||||
enabledBorder: _buildBorder(borderColor, AppRadius.lg),
|
||||
focusedBorder: _buildBorder(primaryColor, AppRadius.lg, width: 2.0),
|
||||
errorBorder: _buildBorder(colorScheme.error, AppRadius.lg),
|
||||
focusedErrorBorder: _buildBorder(colorScheme.error, AppRadius.lg, width: 2.0),
|
||||
// Material Design 3 边框样式(统一 12px 圆角)
|
||||
border: _buildBorder(borderColor, 12),
|
||||
enabledBorder: _buildBorder(borderColor, 12),
|
||||
focusedBorder: _buildBorder(primaryColor, 12, width: 2.0),
|
||||
errorBorder: _buildBorder(colorScheme.error, 12),
|
||||
focusedErrorBorder: _buildBorder(colorScheme.error, 12, width: 2.0),
|
||||
disabledBorder: _buildBorder(
|
||||
borderColor.withValues(alpha: 0.3),
|
||||
AppRadius.lg,
|
||||
12,
|
||||
),
|
||||
|
||||
// 错误文本样式
|
||||
|
||||
Reference in New Issue
Block a user