@@ -40,62 +40,68 @@ class LanguageSelectionButton extends ConsumerWidget {
4040
4141 final menuController = MenuController ();
4242 return MenuAnchor (
43- controller: menuController,
44- builder:
45- (BuildContext context, MenuController controller, Widget ? child) {
46- return IconButton (
47- onPressed: () {
48- if (controller.isOpen) {
49- controller.close ();
50- } else {
51- controller.open ();
52- }
53- },
54- icon: const Icon (Icons .translate),
55- tooltip: 'Language selection' ,
56- );
57- },
58- menuChildren: [
59- Padding (
60- padding: const EdgeInsets .fromLTRB (10 , 0 , 10 , 0 ),
61- child: Column (
62- children: [
63- Text (context.l10n.languageSelectionHeader),
64- // Split list into two columns if we have many languages
65- // TODO improve decision on when to make two columns
66- // TODO better 2-column design for odd numbers of languages
67- menuItems.length > 10
68- ? Row (
69- mainAxisSize: MainAxisSize .min,
70- children: [
71- Flexible (
72- fit: FlexFit .loose,
73- child: Column (
74- children:
75- menuItems.sublist (0 , menuItems.length ~ / 2 ),
76- ),
77- ),
78- Flexible (
79- fit: FlexFit .loose,
80- child: Column (
81- children:
82- menuItems.sublist (menuItems.length ~ / 2 )),
83- )
84- ],
43+ style: MenuStyle (
44+ maximumSize: WidgetStatePropertyAll (
45+ Size (400 , 500 ),
46+ ),
47+ ),
48+ controller: menuController,
49+ builder:
50+ (BuildContext context, MenuController controller, Widget ? child) {
51+ return IconButton (
52+ onPressed: () {
53+ if (controller.isOpen) {
54+ controller.close ();
55+ } else {
56+ controller.open ();
57+ }
58+ },
59+ icon: const Icon (Icons .translate),
60+ tooltip: 'Language selection' ,
61+ );
62+ },
63+ menuChildren: [
64+ Padding (
65+ padding: const EdgeInsets .fromLTRB (10 , 0 , 10 , 0 ),
66+ child: Column (
67+ children: [
68+ Text (context.l10n.languageSelectionHeader),
69+ // Split list into two columns if we have many languages
70+ // TODO improve decision on when to make two columns
71+ // TODO better 2-column design for odd numbers of languages
72+ menuItems.length > 10
73+ ? Row (
74+ children: [
75+ Flexible (
76+ fit: FlexFit .loose,
77+ child: Column (
78+ children:
79+ menuItems.sublist (0 , menuItems.length ~ / 2 ),
80+ ),
81+ ),
82+ Flexible (
83+ fit: FlexFit .loose,
84+ child: Column (
85+ children:
86+ menuItems.sublist (menuItems.length ~ / 2 )),
8587 )
86- : Column (children: menuItems),
87- const Divider (),
88- ListTile (
89- dense: true ,
90- title: Text (context.l10n.manageLanguages),
91- leading: const Icon (Icons .settings),
92- onTap: () {
93- menuController.close ();
94- Navigator .pushNamed (context, '/settings' );
95- },
96- ),
97- ],
98- ))
99- ]);
88+ ],
89+ )
90+ : Column (children: menuItems),
91+ const Divider (),
92+ ListTile (
93+ dense: true ,
94+ title: Text (context.l10n.manageLanguages),
95+ leading: const Icon (Icons .settings),
96+ onTap: () {
97+ menuController.close ();
98+ Navigator .pushNamed (context, '/settings' );
99+ },
100+ ),
101+ ],
102+ ),
103+ ),
104+ ],
105+ );
100106 }
101107}
0 commit comments