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 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( 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>( 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: 'Tingkatkan kepercayaan partner bisnis dengan mengunggah foto tentang usaha' ' anda (Contoh foto kantor, armada karyawan dll.)', ), guidanceLabel: k.text( label: 'guidanceLabel', initial: 'Maks. 1 Foto, 1 Foto Maks. 2 mb', ), ), ), Story( name: 'Plain Combo Box', section: 'Form Input', builder: (_, kb) { return ComboBoxField( label: 'Label', items: const [ DropdownMenuItem(child: Text('Budi'), value: 'Budi'), DropdownMenuItem(child: Text('Bakti'), value: 'Bakti'), DropdownMenuItem(child: Text('Riyanto'), value: 'Riyanto'), ], placeholder: 'Ini placeholder', onChangeComboBox: (value) { print(value); }, ); }, ), Story.simple( name: 'Autocomplete Plain', child: SelectOption( placeholder: 'Ini Placeholder', suggestions: { 'Guru': 'guru', 'Teka': 'teka' }, label: 'Ini Label', ), ), ]; }