@@ -15,21 +15,41 @@ namespace Cirrious.FluentLayouts.Touch
1515{
1616 public static class AdvancedFluentLayoutExtensions
1717 {
18- const float DefaultMargin = 0 ;
19- const float DefaultScale = 1 ;
18+ const float DefaultMargin = 0 ;
19+ const float DefaultScale = 1 ;
2020
2121 public static FluentLayout AtTopOf ( this UIView view , UIView parentView , nfloat ? margin = null ) =>
22- view . Top ( ) . EqualTo ( ) . TopOf ( parentView ) . Plus ( margin . GetValueOrDefault ( DefaultMargin ) ) ;
22+ view . Top ( ) . EqualTo ( ) . TopOf ( parentView ) . Plus ( margin . GetValueOrDefault ( DefaultMargin ) ) ;
23+
24+ public static FluentLayout AtTopOfWithSafeArea ( this UIView view , UIView parentView , nfloat ? margin = null ) =>
25+ UIDevice . CurrentDevice . CheckSystemVersion ( 11 , 0 )
26+ ? view . Top ( ) . EqualTo ( ) . TopOf ( parentView . SafeAreaLayoutGuide ) . Plus ( margin . GetValueOrDefault ( DefaultMargin ) )
27+ : view . AtTopOf ( parentView , margin ) ;
2328
2429 public static FluentLayout AtLeftOf ( this UIView view , UIView parentView , nfloat ? margin = null ) =>
2530 view . Left ( ) . EqualTo ( ) . LeftOf ( parentView ) . Plus ( margin . GetValueOrDefault ( DefaultMargin ) ) ;
2631
32+ public static FluentLayout AtLeftOfWithSafeArea ( this UIView view , UIView parentView , nfloat ? margin = null ) =>
33+ UIDevice . CurrentDevice . CheckSystemVersion ( 11 , 0 )
34+ ? view . Left ( ) . EqualTo ( ) . LeftOf ( parentView . SafeAreaLayoutGuide ) . Plus ( margin . GetValueOrDefault ( DefaultMargin ) )
35+ : view . AtLeftOf ( parentView , margin ) ;
36+
2737 public static FluentLayout AtRightOf ( this UIView view , UIView parentView , nfloat ? margin = null ) =>
2838 view . Right ( ) . EqualTo ( ) . RightOf ( parentView ) . Minus ( margin . GetValueOrDefault ( DefaultMargin ) ) ;
2939
40+ public static FluentLayout AtRightOfWithSafeArea ( this UIView view , UIView parentView , nfloat ? margin = null ) =>
41+ UIDevice . CurrentDevice . CheckSystemVersion ( 11 , 0 )
42+ ? view . Right ( ) . EqualTo ( ) . RightOf ( parentView . SafeAreaLayoutGuide ) . Minus ( margin . GetValueOrDefault ( DefaultMargin ) )
43+ : view . AtRightOf ( parentView , margin ) ;
44+
3045 public static FluentLayout AtBottomOf ( this UIView view , UIView parentView , nfloat ? margin = null ) =>
3146 view . Bottom ( ) . EqualTo ( ) . BottomOf ( parentView ) . Minus ( margin . GetValueOrDefault ( DefaultMargin ) ) ;
3247
48+ public static FluentLayout AtBottomOfWithSafeArea ( this UIView view , UIView parentView , nfloat ? margin = null ) =>
49+ UIDevice . CurrentDevice . CheckSystemVersion ( 11 , 0 )
50+ ? view . Bottom ( ) . EqualTo ( ) . BottomOf ( parentView . SafeAreaLayoutGuide ) . Minus ( margin . GetValueOrDefault ( DefaultMargin ) )
51+ : view . AtBottomOf ( parentView , margin ) ;
52+
3353 public static FluentLayout AtLeadingOf ( this UIView view , UIView parentView , nfloat ? margin = null ) =>
3454 view . Leading ( ) . EqualTo ( ) . LeadingOf ( parentView ) . Plus ( margin . GetValueOrDefault ( DefaultMargin ) ) ;
3555
0 commit comments