Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ jobs:
melos bootstrap

- name: Verify formatting
# Remove --line-length=100 when upgrading the min dart sdk to at least 3.7
run: melos exec dart format --output=none --set-exit-if-changed --line-length=100 .
run: melos exec dart format --output=none --set-exit-if-changed .

# Consider passing '--fatal-infos' for slightly stricter analysis.
- name: Run flutter analyze
Expand Down
171 changes: 92 additions & 79 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,16 +210,18 @@ Widget build(BuildContext context) {
),
),
items: items
.map((String item) => DropdownItem<String>(
value: item,
height: 40,
child: Text(
item,
style: const TextStyle(
fontSize: 14,
),
.map(
(String item) => DropdownItem<String>(
value: item,
height: 40,
child: Text(
item,
style: const TextStyle(
fontSize: 14,
),
))
),
),
)
.toList(),
valueListenable: valueListenable,
onChanged: (String? value) {
Expand Down Expand Up @@ -285,19 +287,21 @@ Widget build(BuildContext context) {
],
),
items: items
.map((String item) => DropdownItem<String>(
value: item,
height: 40,
child: Text(
item,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.white,
),
overflow: TextOverflow.ellipsis,
.map(
(String item) => DropdownItem<String>(
value: item,
height: 40,
child: Text(
item,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.white,
),
))
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
valueListenable: valueListenable,
onChanged: (value) {
Expand Down Expand Up @@ -376,19 +380,21 @@ Widget build(BuildContext context) {
),
),
items: items
.map((String item) => DropdownItem<String>(
value: item,
height: 40,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Text(
item,
style: const TextStyle(
fontSize: 14,
),
.map(
(String item) => DropdownItem<String>(
value: item,
height: 40,
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: Text(
item,
style: const TextStyle(
fontSize: 14,
),
),
))
),
),
)
.toList(),
dropdownSeparator: const DropdownSeparator(
height: 4,
Expand Down Expand Up @@ -502,22 +508,21 @@ Widget build(BuildContext context) {
return items.map(
(item) {
return ValueListenableBuilder<List<String>>(
valueListenable: multiValueListenable,
builder: (context, multiValue, _) {
return Container(
alignment: AlignmentDirectional.center,
child: Text(
multiValue
.where((item) => item != 'All')
.join(', '),
style: const TextStyle(
fontSize: 14,
overflow: TextOverflow.ellipsis,
),
maxLines: 1,
valueListenable: multiValueListenable,
builder: (context, multiValue, _) {
return Container(
alignment: AlignmentDirectional.center,
child: Text(
multiValue.where((item) => item != 'All').join(', '),
style: const TextStyle(
fontSize: 14,
overflow: TextOverflow.ellipsis,
),
);
});
maxLines: 1,
),
);
},
);
},
).toList();
},
Expand Down Expand Up @@ -576,16 +581,18 @@ Widget build(BuildContext context) {
),
),
items: items
.map((item) => DropdownItem(
value: item,
height: 40,
child: Text(
item,
style: const TextStyle(
fontSize: 14,
),
.map(
(item) => DropdownItem(
value: item,
height: 40,
child: Text(
item,
style: const TextStyle(
fontSize: 14,
),
))
),
),
)
.toList(),
valueListenable: valueListenable,
onChanged: (value) {
Expand Down Expand Up @@ -970,15 +977,17 @@ Widget build(BuildContext context) {
style: TextStyle(fontSize: 14),
),
items: genderItems
.map((item) => DropdownItem<String>(
value: item,
child: Text(
item,
style: const TextStyle(
fontSize: 14,
),
.map(
(item) => DropdownItem<String>(
value: item,
child: Text(
item,
style: const TextStyle(
fontSize: 14,
),
))
),
),
)
.toList(),
valueListenable: valueListenable,
validator: (value) {
Expand Down Expand Up @@ -1102,29 +1111,32 @@ class CustomDropdownButton2 extends StatelessWidget {
),
valueListenable: valueListenable,
items: dropdownItems
.map((String item) => DropdownItem<String>(
value: item,
height: itemHeight ?? 40,
child: Container(
alignment: valueAlignment,
child: Text(
item,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: const TextStyle(
fontSize: 14,
),
.map(
(String item) => DropdownItem<String>(
value: item,
height: itemHeight ?? 40,
child: Container(
alignment: valueAlignment,
child: Text(
item,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: const TextStyle(
fontSize: 14,
),
),
))
),
),
)
.toList(),
onChanged: onChanged,
selectedItemBuilder: selectedItemBuilder,
buttonStyleData: ButtonStyleData(
height: buttonHeight ?? 40,
width: buttonWidth ?? 140,
padding: buttonPadding ?? const EdgeInsets.only(left: 14, right: 14),
decoration: buttonDecoration ??
decoration:
buttonDecoration ??
BoxDecoration(
borderRadius: BorderRadius.circular(14),
border: Border.all(
Expand All @@ -1144,7 +1156,8 @@ class CustomDropdownButton2 extends StatelessWidget {
maxHeight: dropdownHeight ?? 200,
width: dropdownWidth ?? 140,
padding: dropdownPadding,
decoration: dropdownDecoration ??
decoration:
dropdownDecoration ??
BoxDecoration(
borderRadius: BorderRadius.circular(14),
),
Expand Down
2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ analyzer:
- "**/*.mocks.dart" # Mockito @GenerateMocks

formatter:
# Preserve trailing commas until Dart formatting improves
trailing_commas: preserve
page_width: 100

linter:
Expand Down
3 changes: 1 addition & 2 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ scripts:
description: Run `flutter analyze` for all packages.

format:
# Remove --line-length=100 when upgrading the min dart sdk to at least 3.7
run: melos exec dart format --line-length=100 .
run: melos exec dart format .
description: Run `dart format` for all packages.

test:select:
Expand Down
34 changes: 19 additions & 15 deletions packages/dropdown_button2/example/custom_dropdown_button2.dart
Original file line number Diff line number Diff line change
Expand Up @@ -79,29 +79,32 @@ class CustomDropdownButton2 extends StatelessWidget {
),
valueListenable: valueListenable,
items: dropdownItems
.map((String item) => DropdownItem<String>(
value: item,
height: itemHeight ?? 40,
child: Container(
alignment: valueAlignment,
child: Text(
item,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: const TextStyle(
fontSize: 14,
),
.map(
(String item) => DropdownItem<String>(
value: item,
height: itemHeight ?? 40,
child: Container(
alignment: valueAlignment,
child: Text(
item,
overflow: TextOverflow.ellipsis,
maxLines: 1,
style: const TextStyle(
fontSize: 14,
),
),
))
),
),
)
.toList(),
onChanged: onChanged,
selectedItemBuilder: selectedItemBuilder,
buttonStyleData: ButtonStyleData(
height: buttonHeight ?? 40,
width: buttonWidth ?? 140,
padding: buttonPadding ?? const EdgeInsets.only(left: 14, right: 14),
decoration: buttonDecoration ??
decoration:
buttonDecoration ??
BoxDecoration(
borderRadius: BorderRadius.circular(14),
border: Border.all(
Expand All @@ -121,7 +124,8 @@ class CustomDropdownButton2 extends StatelessWidget {
maxHeight: dropdownHeight ?? 200,
width: dropdownWidth ?? 140,
padding: dropdownPadding,
decoration: dropdownDecoration ??
decoration:
dropdownDecoration ??
BoxDecoration(
borderRadius: BorderRadius.circular(14),
),
Expand Down
26 changes: 14 additions & 12 deletions packages/dropdown_button2/example/example.dart
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,21 @@ class _MyHomePageState extends State<MyHomePage> {
],
),
items: items
.map((String item) => DropdownItem<String>(
value: item,
height: 40,
child: Text(
item,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.white,
),
overflow: TextOverflow.ellipsis,
.map(
(String item) => DropdownItem<String>(
value: item,
height: 40,
child: Text(
item,
style: const TextStyle(
fontSize: 14,
fontWeight: FontWeight.bold,
color: Colors.white,
),
))
overflow: TextOverflow.ellipsis,
),
),
)
.toList(),
valueListenable: valueListenable,
onChanged: (value) {
Expand Down
Loading
Loading