44
55
66$mat-list-side-padding : 16px ;
7+ $mat-list-icon-padding : 4px ;
78$mat-list-avatar-size : 40px ;
89
910// Normal list variables
@@ -27,7 +28,18 @@ $mat-dense-three-line-height: 76px;
2728$mat-dense-multi-line-padding : 16px ;
2829$mat-dense-list-icon-size : 20px ;
2930
30- $mat-list-item-inset-divider-offset : 72px ;
31+ // This mixin provides the correct offset for an inset divider based on the
32+ // size of the parent class (e.g. avatar vs icon)
33+ @mixin mat-inset-divider-offset ($offset ) {
34+ $mat-list-item-inset-divider-offset : #{(2 * $mat-list-side-padding ) + $offset } ;
35+ left : $mat-list-item-inset-divider-offset ;
36+ width : calc (100% - #{$mat-list-item-inset-divider-offset } );
37+
38+ [dir = ' rtl' ] & {
39+ left : auto ;
40+ right : $mat-list-item-inset-divider-offset ;
41+ }
42+ }
3143
3244// This mixin provides all list-item styles, changing font size and height
3345// based on whether the list is in dense mode.
@@ -108,6 +120,10 @@ $mat-list-item-inset-divider-offset: 72px;
108120 width : $mat-list-avatar-size ;
109121 height : $mat-list-avatar-size ;
110122 border-radius : 50% ;
123+
124+ ~ .mat-divider-inset {
125+ @include mat-inset-divider-offset ($mat-list-avatar-size );
126+ }
111127 }
112128
113129 .mat-list-icon {
@@ -116,7 +132,11 @@ $mat-list-item-inset-divider-offset: 72px;
116132 font-size : $icon-size ;
117133 box-sizing : content-box ;
118134 border-radius : 50% ;
119- padding : 4px ;
135+ padding : $mat-list-icon-padding ;
136+
137+ ~ .mat-divider-inset {
138+ @include mat-inset-divider-offset ($icon-size + (2 * $mat-list-icon-padding ));
139+ }
120140 }
121141
122142 .mat-divider {
@@ -131,14 +151,8 @@ $mat-list-item-inset-divider-offset: 72px;
131151 }
132152
133153 & .mat-divider-inset {
134- left : $mat-list-item-inset-divider-offset ;
135- width : calc (100% - #{$mat-list-item-inset-divider-offset } );
136154 margin : 0 ;
137-
138- [dir = ' rtl' ] & {
139- left : auto ;
140- right : $mat-list-item-inset-divider-offset ;
141- }
155+ position : absolute ;
142156 }
143157 }
144158}
0 commit comments