Skip to content

Instantly share code, notes, and snippets.

@atreeon
Last active February 21, 2024 13:16
Show Gist options
  • Save atreeon/35c3d089d76887a3b5e8ffc0c45a4766 to your computer and use it in GitHub Desktop.
Save atreeon/35c3d089d76887a3b5e8ffc0c45a4766 to your computer and use it in GitHub Desktop.
DropdownButton - padding size between items
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: DropdownButton<String>(
value: 'one',
isDense: true,
onChanged: (String? value) {
print('on change');
},
items: ['one', 'two', 'three'].map<DropdownMenuItem<String>>(
(value) {
return DropdownMenuItem<String>(
value: value,
child: Text(
value,
style: TextStyle(fontSize: 8),
));
},
).toList(),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment