@@ -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 ( 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 ( theme:: spacing ( ) . space_xxs )
210+ . class ( theme:: Container :: Dropdown )
228211 . into ( )
229212}
230213
@@ -236,7 +219,8 @@ 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)
223+ . position ( widget:: popover:: Position :: Bottom )
240224 . popup ( popover_menu ( id) )
241225 . on_close ( Message :: ExpandInputSourcePopover ( None ) )
242226 . into ( )
@@ -713,7 +697,7 @@ fn input_sources() -> Section<crate::pages::Message> {
713697 . on_press ( Message :: ShowInputSourcesContext ) ;
714698
715699 widget:: column:: with_capacity ( 2 )
716- . spacing ( cosmic :: theme:: spacing ( ) . space_xxs )
700+ . spacing ( theme:: spacing ( ) . space_xxs )
717701 . push ( section)
718702 . push (
719703 widget:: container ( add_input_source)
@@ -816,7 +800,7 @@ fn keyboard_typing_assist() -> Section<crate::pages::Message> {
816800
817801 row:: with_capacity ( 3 )
818802 . align_y ( Alignment :: Center )
819- . spacing ( cosmic :: theme:: spacing ( ) . space_s )
803+ . spacing ( theme:: spacing ( ) . space_s )
820804 . push ( widget:: text:: body ( & descriptions[ short] ) )
821805 . push ( delay_slider)
822806 . push ( widget:: text:: body ( & descriptions[ long] ) )
@@ -836,7 +820,7 @@ fn keyboard_typing_assist() -> Section<crate::pages::Message> {
836820
837821 row:: with_capacity ( 3 )
838822 . align_y ( Alignment :: Center )
839- . spacing ( cosmic :: theme:: spacing ( ) . space_s )
823+ . spacing ( theme:: spacing ( ) . space_s )
840824 . push ( widget:: text:: body ( & descriptions[ slow] ) )
841825 . push ( rate_slider)
842826 . push ( widget:: text:: body ( & descriptions[ fast] ) )
0 commit comments