Skip to content

Commit

Permalink
WIP on textfields
Browse files Browse the repository at this point in the history
  • Loading branch information
Pante committed Jun 27, 2024
1 parent 404c64a commit f79768e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 15 deletions.
19 changes: 19 additions & 0 deletions forui/lib/src/widgets/form/text_form_field.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

import 'package:flutter/material.dart';

class FTextFormField extends FormField<String> {

FTextFormField({
super.autovalidateMode,
}): super(
builder: (state)
);

@override
FormFieldState<String> createState() => _State();

}

class _State extends FormFieldState<String> {

}
25 changes: 13 additions & 12 deletions forui/lib/src/widgets/text_field/text_field.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ import 'package:forui/forui.dart';

part 'text_field_style.dart';

/// The default context menu builder.
@internal
Widget defaultContextMenuBuilder(
BuildContext context,
EditableTextState state,
) => AdaptiveTextSelectionToolbar.editableText(editableTextState: state);


/// A text field.
///
/// It lets the user enter text, either with hardware keyboard or with an onscreen keyboard.
Expand All @@ -20,12 +28,6 @@ part 'text_field_style.dart';
/// * [FTextFieldStyle] for customizing a text field's appearance.
/// * [TextField] for more details about working with a text field.
final class FTextField extends StatelessWidget {
static Widget _defaultContextMenuBuilder(
BuildContext context,
EditableTextState editableTextState,
) =>
AdaptiveTextSelectionToolbar.editableText(editableTextState: editableTextState);

/// The text field's style. Defaults to [FThemeData.textFieldStyle].
final FTextFieldStyle? style;

Expand Down Expand Up @@ -537,7 +539,7 @@ final class FTextField extends StatelessWidget {
this.restorationId,
this.scribbleEnabled = true,
this.enableIMEPersonalizedLearning = true,
this.contextMenuBuilder = _defaultContextMenuBuilder,
this.contextMenuBuilder = defaultContextMenuBuilder,
this.canRequestFocus = true,
this.undoController,
this.spellCheckConfiguration,
Expand Down Expand Up @@ -598,7 +600,7 @@ final class FTextField extends StatelessWidget {
this.restorationId,
this.scribbleEnabled = true,
this.enableIMEPersonalizedLearning = true,
this.contextMenuBuilder = _defaultContextMenuBuilder,
this.contextMenuBuilder = defaultContextMenuBuilder,
this.canRequestFocus = true,
this.undoController,
this.spellCheckConfiguration,
Expand Down Expand Up @@ -668,7 +670,7 @@ final class FTextField extends StatelessWidget {
this.restorationId,
this.scribbleEnabled = true,
this.enableIMEPersonalizedLearning = true,
this.contextMenuBuilder = _defaultContextMenuBuilder,
this.contextMenuBuilder = defaultContextMenuBuilder,
this.canRequestFocus = true,
this.undoController,
this.spellCheckConfiguration,
Expand Down Expand Up @@ -737,7 +739,7 @@ final class FTextField extends StatelessWidget {
this.restorationId,
this.scribbleEnabled = true,
this.enableIMEPersonalizedLearning = true,
this.contextMenuBuilder = _defaultContextMenuBuilder,
this.contextMenuBuilder = defaultContextMenuBuilder,
this.canRequestFocus = true,
this.undoController,
this.spellCheckConfiguration,
Expand Down Expand Up @@ -983,8 +985,7 @@ final class FTextField extends StatelessWidget {
..add(IterableProperty('autofillHints', autofillHints))
..add(StringProperty('restorationId', restorationId))
..add(FlagProperty('scribbleEnabled', value: scribbleEnabled, ifTrue: 'scribbleEnabled'))
..add(
FlagProperty(
..add(FlagProperty(
'enableIMEPersonalizedLearning',
value: enableIMEPersonalizedLearning,
ifTrue: 'enableIMEPersonalizedLearning',
Expand Down
6 changes: 3 additions & 3 deletions forui/lib/src/widgets/text_field/text_field_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ final class FTextFieldStyle with Diagnosticable {

/// The padding surrounding this text field's content.
///
/// Defaults to `const EdgeInsets.symmetric(horizontal: 15, vertical: 5)`.
/// Defaults to `const EdgeInsets.symmetric(horizontal: 15, vertical: 15)`.
final EdgeInsets contentPadding;

/// Configures padding to edges surrounding a [Scrollable] when this text field scrolls into view.
Expand Down Expand Up @@ -43,7 +43,7 @@ final class FTextFieldStyle with Diagnosticable {
required this.disabled,
required this.error,
this.cursorColor = CupertinoColors.activeBlue,
this.contentPadding = const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
this.contentPadding = const EdgeInsets.symmetric(horizontal: 15, vertical: 15),
this.scrollPadding = const EdgeInsets.all(20),
});

Expand All @@ -54,7 +54,7 @@ final class FTextFieldStyle with Diagnosticable {
required FStyle style,
}) : keyboardAppearance = colorScheme.brightness,
cursorColor = CupertinoColors.activeBlue,
contentPadding = const EdgeInsets.symmetric(horizontal: 15, vertical: 5),
contentPadding = const EdgeInsets.symmetric(horizontal: 15, vertical: 15),
scrollPadding = const EdgeInsets.all(20.0),
enabled = FTextFieldStateStyle.inherit(
labelColor: colorScheme.primary,
Expand Down

0 comments on commit f79768e

Please sign in to comment.