@@ -5,6 +5,7 @@ use iced::widget::{
55} ;
66use iced:: { executor, theme, Alignment , Color } ;
77use iced:: { Application , Command , Element , Length , Settings , Theme } ;
8+
89use once_cell:: sync:: Lazy ;
910
1011static SCROLLABLE_ID : Lazy < scrollable:: Id > = Lazy :: new ( scrollable:: Id :: unique) ;
@@ -199,12 +200,12 @@ impl Application for ScrollableDemo {
199200 . spacing ( 40 ) ,
200201 )
201202 . height ( Length :: Fill )
202- . vertical_scroll (
203+ . direction ( scrollable :: Direction :: Vertical (
203204 Properties :: new ( )
204205 . width ( self . scrollbar_width )
205206 . margin ( self . scrollbar_margin )
206207 . scroller_width ( self . scroller_width ) ,
207- )
208+ ) )
208209 . id ( SCROLLABLE_ID . clone ( ) )
209210 . on_scroll ( Message :: Scrolled ) ,
210211 Direction :: Horizontal => scrollable (
@@ -223,12 +224,12 @@ impl Application for ScrollableDemo {
223224 . spacing ( 40 ) ,
224225 )
225226 . height ( Length :: Fill )
226- . horizontal_scroll (
227+ . direction ( scrollable :: Direction :: Horizontal (
227228 Properties :: new ( )
228229 . width ( self . scrollbar_width )
229230 . margin ( self . scrollbar_margin )
230231 . scroller_width ( self . scroller_width ) ,
231- )
232+ ) )
232233 . style ( theme:: Scrollable :: custom ( ScrollbarCustomStyle ) )
233234 . id ( SCROLLABLE_ID . clone ( ) )
234235 . on_scroll ( Message :: Scrolled ) ,
@@ -264,18 +265,17 @@ impl Application for ScrollableDemo {
264265 . spacing ( 40 ) ,
265266 )
266267 . height ( Length :: Fill )
267- . vertical_scroll (
268- Properties :: new ( )
269- . width ( self . scrollbar_width )
270- . margin ( self . scrollbar_margin )
271- . scroller_width ( self . scroller_width ) ,
272- )
273- . horizontal_scroll (
274- Properties :: new ( )
268+ . direction ( {
269+ let properties = Properties :: new ( )
275270 . width ( self . scrollbar_width )
276271 . margin ( self . scrollbar_margin )
277- . scroller_width ( self . scroller_width ) ,
278- )
272+ . scroller_width ( self . scroller_width ) ;
273+
274+ scrollable:: Direction :: Both {
275+ horizontal : properties,
276+ vertical : properties,
277+ }
278+ } )
279279 . style ( theme:: Scrollable :: Custom ( Box :: new (
280280 ScrollbarCustomStyle ,
281281 ) ) )
0 commit comments