mirror of
https://github.com/Iconica-Development/flutter_single_character_input.git
synced 2025-05-19 12:13:45 +02:00
Compare commits
No commits in common. "master" and "0.0.3" have entirely different histories.
3 changed files with 1 additions and 43 deletions
14
.github/workflows/component-documentation.yml
vendored
14
.github/workflows/component-documentation.yml
vendored
|
@ -1,14 +0,0 @@
|
||||||
name: Iconica Standard Component Documentation Workflow
|
|
||||||
# Workflow Caller version: 1.0.0
|
|
||||||
|
|
||||||
on:
|
|
||||||
release:
|
|
||||||
types: [published]
|
|
||||||
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
call-iconica-component-documentation-workflow:
|
|
||||||
uses: Iconica-Development/.github/.github/workflows/component-documentation.yml@master
|
|
||||||
secrets: inherit
|
|
||||||
permissions: write-all
|
|
|
@ -4,12 +4,7 @@
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
/// Defines a character input configuration.
|
|
||||||
class InputCharacter {
|
class InputCharacter {
|
||||||
/// Creates an [InputCharacter] configuration.
|
|
||||||
///
|
|
||||||
/// The [keyboardType] parameter is required.
|
|
||||||
/// The [readOnly], [hint], and [formatter] parameters are optional.
|
|
||||||
const InputCharacter({
|
const InputCharacter({
|
||||||
required this.keyboardType,
|
required this.keyboardType,
|
||||||
this.readOnly = false,
|
this.readOnly = false,
|
||||||
|
@ -17,23 +12,12 @@ class InputCharacter {
|
||||||
this.formatter,
|
this.formatter,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// The type of keyboard to display for the input.
|
|
||||||
final TextInputType keyboardType;
|
final TextInputType keyboardType;
|
||||||
|
final CharacterFormatter? formatter;
|
||||||
/// A flag indicating whether the input is read-only.
|
|
||||||
final bool readOnly;
|
final bool readOnly;
|
||||||
|
|
||||||
/// The optional hint text displayed inside the input field.
|
|
||||||
final String hint;
|
final String hint;
|
||||||
|
|
||||||
/// The optional formatter function to format the input value.
|
|
||||||
final CharacterFormatter? formatter;
|
|
||||||
|
|
||||||
/// Formats the input value using the provided formatter function.
|
|
||||||
///
|
|
||||||
/// If no formatter is provided, the input value remains unchanged.
|
|
||||||
String format(String value) => formatter?.call(value) ?? value;
|
String format(String value) => formatter?.call(value) ?? value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Defines a function signature for formatting input characters.
|
|
||||||
typedef CharacterFormatter = String Function(String);
|
typedef CharacterFormatter = String Function(String);
|
||||||
|
|
|
@ -8,9 +8,7 @@ import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_single_character_input/src/input_character.dart';
|
import 'package:flutter_single_character_input/src/input_character.dart';
|
||||||
|
|
||||||
/// A StatefulWidget that represents a single character input.
|
|
||||||
class SingleCharacterInput extends StatefulWidget {
|
class SingleCharacterInput extends StatefulWidget {
|
||||||
/// Creates a SingleCharacterInput widget.
|
|
||||||
const SingleCharacterInput({
|
const SingleCharacterInput({
|
||||||
required this.characters,
|
required this.characters,
|
||||||
required this.onChanged,
|
required this.onChanged,
|
||||||
|
@ -24,8 +22,6 @@ class SingleCharacterInput extends StatefulWidget {
|
||||||
super.key,
|
super.key,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// A function that builds a custom input widget using
|
|
||||||
/// the provided context and input widgets.
|
|
||||||
final Widget Function(BuildContext context, List<Widget> inputs)?
|
final Widget Function(BuildContext context, List<Widget> inputs)?
|
||||||
buildCustomInput;
|
buildCustomInput;
|
||||||
|
|
||||||
|
@ -37,22 +33,14 @@ class SingleCharacterInput extends StatefulWidget {
|
||||||
// ignore: avoid_positional_boolean_parameters
|
// ignore: avoid_positional_boolean_parameters
|
||||||
final void Function(String value, bool isComplete) onChanged;
|
final void Function(String value, bool isComplete) onChanged;
|
||||||
|
|
||||||
/// The decoration to be applied to the input widget.
|
|
||||||
final InputDecoration? inputDecoration;
|
final InputDecoration? inputDecoration;
|
||||||
|
|
||||||
/// List of all character fields which are used to create inputs.
|
/// List of all character fields which are used to create inputs.
|
||||||
final List<InputCharacter> characters;
|
final List<InputCharacter> characters;
|
||||||
|
|
||||||
/// The alignment of the input text.
|
|
||||||
final TextAlign textAlign;
|
final TextAlign textAlign;
|
||||||
|
|
||||||
/// The alignment of the cursor.
|
|
||||||
final TextAlign cursorTextAlign;
|
final TextAlign cursorTextAlign;
|
||||||
|
|
||||||
/// The spacing between input fields.
|
|
||||||
final double spacing;
|
final double spacing;
|
||||||
|
|
||||||
/// The style of the input text.
|
|
||||||
final TextStyle? textStyle;
|
final TextStyle? textStyle;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
Loading…
Reference in a new issue