84 lines
2.7 KiB
Dart
84 lines
2.7 KiB
Dart
import 'package:component_library/component_library.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:storybook_flutter/storybook_flutter.dart';
|
|
|
|
List<Story> getStories(GolekThemeData theme) {
|
|
return [
|
|
Story(
|
|
name: 'Plain Input Field',
|
|
section: 'Form Input',
|
|
builder: (_, k) => InputField(
|
|
errorMessage: k.text(label: 'errorMessage'),
|
|
placeholder: k.text(
|
|
label: 'placeholder',
|
|
initial: 'Placeholder',
|
|
),
|
|
label: k.text(label: 'Label', initial: 'Label'),
|
|
obscureText: k.boolean(label: 'obscureText', initial: false),
|
|
textInputType: k.options<TextInputType>(
|
|
label: 'textInputType',
|
|
initial: TextInputType.text,
|
|
options: [
|
|
const Option('Email', TextInputType.emailAddress),
|
|
const Option('Number', TextInputType.number),
|
|
const Option('Date Time', TextInputType.datetime),
|
|
]),
|
|
inputFormatters: k.options<List<TextInputFormatter>>(
|
|
label: 'inputFormatters',
|
|
initial: [],
|
|
options: [
|
|
Option(
|
|
'Maximum Text Input Formatter',
|
|
[LengthLimitingTextInputFormatter(12)],
|
|
),
|
|
Option(
|
|
'Regex Filter Text Input Formatter',
|
|
[FilteringTextInputFormatter.allow(RegExp(r'^[2-9][0-9]*'))],
|
|
),
|
|
],
|
|
),
|
|
isDisabled: k.boolean(
|
|
label: 'disabled',
|
|
initial: false,
|
|
),
|
|
isTouched: k.boolean(
|
|
label: 'touched',
|
|
initial: false,
|
|
),
|
|
isError: k.boolean(
|
|
label: 'error',
|
|
initial: false,
|
|
),
|
|
),
|
|
),
|
|
Story(
|
|
name: 'Plain Input File',
|
|
section: 'Form Input',
|
|
builder: (_, k) => InputFile(
|
|
allowMultiple: k.boolean(label: 'allowMultiple', initial: false),
|
|
onChange: (files) {},
|
|
files: [],
|
|
isTouched: k.boolean(label: 'isTouched', initial: false),
|
|
isError: k.boolean(label: 'isError', initial: false),
|
|
errorMessage:
|
|
k.text(label: 'messageError', initial: 'Ini pesan message error'),
|
|
uploadButtonLabel: k.text(
|
|
label: 'uploadButtonLabel',
|
|
initial: 'Upload Foto\u{002A}',
|
|
),
|
|
descriptionLabel: k.text(
|
|
label: 'descriptionLabel',
|
|
initial: 'Maks. 1 Foto, 1 Foto Maks. 2 mb',
|
|
),
|
|
guidanceLabel: k.text(
|
|
label: 'guidanceLabel',
|
|
initial:
|
|
'Tingkatkan kepercayaan partner bisnis dengan mengunggah foto tentang usaha'
|
|
' anda (Contoh foto kantor, armada karyawan dll.)',
|
|
),
|
|
),
|
|
),
|
|
];
|
|
}
|