-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* time input * sizes * refactor as form input * lint stuff * refactoring with input mask * docs, fixed sizes * widget book
- Loading branch information
1 parent
bbfadac
commit fb7b629
Showing
9 changed files
with
608 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:zeta_example/widgets.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
class TimeInputExample extends StatelessWidget { | ||
static const name = 'TimeInput'; | ||
|
||
const TimeInputExample({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
final formKey = GlobalKey<FormState>(); | ||
return ExampleScaffold( | ||
name: 'Time Input', | ||
child: Center( | ||
child: Padding( | ||
padding: const EdgeInsets.all(24), | ||
child: SingleChildScrollView( | ||
child: Column( | ||
mainAxisSize: MainAxisSize.min, | ||
children: [ | ||
Form( | ||
key: formKey, | ||
child: Column( | ||
children: [ | ||
ZetaButton( | ||
label: 'Validate inputs', | ||
onPressed: () => print(formKey.currentState?.validate()), | ||
), | ||
ZetaTimeInput( | ||
label: 'Large', | ||
hint: 'Default hint text', | ||
onChange: (value) => print(value), | ||
errorText: 'Oops! Error hint text', | ||
size: ZetaWidgetSize.large, | ||
), | ||
ZetaTimeInput( | ||
label: 'Medium', | ||
hint: 'Default hint text', | ||
onChange: (value) => print(value), | ||
errorText: 'Oops! Error hint text', | ||
size: ZetaWidgetSize.medium, | ||
), | ||
ZetaTimeInput( | ||
label: 'Small', | ||
hint: 'Default hint text', | ||
onChange: (value) => print(value), | ||
errorText: 'Oops! Error hint text', | ||
size: ZetaWidgetSize.small, | ||
), | ||
].divide(const SizedBox(height: 12)).toList(), | ||
), | ||
), | ||
const SizedBox( | ||
height: 48, | ||
), | ||
ZetaTimeInput(label: '12 Hr Time Picker', use12Hr: true), | ||
ZetaTimeInput(label: 'Disabled Time Picker', disabled: true, hint: 'Disabled time picker'), | ||
ZetaTimeInput(label: 'Sharp Time Picker', rounded: false), | ||
].divide(const SizedBox(height: 12)).toList(), | ||
), | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
import '../../test/test_components.dart'; | ||
|
||
Widget timeInputUseCase(BuildContext context) { | ||
String? _errorText; | ||
|
||
return WidgetbookTestWidget( | ||
widget: StatefulBuilder( | ||
builder: (context, setState) { | ||
final label = context.knobs.string( | ||
label: 'Label', | ||
initialValue: 'Label', | ||
); | ||
final errorText = context.knobs.string( | ||
label: 'Error message', | ||
initialValue: 'Oops! Error hint text', | ||
); | ||
final hintText = context.knobs.string( | ||
label: 'Hint', | ||
initialValue: 'Default hint text', | ||
); | ||
final rounded = context.knobs.boolean(label: 'Rounded', initialValue: true); | ||
final disabled = context.knobs.boolean(label: 'Disabled', initialValue: false); | ||
final size = context.knobs.list<ZetaWidgetSize>( | ||
label: 'Size', | ||
options: ZetaWidgetSize.values, | ||
labelBuilder: (size) => size.name, | ||
); | ||
|
||
return Padding( | ||
padding: const EdgeInsets.all(ZetaSpacing.x5), | ||
child: ZetaTimeInput( | ||
size: size, | ||
rounded: rounded, | ||
disabled: disabled, | ||
label: label, | ||
hint: hintText, | ||
errorText: _errorText ?? errorText, | ||
onChange: (value) {}, | ||
), | ||
); | ||
}, | ||
), | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.