diff --git a/lib/widgets/field_outlined.dart b/lib/widgets/field_outlined.dart deleted file mode 100644 index f464488e..00000000 --- a/lib/widgets/field_outlined.dart +++ /dev/null @@ -1,54 +0,0 @@ -import 'package:apidash_design_system/apidash_design_system.dart'; -import 'package:flutter/material.dart'; - -class OutlinedField extends StatelessWidget { - const OutlinedField({ - super.key, - this.keyId, - this.initialValue, - this.hintText, - this.onChanged, - this.colorScheme, - }); - - final String? keyId; - final String? initialValue; - final String? hintText; - final void Function(String)? onChanged; - final ColorScheme? colorScheme; - - @override - Widget build(BuildContext context) { - var clrScheme = colorScheme ?? Theme.of(context).colorScheme; - return TextFormField( - key: keyId != null ? Key(keyId!) : null, - initialValue: initialValue, - style: kCodeStyle.copyWith( - color: clrScheme.onSurface, - ), - decoration: InputDecoration( - hintStyle: kCodeStyle.copyWith( - color: clrScheme.outline.withOpacity( - kHintOpacity, - ), - ), - hintText: hintText, - contentPadding: kP10, - focusedBorder: OutlineInputBorder( - borderSide: BorderSide( - color: clrScheme.primary.withOpacity( - kHintOpacity, - ), - ), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: clrScheme.surfaceContainerHighest, - ), - ), - isDense: true, - ), - onChanged: onChanged, - ); - } -} diff --git a/lib/widgets/widgets.dart b/lib/widgets/widgets.dart index 00fe8d0b..eb61e552 100644 --- a/lib/widgets/widgets.dart +++ b/lib/widgets/widgets.dart @@ -32,7 +32,6 @@ export 'field_cell_obscurable.dart'; export 'field_cell.dart'; export 'field_header.dart'; export 'field_json_search.dart'; -export 'field_outlined.dart'; export 'field_raw.dart'; export 'field_read_only.dart'; export 'field_url.dart'; diff --git a/lib/widgets/workspace_selector.dart b/lib/widgets/workspace_selector.dart index af72ba6d..db967d04 100644 --- a/lib/widgets/workspace_selector.dart +++ b/lib/widgets/workspace_selector.dart @@ -4,7 +4,6 @@ import 'package:flutter/material.dart'; import 'package:file_selector/file_selector.dart'; import 'package:flutter_hooks/flutter_hooks.dart'; import 'package:path/path.dart' as p; -import 'field_outlined.dart'; class WorkspaceSelector extends HookWidget { const WorkspaceSelector({ @@ -85,12 +84,12 @@ class WorkspaceSelector extends HookWidget { ], ), kVSpacer5, - OutlinedField( + ADOutlinedTextField( keyId: "workspace-name", onChanged: (value) { workspaceName.value = value.trim(); }, - colorScheme: Theme.of(context).colorScheme, + isDense: true, ), kVSpacer40, Row( diff --git a/packages/apidash_design_system/lib/widgets/textfield_outlined.dart b/packages/apidash_design_system/lib/widgets/textfield_outlined.dart new file mode 100644 index 00000000..2577f466 --- /dev/null +++ b/packages/apidash_design_system/lib/widgets/textfield_outlined.dart @@ -0,0 +1,78 @@ +import 'package:flutter/material.dart'; +import '../consts.dart'; + +class ADOutlinedTextField extends StatelessWidget { + const ADOutlinedTextField({ + super.key, + this.keyId, + this.initialValue, + this.textStyle, + this.textColor, + this.hintText, + this.hintTextStyle, + this.hintTextColor, + this.contentPadding, + this.fillColor, + this.focussedBorderColor, + this.enabledBorderColor, + this.isDense, + this.onChanged, + this.colorScheme, + }); + + final String? keyId; + final String? initialValue; + final TextStyle? textStyle; + final Color? textColor; + final String? hintText; + final TextStyle? hintTextStyle; + final Color? hintTextColor; + final EdgeInsetsGeometry? contentPadding; + final Color? fillColor; + final Color? focussedBorderColor; + final Color? enabledBorderColor; + final bool? isDense; + final void Function(String)? onChanged; + final ColorScheme? colorScheme; + + @override + Widget build(BuildContext context) { + var clrScheme = colorScheme ?? Theme.of(context).colorScheme; + return TextFormField( + key: keyId != null ? Key(keyId!) : null, + initialValue: initialValue, + style: textStyle ?? + kCodeStyle.copyWith( + color: textColor ?? clrScheme.onSurface, + ), + decoration: InputDecoration( + filled: true, + fillColor: fillColor ?? clrScheme.surfaceContainerLowest, + hintStyle: hintTextStyle ?? + kCodeStyle.copyWith( + color: hintTextColor ?? + clrScheme.outline.withOpacity( + kHintOpacity, + ), + ), + hintText: hintText, + contentPadding: contentPadding ?? kP10, + focusedBorder: OutlineInputBorder( + borderSide: BorderSide( + color: focussedBorderColor ?? + clrScheme.primary.withOpacity( + kHintOpacity, + ), + ), + ), + enabledBorder: OutlineInputBorder( + borderSide: BorderSide( + color: enabledBorderColor ?? clrScheme.surfaceContainerHighest, + ), + ), + isDense: isDense, + ), + onChanged: onChanged, + ); + } +} diff --git a/packages/apidash_design_system/lib/widgets/widgets.dart b/packages/apidash_design_system/lib/widgets/widgets.dart index 731a8255..2e26a2da 100644 --- a/packages/apidash_design_system/lib/widgets/widgets.dart +++ b/packages/apidash_design_system/lib/widgets/widgets.dart @@ -1 +1,2 @@ export 'dropdown.dart'; +export 'textfield_outlined.dart';