TFilePickerTheme.defaultTheme constructor
TFilePickerTheme.defaultTheme(
- ColorScheme colors
Implementation
factory TFilePickerTheme.defaultTheme(ColorScheme colors) {
final baseTheme = TInputFieldTheme.defaultTheme(colors);
return TFilePickerTheme(
size: baseTheme.size,
decorationType: baseTheme.decorationType,
color: baseTheme.color,
backgroundColor: baseTheme.backgroundColor,
borderColor: baseTheme.borderColor,
labelStyle: baseTheme.labelStyle,
helperTextStyle: baseTheme.helperTextStyle,
errorTextStyle: baseTheme.errorTextStyle,
tagStyle: baseTheme.tagStyle,
decoration: baseTheme.decoration,
borderRadius: baseTheme.borderRadius,
borderWidth: baseTheme.borderWidth,
labelBuilder: baseTheme.labelBuilder,
helperTextBuilder: baseTheme.helperTextBuilder,
errorsBuilder: baseTheme.errorsBuilder,
preWidget: baseTheme.preWidget,
postWidget: baseTheme.postWidget,
height: baseTheme.height,
padding: baseTheme.padding,
fontSize: baseTheme.fontSize,
fileTagBuilder: (file, onRemove) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 2.0),
decoration: BoxDecoration(color: colors.surfaceContainer, borderRadius: BorderRadius.circular(5.0)),
child: IntrinsicWidth(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
_getFileIcon(file.extension, colors),
const SizedBox(width: 5),
Flexible(
child: Text(
file.name,
style: TextStyle(color: colors.onSurfaceVariant, fontSize: baseTheme.fieldFontSize, fontWeight: FontWeight.w400),
overflow: TextOverflow.ellipsis,
maxLines: 1,
),
),
const SizedBox(width: 5.0),
InkWell(
onTap: onRemove,
child: Icon(Icons.close, size: 14, color: colors.onSurfaceVariant),
),
],
),
),
);
},
hintStyle: WidgetStateProperty.all(TextStyle(fontSize: baseTheme.fieldFontSize, color: colors.onSurfaceVariant.withAlpha(150))),
);
}