Compare commits

...

7 commits

Author SHA1 Message Date
Freek van de Ven
f32ad75235
Merge pull request #6 from Iconica-Development/doc--improve-documentation
doc: create documentation for files
2024-03-05 15:58:37 +01:00
Vick Top
c7dd72a245 doc: create documentation for files 2024-03-05 15:20:14 +01:00
Freek van de Ven
c26d9de2ca
Merge pull request #5 from Iconica-Development/update-component-documentation-workflow-correct
Add component-documentation.yml correct
2024-02-14 08:01:01 +01:00
Vick Top
8e458231f7 feat(documentation): Create component-documentation.yml workflow file 2024-02-13 13:34:12 +01:00
Vick Top
00450d9e06 chore: Remove old component-documentation.yml 2024-02-13 13:34:12 +01:00
Freek van de Ven
15aacb0809
Merge pull request #4 from Iconica-Development/update-component-documentation-workflow
Add component-documentation.yml
2024-02-12 20:10:31 +01:00
Vick Top
ef4a966e33 feat(documentation): Create component-documentation.yml workflow file 2024-02-12 19:05:36 +01:00
3 changed files with 43 additions and 1 deletions

View file

@ -0,0 +1,14 @@
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

View file

@ -4,7 +4,12 @@
import 'package:flutter/material.dart';
/// Defines a character input configuration.
class InputCharacter {
/// Creates an [InputCharacter] configuration.
///
/// The [keyboardType] parameter is required.
/// The [readOnly], [hint], and [formatter] parameters are optional.
const InputCharacter({
required this.keyboardType,
this.readOnly = false,
@ -12,12 +17,23 @@ class InputCharacter {
this.formatter,
});
/// The type of keyboard to display for the input.
final TextInputType keyboardType;
final CharacterFormatter? formatter;
/// A flag indicating whether the input is read-only.
final bool readOnly;
/// The optional hint text displayed inside the input field.
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;
}
/// Defines a function signature for formatting input characters.
typedef CharacterFormatter = String Function(String);

View file

@ -8,7 +8,9 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_single_character_input/src/input_character.dart';
/// A StatefulWidget that represents a single character input.
class SingleCharacterInput extends StatefulWidget {
/// Creates a SingleCharacterInput widget.
const SingleCharacterInput({
required this.characters,
required this.onChanged,
@ -22,6 +24,8 @@ class SingleCharacterInput extends StatefulWidget {
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)?
buildCustomInput;
@ -33,14 +37,22 @@ class SingleCharacterInput extends StatefulWidget {
// ignore: avoid_positional_boolean_parameters
final void Function(String value, bool isComplete) onChanged;
/// The decoration to be applied to the input widget.
final InputDecoration? inputDecoration;
/// List of all character fields which are used to create inputs.
final List<InputCharacter> characters;
/// The alignment of the input text.
final TextAlign textAlign;
/// The alignment of the cursor.
final TextAlign cursorTextAlign;
/// The spacing between input fields.
final double spacing;
/// The style of the input text.
final TextStyle? textStyle;
@override