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,
|
onTap: onTap,
|
||||||
onFieldSubmitted: onSubmitted,
|
onFieldSubmitted: onSubmitted,
|
||||||
inputFormatters: inputFormatters,
|
inputFormatters: inputFormatters,
|
||||||
style: AppTextStyles.headlineMedium(context).copyWith(
|
style: AppTextStyles.bodyLarge(context).copyWith(
|
||||||
color: enabled
|
color: enabled
|
||||||
? colorScheme.onSurface
|
? colorScheme.onSurface
|
||||||
: colorScheme.onSurface.withValues(alpha: 0.5),
|
: colorScheme.onSurface.withValues(alpha: 0.5),
|
||||||
|
fontSize: 16, // 统一字体大小
|
||||||
),
|
),
|
||||||
cursorColor: primaryColor,
|
cursorColor: primaryColor,
|
||||||
cursorWidth: 2.0,
|
cursorWidth: 2.0,
|
||||||
@@ -123,25 +124,24 @@ class MaterialInput extends StatelessWidget {
|
|||||||
// 后置图标
|
// 后置图标
|
||||||
suffixIcon: suffixIcon,
|
suffixIcon: suffixIcon,
|
||||||
|
|
||||||
// 填充颜色
|
// 填充颜色(移除,不需要)
|
||||||
filled: true,
|
filled: false,
|
||||||
fillColor: fillColor,
|
|
||||||
|
|
||||||
// 内容内边距
|
// 内容内边距(统一使用 16px)
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
horizontal: AppSpacing.lg,
|
horizontal: 16,
|
||||||
vertical: AppSpacing.md,
|
vertical: 16,
|
||||||
),
|
),
|
||||||
|
|
||||||
// Material Design 3 边框样式
|
// Material Design 3 边框样式(统一 12px 圆角)
|
||||||
border: _buildBorder(borderColor, AppRadius.lg),
|
border: _buildBorder(borderColor, 12),
|
||||||
enabledBorder: _buildBorder(borderColor, AppRadius.lg),
|
enabledBorder: _buildBorder(borderColor, 12),
|
||||||
focusedBorder: _buildBorder(primaryColor, AppRadius.lg, width: 2.0),
|
focusedBorder: _buildBorder(primaryColor, 12, width: 2.0),
|
||||||
errorBorder: _buildBorder(colorScheme.error, AppRadius.lg),
|
errorBorder: _buildBorder(colorScheme.error, 12),
|
||||||
focusedErrorBorder: _buildBorder(colorScheme.error, AppRadius.lg, width: 2.0),
|
focusedErrorBorder: _buildBorder(colorScheme.error, 12, width: 2.0),
|
||||||
disabledBorder: _buildBorder(
|
disabledBorder: _buildBorder(
|
||||||
borderColor.withValues(alpha: 0.3),
|
borderColor.withValues(alpha: 0.3),
|
||||||
AppRadius.lg,
|
12,
|
||||||
),
|
),
|
||||||
|
|
||||||
// 错误文本样式
|
// 错误文本样式
|
||||||
|
|||||||
Reference in New Issue
Block a user