mirror of
https://github.com/foss42/apidash.git
synced 2025-05-20 07:46:32 +08:00
Abstract InputDecoration for TextField
This commit is contained in:
@ -27,22 +27,9 @@ class EnvCellField extends StatelessWidget {
|
|||||||
style: kCodeStyle.copyWith(
|
style: kCodeStyle.copyWith(
|
||||||
color: clrScheme.onSurface,
|
color: clrScheme.onSurface,
|
||||||
),
|
),
|
||||||
decoration: InputDecoration(
|
decoration: getTextFieldInputDecoration(
|
||||||
hintStyle: kCodeStyle.copyWith(
|
clrScheme,
|
||||||
color: clrScheme.outlineVariant,
|
|
||||||
),
|
|
||||||
hintText: hintText,
|
hintText: hintText,
|
||||||
contentPadding: const EdgeInsets.only(bottom: 12),
|
|
||||||
focusedBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: clrScheme.outlineVariant,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
enabledBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: clrScheme.surfaceContainerHighest,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
);
|
);
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import '../tokens/tokens.dart';
|
||||||
|
|
||||||
|
InputDecoration getTextFieldInputDecoration(
|
||||||
|
ColorScheme clrScheme, {
|
||||||
|
Color? fillColor,
|
||||||
|
String? hintText,
|
||||||
|
TextStyle? hintTextStyle,
|
||||||
|
double? hintTextFontSize,
|
||||||
|
Color? hintTextColor,
|
||||||
|
EdgeInsetsGeometry? contentPadding,
|
||||||
|
Color? focussedBorderColor,
|
||||||
|
Color? enabledBorderColor,
|
||||||
|
bool? isDense,
|
||||||
|
}) {
|
||||||
|
return InputDecoration(
|
||||||
|
filled: true,
|
||||||
|
fillColor: fillColor ?? clrScheme.surfaceContainerLowest,
|
||||||
|
hintStyle: hintTextStyle ??
|
||||||
|
kCodeStyle.copyWith(
|
||||||
|
fontSize: hintTextFontSize,
|
||||||
|
color: hintTextColor ?? clrScheme.outlineVariant,
|
||||||
|
),
|
||||||
|
hintText: hintText,
|
||||||
|
contentPadding: contentPadding ?? kP10,
|
||||||
|
focusedBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: focussedBorderColor ?? clrScheme.outline,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
enabledBorder: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(
|
||||||
|
color: enabledBorderColor ?? clrScheme.surfaceContainerHighest,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
isDense: isDense,
|
||||||
|
);
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import '../tokens/tokens.dart';
|
import '../tokens/tokens.dart';
|
||||||
|
import 'decoration_input_textfield.dart';
|
||||||
|
|
||||||
class ADOutlinedTextField extends StatelessWidget {
|
class ADOutlinedTextField extends StatelessWidget {
|
||||||
const ADOutlinedTextField({
|
const ADOutlinedTextField({
|
||||||
@ -65,26 +66,16 @@ class ADOutlinedTextField extends StatelessWidget {
|
|||||||
fontSize: textFontSize,
|
fontSize: textFontSize,
|
||||||
color: textColor ?? clrScheme.onSurface,
|
color: textColor ?? clrScheme.onSurface,
|
||||||
),
|
),
|
||||||
decoration: InputDecoration(
|
decoration: getTextFieldInputDecoration(
|
||||||
filled: true,
|
clrScheme,
|
||||||
fillColor: fillColor ?? clrScheme.surfaceContainerLowest,
|
fillColor: fillColor,
|
||||||
hintStyle: hintTextStyle ??
|
|
||||||
kCodeStyle.copyWith(
|
|
||||||
fontSize: hintTextFontSize,
|
|
||||||
color: hintTextColor ?? clrScheme.outlineVariant,
|
|
||||||
),
|
|
||||||
hintText: hintText,
|
hintText: hintText,
|
||||||
contentPadding: contentPadding ?? kP10,
|
hintTextStyle: hintTextStyle,
|
||||||
focusedBorder: OutlineInputBorder(
|
hintTextFontSize: hintTextFontSize,
|
||||||
borderSide: BorderSide(
|
hintTextColor: hintTextColor,
|
||||||
color: focussedBorderColor ?? clrScheme.outline,
|
contentPadding: contentPadding,
|
||||||
),
|
focussedBorderColor: focussedBorderColor,
|
||||||
),
|
enabledBorderColor: enabledBorderColor,
|
||||||
enabledBorder: OutlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: enabledBorderColor ?? clrScheme.surfaceContainerHighest,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
isDense: isDense,
|
isDense: isDense,
|
||||||
),
|
),
|
||||||
onChanged: onChanged,
|
onChanged: onChanged,
|
||||||
|
@ -2,6 +2,7 @@ export 'button_filled.dart';
|
|||||||
export 'button_icon.dart';
|
export 'button_icon.dart';
|
||||||
export 'button_text.dart';
|
export 'button_text.dart';
|
||||||
export 'checkbox.dart';
|
export 'checkbox.dart';
|
||||||
|
export 'decoration_input_textfield.dart';
|
||||||
export 'dropdown.dart';
|
export 'dropdown.dart';
|
||||||
export 'popup_menu.dart';
|
export 'popup_menu.dart';
|
||||||
export 'snackbar.dart';
|
export 'snackbar.dart';
|
||||||
|
Reference in New Issue
Block a user