Skip to content

Commit

Permalink
Merge pull request #17 from Nuxify/main
Browse files Browse the repository at this point in the history
Textfield updates
  • Loading branch information
JosesGabriel authored Sep 20, 2024
2 parents 83aaf51 + 3aa5d74 commit 65e0564
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 5 deletions.
6 changes: 3 additions & 3 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.3.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.nuxifyWidgetbook.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
Expand All @@ -528,7 +528,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.3.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.nuxifyWidgetbook.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand All @@ -544,7 +544,7 @@
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
GENERATE_INFOPLIST_FILE = YES;
MARKETING_VERSION = 1.2.0;
MARKETING_VERSION = 1.3.0;
PRODUCT_BUNDLE_IDENTIFIER = com.example.nuxifyWidgetbook.RunnerTests;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_VERSION = 5.0;
Expand Down
33 changes: 32 additions & 1 deletion lib/input/filled_textfield.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:flutter/services.dart';
import 'package:flutter/material.dart';

class FilledTextField extends StatelessWidget {
Expand Down Expand Up @@ -36,12 +37,24 @@ class FilledTextField extends StatelessWidget {
/// [prefix] A widget to display before the text field.
///
/// [enabled] is an optional parameter that specifies whether the text field is enabled.
///
///
/// [maxLength] The maximum number of characters (Unicode scalar values) to allow in the text field.
///
/// [maxLines] The maximum number of lines for the text to span, wrapping if necessary.
///
/// [counterText] Optional custom counter text to be used instead of the default counter.
///
/// [textInputAction] The action to perform when the user is done entering text.
///
/// [onFieldSubmitted] A callback that is called when the user is done entering text.
///
/// [inputFormatters] A list of TextInputFormatter objects that will be applied to the text field.
///
/// [focusNode] A FocusNode that allows you to control the focus of the text field.
///
/// [readOnly] Whether the text field is read-only.
///
/// [onTap] A callback that is called when the text field is tapped.
const FilledTextField({
this.controller,
this.fillColor,
Expand All @@ -65,6 +78,12 @@ class FilledTextField extends StatelessWidget {
this.maxLength,
this.maxLines,
this.counterText,
this.textInputAction,
this.onFieldSubmitted,
this.focusNode,
this.inputFormatters,
this.readOnly = false,
this.onTap,
super.key,
});
final Color? fillColor;
Expand All @@ -87,16 +106,28 @@ class FilledTextField extends StatelessWidget {
final int? maxLength;
final int? maxLines;
final String? counterText;
final TextInputAction? textInputAction;
final Function(String)? onFieldSubmitted;
final List<TextInputFormatter>? inputFormatters;
final FocusNode? focusNode;
final bool readOnly;
final Function()? onTap;

@override
Widget build(BuildContext context) {
return TextFormField(
readOnly: readOnly,
onTap: onTap,
focusNode: focusNode,
validator: validator,
controller: controller,
style: textStyle,
obscureText: obscureText,
maxLength: maxLength,
maxLines: maxLines,
textInputAction: textInputAction,
onFieldSubmitted: onFieldSubmitted,
inputFormatters: inputFormatters,
decoration: InputDecoration(
enabled: enabled,
prefixIcon: prefix,
Expand Down
31 changes: 31 additions & 0 deletions lib/input/outlined_textfield.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

class OutlinedTextField extends StatelessWidget {
/// Creates a text field with an outlined appearance.
Expand Down Expand Up @@ -46,6 +47,18 @@ class OutlinedTextField extends StatelessWidget {
/// [maxLines] The maximum number of lines for the text to span, wrapping if necessary.
///
/// [counterText] Optional custom counter text to be used instead of the default counter.
///
/// [textInputAction] The action to perform when the user is done typing the text.
///
/// [onFieldSubmitted] A callback that is called when the user is done typing the text.
///
/// [inputFormatters] A list of input formatters to apply to the text field.
///
/// [focusNode] The focus node for the text field.
///
/// [readOnly] Whether the text field is read-only.
///
/// [onTap] A callback that is called when the text field is tapped.
const OutlinedTextField({
this.controller,
this.borderRadius = 30,
Expand All @@ -71,6 +84,12 @@ class OutlinedTextField extends StatelessWidget {
this.maxLength,
this.maxLines,
this.counterText,
this.textInputAction,
this.onFieldSubmitted,
this.inputFormatters,
this.focusNode,
this.readOnly = false,
this.onTap,
super.key,
});

Expand All @@ -95,16 +114,28 @@ class OutlinedTextField extends StatelessWidget {
final int? maxLength;
final int? maxLines;
final String? counterText;
final TextInputAction? textInputAction;
final Function(String)? onFieldSubmitted;
final List<TextInputFormatter>? inputFormatters;
final FocusNode? focusNode;
final bool readOnly;
final Function()? onTap;

@override
Widget build(BuildContext context) {
return TextFormField(
onTap: onTap,
readOnly: readOnly,
validator: validator,
controller: controller,
style: textStyle,
obscureText: obscureText,
maxLength: maxLength,
maxLines: maxLines,
textInputAction: textInputAction,
onFieldSubmitted: onFieldSubmitted,
inputFormatters: inputFormatters,
focusNode: focusNode,
decoration: InputDecoration(
enabled: enabled,
counterText: counterText,
Expand Down
2 changes: 1 addition & 1 deletion widgetbook/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: widgetbook_workspace
description: "A new Flutter project."
publish_to: 'none'
version: 1.2.0
version: 1.3.0

environment:
sdk: '>=3.3.4 <4.0.0'
Expand Down

0 comments on commit 65e0564

Please sign in to comment.