@@ -9,8 +9,7 @@ use cosmic::{
99 Apply , Element , Task ,
1010 app:: { ContextDrawer , context_drawer} ,
1111 cosmic_config:: { self , ConfigSet } ,
12- iced:: { Alignment , Color , Length } ,
13- iced_core:: Border ,
12+ iced:: { Alignment , Length } ,
1413 theme,
1514 widget:: { self , ListColumn , button, container, icon, radio, row, settings} ,
1615} ;
@@ -166,23 +165,19 @@ fn popover_menu_row(
166165 label : String ,
167166 message : impl Fn ( DefaultKey ) -> SourceContext + ' static ,
168167) -> cosmic:: Element < ' static , Message > {
168+ let spacing = theme:: spacing ( ) ;
169169 widget:: text:: body ( label)
170- . apply ( widget:: container)
171- . class ( cosmic:: theme:: Container :: custom ( |theme| {
172- widget:: container:: Style {
173- background : None ,
174- ..container:: Catalog :: style ( theme, & cosmic:: theme:: Container :: List )
175- }
176- } ) )
170+ . align_y ( Alignment :: Center )
177171 . apply ( button:: custom)
178- . on_press ( ( ) )
179- . class ( theme:: Button :: Transparent )
172+ . padding ( [ spacing. space_xxxs , spacing. space_xs ] )
173+ . width ( Length :: Fill )
174+ . class ( theme:: Button :: MenuItem )
175+ . on_press ( Message :: SourceContext ( message ( id) ) )
180176 . apply ( Element :: from)
181- . map ( move |( ) | Message :: SourceContext ( message ( id) ) )
182177}
183178
184179fn popover_menu ( id : DefaultKey ) -> cosmic:: Element < ' static , Message > {
185- widget:: column:: with_children ( vec ! [
180+ widget:: column:: with_children ( [
186181 popover_menu_row (
187182 id,
188183 fl ! ( "keyboard-sources" , "move-up" ) ,
@@ -193,7 +188,10 @@ fn popover_menu(id: DefaultKey) -> cosmic::Element<'static, Message> {
193188 fl ! ( "keyboard-sources" , "move-down" ) ,
194189 SourceContext :: MoveDown ,
195190 ) ,
196- cosmic:: widget:: divider:: horizontal:: default ( ) . into( ) ,
191+ widget:: divider:: horizontal:: default ( )
192+ . apply ( widget:: container)
193+ . padding ( [ 0 , 8 ] )
194+ . into ( ) ,
197195 popover_menu_row (
198196 id,
199197 fl ! ( "keyboard-sources" , "settings" ) ,
@@ -206,25 +204,10 @@ fn popover_menu(id: DefaultKey) -> cosmic::Element<'static, Message> {
206204 ) ,
207205 popover_menu_row ( id, fl ! ( "keyboard-sources" , "remove" ) , SourceContext :: Remove ) ,
208206 ] )
209- . padding ( [ 2 , 8 ] )
210- . width ( Length :: Shrink )
211- . height ( Length :: Shrink )
212- . apply ( cosmic:: widget:: container)
213- . class ( cosmic:: theme:: Container :: custom ( |theme| {
214- let cosmic = theme. cosmic ( ) ;
215- let background = & cosmic. background ;
216- container:: Style {
217- icon_color : Some ( background. on . into ( ) ) ,
218- text_color : Some ( background. on . into ( ) ) ,
219- background : Some ( Color :: from ( background. base ) . into ( ) ) ,
220- border : Border {
221- color : background. component . divider . into ( ) ,
222- width : 1.0 ,
223- radius : cosmic. corner_radii . radius_s . into ( ) ,
224- } ,
225- shadow : Default :: default ( ) ,
226- }
227- } ) )
207+ . width ( Length :: Fixed ( 200.0 ) )
208+ . apply ( widget:: container)
209+ . padding ( 1 )
210+ . class ( cosmic:: style:: Container :: Dropdown )
228211 . into ( )
229212}
230213
@@ -236,8 +219,9 @@ fn popover_button(id: DefaultKey, expanded: bool) -> cosmic::Element<'static, Me
236219 . on_press ( on_press) ;
237220
238221 if expanded {
239- cosmic :: widget:: popover ( button)
222+ widget:: popover ( button)
240223 . popup ( popover_menu ( id) )
224+ . position ( widget:: popover:: Position :: Bottom )
241225 . on_close ( Message :: ExpandInputSourcePopover ( None ) )
242226 . into ( )
243227 } else {
0 commit comments