@@ -431,19 +431,27 @@ impl<'a> WidgetBuilder<'a> {
431
431
let x = match self . data . width_from {
432
432
WidthRelative :: Children => raw. x , // this will be added to after children are layed out
433
433
WidthRelative :: Normal => raw. x ,
434
- WidthRelative :: Parent => raw. x + parent. size . x - parent. border . horizontal ( ) ,
434
+ WidthRelative :: Parent | WidthRelative :: ParentFill => raw. x + parent. size . x - parent. border . horizontal ( ) ,
435
435
WidthRelative :: Text => raw. x + self . calculate_single_line_text_width ( ) + 2.0 * widget. border . horizontal ( ) ,
436
436
} ;
437
+
437
438
let y = match self . data . height_from {
438
439
HeightRelative :: Children => raw. y , // this will be added to after children are layed out
439
440
HeightRelative :: Normal => raw. y ,
440
- HeightRelative :: Parent => raw. y + parent. size . y - parent. border . vertical ( ) ,
441
+ HeightRelative :: Parent | HeightRelative :: ParentFill => raw. y + parent. size . y - parent. border . vertical ( ) ,
441
442
HeightRelative :: FontLine => raw. y + widget. font . map_or ( 0.0 , |sum| sum. line_height ) + widget. border . vertical ( ) ,
442
443
} ;
443
- let self_size = Point { x, y } + state_resize;
444
+ let mut self_size = Point { x, y } + state_resize;
444
445
445
446
let pos = pos ( parent, self . data . raw_pos , self_size, self . data . align ) ;
446
447
448
+ if let HeightRelative :: ParentFill = self . data . height_from {
449
+ self_size. y -= pos. y - parent. pos . y ;
450
+ }
451
+ if let WidthRelative :: ParentFill = self . data . width_from {
452
+ self_size. x -= pos. x - parent. pos . x ;
453
+ }
454
+
447
455
self . widget . pos = pos + state_moved;
448
456
self . widget . size = self_size;
449
457
self . data . recalc_pos_size = false ;
0 commit comments