-
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.
* Create dropdown * Add sizes * create stoyrybook and add size * Fix errrs and respond to comments * Fix issues * [automated commit] lint format and import sort * Alter isLarge * Fix spacing * [automated commit] lint format and import sort * Alter leading styles * [automated commit] lint format and import sort --------- Co-authored-by: Osman <AO3856@zebra.com> Co-authored-by: github-actions <github-actions@github.com>
- Loading branch information
1 parent
ac996d9
commit 5329362
Showing
7 changed files
with
597 additions
and
25 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,56 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:zeta_example/widgets.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
class DropdownExample extends StatefulWidget { | ||
static const String name = "Dropdown"; | ||
const DropdownExample({super.key}); | ||
|
||
@override | ||
State<DropdownExample> createState() => _DropdownExampleState(); | ||
} | ||
|
||
class _DropdownExampleState extends State<DropdownExample> { | ||
ZetaDropdownItem selectedItem = ZetaDropdownItem( | ||
value: "Item 1", | ||
leadingIcon: Icon(ZetaIcons.star_round), | ||
); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ExampleScaffold( | ||
name: "Dropdown", | ||
child: Center( | ||
child: SingleChildScrollView( | ||
child: SizedBox( | ||
width: 320, | ||
child: Column(children: [ | ||
ZetaDropdown( | ||
leadingType: LeadingStyle.checkbox, | ||
onChange: (value) { | ||
setState(() { | ||
selectedItem = value; | ||
}); | ||
}, | ||
selectedItem: selectedItem, | ||
items: [ | ||
ZetaDropdownItem( | ||
value: "Item 1", | ||
leadingIcon: Icon(ZetaIcons.star_round), | ||
), | ||
ZetaDropdownItem( | ||
value: "Item 2", | ||
leadingIcon: Icon(ZetaIcons.star_half_round), | ||
), | ||
ZetaDropdownItem( | ||
value: "Item 3", | ||
) | ||
], | ||
), | ||
Text('Selected item : ${selectedItem.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
70 changes: 70 additions & 0 deletions
70
example/widgetbook/pages/components/dropdown_widgetbook.dart
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,70 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:widgetbook/widgetbook.dart'; | ||
import 'package:zeta_flutter/zeta_flutter.dart'; | ||
|
||
import '../../test/test_components.dart'; | ||
|
||
Widget dropdownUseCase(BuildContext context) => WidgetbookTestWidget( | ||
widget: Center( | ||
child: DropdownExample(context), | ||
), | ||
); | ||
|
||
class DropdownExample extends StatefulWidget { | ||
const DropdownExample(this.c); | ||
final BuildContext c; | ||
|
||
@override | ||
State<DropdownExample> createState() => _DropdownExampleState(); | ||
} | ||
|
||
class _DropdownExampleState extends State<DropdownExample> { | ||
List<ZetaDropdownItem> _children = [ | ||
ZetaDropdownItem( | ||
value: "Item 1", | ||
leadingIcon: Icon(ZetaIcons.star_round), | ||
), | ||
ZetaDropdownItem( | ||
value: "Item 2", | ||
leadingIcon: Icon(ZetaIcons.star_half_round), | ||
), | ||
ZetaDropdownItem( | ||
value: "Item 3", | ||
) | ||
]; | ||
|
||
late ZetaDropdownItem selectedItem = ZetaDropdownItem( | ||
value: "Item 1", | ||
leadingIcon: Icon(ZetaIcons.star_round), | ||
); | ||
|
||
@override | ||
Widget build(BuildContext _) { | ||
return SingleChildScrollView( | ||
child: SizedBox( | ||
width: double.infinity, | ||
child: Column(children: [ | ||
ZetaDropdown( | ||
leadingType: widget.c.knobs.list( | ||
label: "Checkbox type", | ||
options: [ | ||
LeadingStyle.none, | ||
LeadingStyle.checkbox, | ||
LeadingStyle.radio, | ||
], | ||
), | ||
onChange: (value) { | ||
setState(() { | ||
selectedItem = value; | ||
}); | ||
}, | ||
selectedItem: selectedItem, | ||
items: _children, | ||
rounded: widget.c.knobs.boolean(label: "Rounded"), | ||
isMinimized: widget.c.knobs.boolean(label: "Minimized"), | ||
), | ||
Text('Selected item : ${selectedItem.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
Oops, something went wrong.