mirror of
https://github.com/foss42/apidash.git
synced 2025-08-06 13:51:20 +08:00
Add ADOutlinedTextField
This commit is contained in:
@ -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,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -32,7 +32,6 @@ export 'field_cell_obscurable.dart';
|
|||||||
export 'field_cell.dart';
|
export 'field_cell.dart';
|
||||||
export 'field_header.dart';
|
export 'field_header.dart';
|
||||||
export 'field_json_search.dart';
|
export 'field_json_search.dart';
|
||||||
export 'field_outlined.dart';
|
|
||||||
export 'field_raw.dart';
|
export 'field_raw.dart';
|
||||||
export 'field_read_only.dart';
|
export 'field_read_only.dart';
|
||||||
export 'field_url.dart';
|
export 'field_url.dart';
|
||||||
|
@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:file_selector/file_selector.dart';
|
import 'package:file_selector/file_selector.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:path/path.dart' as p;
|
import 'package:path/path.dart' as p;
|
||||||
import 'field_outlined.dart';
|
|
||||||
|
|
||||||
class WorkspaceSelector extends HookWidget {
|
class WorkspaceSelector extends HookWidget {
|
||||||
const WorkspaceSelector({
|
const WorkspaceSelector({
|
||||||
@ -85,12 +84,12 @@ class WorkspaceSelector extends HookWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
kVSpacer5,
|
kVSpacer5,
|
||||||
OutlinedField(
|
ADOutlinedTextField(
|
||||||
keyId: "workspace-name",
|
keyId: "workspace-name",
|
||||||
onChanged: (value) {
|
onChanged: (value) {
|
||||||
workspaceName.value = value.trim();
|
workspaceName.value = value.trim();
|
||||||
},
|
},
|
||||||
colorScheme: Theme.of(context).colorScheme,
|
isDense: true,
|
||||||
),
|
),
|
||||||
kVSpacer40,
|
kVSpacer40,
|
||||||
Row(
|
Row(
|
||||||
|
@ -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,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
@ -1 +1,2 @@
|
|||||||
export 'dropdown.dart';
|
export 'dropdown.dart';
|
||||||
|
export 'textfield_outlined.dart';
|
||||||
|
Reference in New Issue
Block a user