Last active
February 21, 2024 13:16
-
-
Save atreeon/35c3d089d76887a3b5e8ffc0c45a4766 to your computer and use it in GitHub Desktop.
DropdownButton - padding size between items
This file contains hidden or 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
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