repose_material/material3/
defaults.rs1use repose_core::*;
2
3pub struct SurfaceDefaults;
5
6impl SurfaceDefaults {
7 pub fn color() -> Color {
8 theme().surface
9 }
10 pub fn content_color() -> Color {
11 theme().on_surface
12 }
13 pub const SHAPE_RADIUS: f32 = 0.0;
14 pub const TONAL_ELEVATION: f32 = 0.0;
15 pub const SHADOW_ELEVATION: f32 = 0.0;
16}
17
18pub struct ToggleButtonDefaults;
20
21impl ToggleButtonDefaults {
22 pub const HEIGHT: f32 = 40.0;
23 pub const HORIZONTAL_PADDING: f32 = 24.0;
24 pub const SHAPE_RADIUS: f32 = 20.0;
25 pub fn content_color() -> Color {
26 theme().on_surface_variant
27 }
28 pub fn checked_container_color() -> Color {
29 theme().primary
30 }
31 pub fn checked_content_color() -> Color {
32 theme().on_primary
33 }
34 pub fn tonal_content_color() -> Color {
35 theme().on_surface_variant
36 }
37 pub fn tonal_checked_container_color() -> Color {
38 theme().secondary_container
39 }
40 pub fn tonal_checked_content_color() -> Color {
41 theme().on_secondary_container
42 }
43 pub fn outlined_content_color() -> Color {
44 theme().on_surface_variant
45 }
46 pub fn outlined_border_color() -> Color {
47 theme().outline
48 }
49 pub fn outlined_checked_container_color() -> Color {
50 theme().secondary_container
51 }
52 pub fn outlined_checked_content_color() -> Color {
53 theme().on_secondary_container
54 }
55 pub fn elevated_content_color() -> Color {
56 theme().primary
57 }
58 pub fn elevated_checked_container_color() -> Color {
59 theme().surface_container_low
60 }
61 pub fn elevated_checked_content_color() -> Color {
62 theme().primary
63 }
64 pub fn state_colors_default() -> StateColors {
65 let th = theme();
66 StateColors {
67 default: Color::TRANSPARENT,
68 hovered: th.on_surface.with_alpha_f32(0.08),
69 pressed: th.on_surface.with_alpha_f32(0.12),
70 dragged: th.on_surface.with_alpha_f32(0.12),
71 disabled: th.on_surface.with_alpha_f32(0.12),
72 }
73 }
74 pub fn state_elevation_default() -> StateElevation {
75 StateElevation {
76 default: 0.0,
77 hovered: 1.0,
78 pressed: 0.0,
79 dragged: 0.0,
80 disabled: 0.0,
81 }
82 }
83 pub fn elevated_state_elevation() -> StateElevation {
84 let th = theme();
85 StateElevation {
86 default: th.elevation.level1,
87 hovered: th.elevation.level2,
88 pressed: th.elevation.level1,
89 dragged: th.elevation.level1,
90 disabled: 0.0,
91 }
92 }
93}
94
95pub struct ProgressIndicatorDefaults;
97
98impl ProgressIndicatorDefaults {
99 pub fn linear_color() -> Color {
100 theme().primary
101 }
102 pub fn linear_track_color() -> Color {
103 theme().secondary_container
104 }
105 pub const LINEAR_INDICATOR_HEIGHT: f32 = 4.0;
106 pub const LINEAR_INDICATOR_GAP_SIZE: f32 = 4.0;
107 pub const LINEAR_TRACK_STOP_SIZE: f32 = 4.0;
108
109 pub fn circular_color() -> Color {
110 theme().primary
111 }
112 pub fn circular_track_color() -> Color {
113 theme().secondary_container
114 }
115 pub const CIRCULAR_INDICATOR_SIZE: f32 = 40.0;
116 pub const CIRCULAR_STROKE_WIDTH: f32 = 4.0;
117
118 pub const SLIDER_THUMB_TRACK_GAP: f32 = 6.0;
120}
121
122pub struct ButtonDefaults;
124
125impl ButtonDefaults {
126 pub fn content_color() -> Color {
127 theme().on_primary
128 }
129 pub fn container_color() -> Color {
130 theme().primary
131 }
132 pub fn tonal_container_color() -> Color {
133 theme().secondary_container
134 }
135 pub fn tonal_content_color() -> Color {
136 theme().on_secondary_container
137 }
138 pub fn elevated_container_color() -> Color {
139 theme().surface_container_low
140 }
141 pub fn elevated_content_color() -> Color {
142 theme().primary
143 }
144 pub fn outlined_content_color() -> Color {
145 theme().on_surface_variant
146 }
147 pub fn outlined_border_color() -> Color {
148 theme().outline_variant
149 }
150 pub fn text_content_color() -> Color {
151 theme().primary
152 }
153 pub const HEIGHT: f32 = 40.0;
154 pub const HORIZONTAL_PADDING: f32 = 24.0;
155 pub const TEXT_HORIZONTAL_PADDING: f32 = 12.0;
156 pub const SHAPE_RADIUS: f32 = 20.0;
157 pub fn state_colors_default() -> StateColors {
158 let th = theme();
159 StateColors {
160 default: Color::TRANSPARENT,
161 hovered: th.on_surface.with_alpha_f32(0.08),
162 pressed: th.on_surface.with_alpha_f32(0.12),
163 dragged: th.on_surface.with_alpha_f32(0.12),
164 disabled: th.on_surface.with_alpha_f32(0.12),
165 }
166 }
167 pub fn state_elevation_default() -> StateElevation {
168 StateElevation {
169 default: 0.0,
170 hovered: 1.0,
171 pressed: 0.0,
172 dragged: 0.0,
173 disabled: 0.0,
174 }
175 }
176 pub fn elevated_state_elevation() -> StateElevation {
177 let th = theme();
178 StateElevation {
179 default: th.elevation.level1,
180 hovered: th.elevation.level2,
181 pressed: th.elevation.level1,
182 dragged: th.elevation.level1,
183 disabled: 0.0,
184 }
185 }
186}
187
188pub struct SnackbarDefaults;
190
191impl SnackbarDefaults {
192 pub const MIN_HEIGHT: f32 = 48.0;
193 pub const MIN_WIDTH: f32 = 280.0;
194 pub const MAX_WIDTH: f32 = 600.0;
195 pub const SHAPE_RADIUS: f32 = 4.0;
196 pub fn container_color() -> Color {
197 theme().inverse_surface
198 }
199 pub fn content_color() -> Color {
200 theme().inverse_on_surface
201 }
202 pub fn action_color() -> Color {
203 theme().inverse_primary
204 }
205 pub fn dismiss_action_content_color() -> Color {
206 theme().inverse_on_surface
207 }
208}
209
210pub struct CardDefaults;
212
213impl CardDefaults {
214 pub fn filled_container_color() -> Color {
215 theme().surface_container_highest
216 }
217 pub fn elevated_container_color() -> Color {
218 theme().surface_container_low
219 }
220 pub fn outlined_container_color() -> Color {
221 theme().surface
222 }
223 pub fn outlined_border_color() -> Color {
224 theme().outline_variant
225 }
226 pub fn filled_content_color() -> Color {
227 theme().on_surface
228 }
229 pub fn elevated_content_color() -> Color {
230 theme().on_surface
231 }
232 pub fn outlined_content_color() -> Color {
233 theme().on_surface
234 }
235 pub fn disabled_container_color() -> Color {
236 theme().on_surface.with_alpha_f32(0.04)
237 }
238 pub fn disabled_content_color() -> Color {
239 theme().on_surface.with_alpha_f32(0.38)
240 }
241 pub const SHAPE_RADIUS: f32 = 12.0;
242 pub const ELEVATION: f32 = 0.0;
243}
244
245pub struct DialogDefaults;
247
248impl DialogDefaults {
249 pub fn container_color() -> Color {
250 theme().surface_container_high
251 }
252 pub const SHAPE_RADIUS: f32 = 28.0;
253 pub const MIN_WIDTH: f32 = 280.0;
254 pub const MAX_WIDTH: f32 = 560.0;
255 pub const HORIZONTAL_PADDING: f32 = 24.0;
256}
257
258pub struct IconButtonDefaults;
260
261impl IconButtonDefaults {
262 pub const CONTAINER_SIZE: f32 = 48.0;
263 pub const FILLED_CONTAINER_SIZE: f32 = 40.0;
264 pub fn content_color() -> Color {
265 theme().on_surface_variant
266 }
267 pub fn disabled_content_color() -> Color {
268 theme().on_surface.with_alpha_f32(0.38)
269 }
270 pub fn filled_content_color() -> Color {
271 theme().on_primary
272 }
273 pub fn filled_container_color() -> Color {
274 theme().primary
275 }
276 pub fn filled_tonal_content_color() -> Color {
277 theme().on_secondary_container
278 }
279 pub fn filled_tonal_container_color() -> Color {
280 theme().secondary_container
281 }
282 pub fn state_colors_default() -> StateColors {
283 let th = theme();
284 StateColors {
285 default: Color::TRANSPARENT,
286 hovered: th.on_surface.with_alpha_f32(0.08),
287 pressed: th.on_surface.with_alpha_f32(0.12),
288 dragged: th.on_surface.with_alpha_f32(0.12),
289 disabled: Color::TRANSPARENT,
290 }
291 }
292}
293
294pub struct CheckboxDefaults;
296
297impl CheckboxDefaults {
298 pub const TOUCH_TARGET_SIZE: f32 = 40.0;
299 pub const BOX_SIZE: f32 = 18.0;
300 pub const STROKE_WIDTH: f32 = 2.0;
301 pub const CORNER_RADIUS: f32 = 2.0;
302 pub const CHECK_ICON_SIZE: f32 = 14.0;
303 pub fn checked_color() -> Color {
304 theme().primary
305 }
306 pub fn unchecked_color() -> Color {
307 theme().on_surface_variant
308 }
309 pub fn checkmark_color() -> Color {
310 theme().on_primary
311 }
312 pub fn disabled_checked_box_color() -> Color {
313 theme().on_surface.with_alpha_f32(0.38)
314 }
315 pub fn disabled_checkmark_color() -> Color {
316 theme().surface
317 }
318 pub fn disabled_unchecked_border_color() -> Color {
319 theme().on_surface.with_alpha_f32(0.38)
320 }
321 pub fn state_colors_default() -> StateColors {
322 let th = theme();
323 StateColors {
324 default: Color::TRANSPARENT,
325 hovered: th.on_surface.with_alpha_f32(0.08),
326 pressed: th.on_surface.with_alpha_f32(0.12),
327 dragged: th.on_surface.with_alpha_f32(0.12),
328 disabled: Color::TRANSPARENT,
329 }
330 }
331}
332
333pub struct RadioButtonDefaults;
335
336impl RadioButtonDefaults {
337 pub const TOUCH_TARGET_SIZE: f32 = 40.0;
338 pub const OUTER_RADIUS: f32 = 10.0;
339 pub const DOT_RADIUS: f32 = 5.0;
340 pub const STROKE_WIDTH: f32 = 2.0;
341 pub fn selected_color() -> Color {
342 theme().primary
343 }
344 pub fn unselected_color() -> Color {
345 theme().on_surface_variant
346 }
347 pub fn disabled_selected_color() -> Color {
348 theme().on_surface.with_alpha_f32(0.38)
349 }
350 pub fn disabled_unselected_color() -> Color {
351 theme().on_surface.with_alpha_f32(0.38)
352 }
353 pub fn state_colors_default() -> StateColors {
354 let th = theme();
355 StateColors {
356 default: Color::TRANSPARENT,
357 hovered: th.on_surface.with_alpha_f32(0.08),
358 pressed: th.on_surface.with_alpha_f32(0.12),
359 dragged: th.on_surface.with_alpha_f32(0.12),
360 disabled: Color::TRANSPARENT,
361 }
362 }
363}
364
365pub struct SwitchDefaults;
367
368impl SwitchDefaults {
369 pub const TRACK_WIDTH: f32 = 52.0;
370 pub const TRACK_HEIGHT: f32 = 32.0;
371 pub const THUMB_CHECKED_SIZE: f32 = 24.0;
372 pub const THUMB_UNCHECKED_SIZE: f32 = 16.0;
373 pub fn checked_track_color() -> Color {
374 theme().primary
375 }
376 pub fn unchecked_track_color() -> Color {
377 theme().surface_container_highest
378 }
379 pub fn checked_thumb_color() -> Color {
380 theme().on_primary
381 }
382 pub fn unchecked_thumb_color() -> Color {
383 theme().outline
384 }
385 pub fn checked_icon_color() -> Color {
386 theme().on_primary
387 }
388 pub fn unchecked_icon_color() -> Color {
389 theme().outline
390 }
391 pub fn unchecked_border_color() -> Color {
392 theme().outline
393 }
394 pub fn disabled_checked_thumb_color() -> Color {
395 theme().surface
396 }
397 pub fn disabled_checked_track_color() -> Color {
398 theme().on_surface.with_alpha_f32(0.12)
399 }
400 pub fn disabled_checked_icon_color() -> Color {
401 theme().on_surface.with_alpha_f32(0.38)
402 }
403 pub fn disabled_unchecked_thumb_color() -> Color {
404 theme().on_surface.with_alpha_f32(0.38)
405 }
406 pub fn disabled_unchecked_track_color() -> Color {
407 theme().surface_container_highest.with_alpha_f32(0.12)
408 }
409 pub fn disabled_unchecked_border_color() -> Color {
410 theme().on_surface.with_alpha_f32(0.12)
411 }
412 pub fn disabled_unchecked_icon_color() -> Color {
413 theme().surface_container_highest.with_alpha_f32(0.38)
414 }
415 pub fn state_colors_default() -> StateColors {
416 let th = theme();
417 StateColors {
418 default: Color::TRANSPARENT,
419 hovered: th.on_surface.with_alpha_f32(0.08),
420 pressed: th.on_surface.with_alpha_f32(0.12),
421 dragged: th.on_surface.with_alpha_f32(0.12),
422 disabled: Color::TRANSPARENT,
423 }
424 }
425}
426
427pub struct SliderDefaults;
429
430impl SliderDefaults {
431 pub const TRACK_HEIGHT: f32 = 4.0;
432 pub const THUMB_SIZE: f32 = 20.0;
433 pub fn active_track_color() -> Color {
434 theme().primary
435 }
436 pub fn inactive_track_color() -> Color {
437 theme().secondary_container
438 }
439 pub fn thumb_color() -> Color {
440 theme().primary
441 }
442 pub fn active_tick_color() -> Color {
443 theme().secondary_container
444 }
445 pub fn inactive_tick_color() -> Color {
446 theme().primary
447 }
448 pub fn disabled_thumb_color() -> Color {
449 theme().on_surface.with_alpha_f32(0.38)
450 }
451 pub fn disabled_active_track_color() -> Color {
452 theme().on_surface.with_alpha_f32(0.38)
453 }
454 pub fn disabled_inactive_track_color() -> Color {
455 theme().on_surface.with_alpha_f32(0.12)
456 }
457 pub fn disabled_active_tick_color() -> Color {
458 theme().on_surface.with_alpha_f32(0.12)
459 }
460 pub fn disabled_inactive_tick_color() -> Color {
461 theme().on_surface.with_alpha_f32(0.38)
462 }
463 pub fn state_colors_default() -> StateColors {
464 let th = theme();
465 StateColors {
466 default: Color::TRANSPARENT,
467 hovered: th.on_surface.with_alpha_f32(0.08),
468 pressed: th.on_surface.with_alpha_f32(0.12),
469 dragged: th.on_surface.with_alpha_f32(0.12),
470 disabled: Color::TRANSPARENT,
471 }
472 }
473}
474
475pub struct DividerDefaults;
477
478impl DividerDefaults {
479 pub const THICKNESS: f32 = 1.0;
480 pub fn color() -> Color {
481 theme().outline_variant
482 }
483}
484
485pub struct BadgeDefaults;
487
488impl BadgeDefaults {
489 pub const DOT_SIZE: f32 = 6.0;
490 pub const LABEL_MIN_WIDTH: f32 = 16.0;
491 pub const LABEL_HEIGHT: f32 = 16.0;
492 pub const DOT_OFFSET_X: f32 = 6.0;
493 pub const DOT_OFFSET_Y: f32 = 6.0;
494 pub const CONTENT_OFFSET_X: f32 = 12.0;
495 pub const CONTENT_OFFSET_Y: f32 = 14.0;
496 pub fn container_color() -> Color {
497 theme().error
498 }
499 pub fn content_color() -> Color {
500 theme().on_error
501 }
502}
503
504pub struct ListItemDefaults;
506
507impl ListItemDefaults {
508 pub const ONE_LINE_HEIGHT: f32 = 56.0;
509 pub const TWO_LINE_HEIGHT: f32 = 72.0;
510 pub const THREE_LINE_HEIGHT: f32 = 88.0;
511 pub const HORIZONTAL_PADDING: f32 = 16.0;
512 pub const TRAILING_PADDING: f32 = 24.0;
513 pub fn headline_color() -> Color {
514 theme().on_surface
515 }
516 pub fn supporting_color() -> Color {
517 theme().on_surface_variant
518 }
519 pub fn overline_color() -> Color {
520 theme().on_surface_variant
521 }
522 pub fn leading_icon_color() -> Color {
523 theme().on_surface_variant
524 }
525 pub fn trailing_icon_color() -> Color {
526 theme().on_surface_variant
527 }
528 pub fn disabled_container_color() -> Color {
530 theme().on_surface.with_alpha_f32(0.04)
531 }
532 pub fn disabled_headline_color() -> Color {
533 theme().on_surface.with_alpha_f32(0.38)
534 }
535 pub fn disabled_supporting_color() -> Color {
536 theme().on_surface.with_alpha_f32(0.38)
537 }
538 pub fn disabled_overline_color() -> Color {
539 theme().on_surface.with_alpha_f32(0.38)
540 }
541 pub fn disabled_leading_icon_color() -> Color {
542 theme().on_surface.with_alpha_f32(0.38)
543 }
544 pub fn disabled_trailing_icon_color() -> Color {
545 theme().on_surface.with_alpha_f32(0.38)
546 }
547 pub fn selected_container_color() -> Color {
549 theme().surface_container_high
550 }
551 pub fn selected_headline_color() -> Color {
552 theme().on_surface
553 }
554 pub fn selected_supporting_color() -> Color {
555 theme().on_surface_variant
556 }
557 pub fn selected_overline_color() -> Color {
558 theme().on_surface_variant
559 }
560 pub fn selected_leading_icon_color() -> Color {
561 theme().on_surface_variant
562 }
563 pub fn selected_trailing_icon_color() -> Color {
564 theme().on_surface_variant
565 }
566 pub fn dragged_container_color() -> Color {
568 theme().surface_container_high
569 }
570 pub fn dragged_headline_color() -> Color {
571 theme().on_surface
572 }
573 pub fn dragged_supporting_color() -> Color {
574 theme().on_surface_variant
575 }
576 pub fn dragged_overline_color() -> Color {
577 theme().on_surface_variant
578 }
579 pub fn dragged_leading_icon_color() -> Color {
580 theme().on_surface_variant
581 }
582 pub fn dragged_trailing_icon_color() -> Color {
583 theme().on_surface_variant
584 }
585 pub fn state_colors_default() -> StateColors {
586 let th = theme();
587 StateColors {
588 default: Color::TRANSPARENT,
589 hovered: th.on_surface.with_alpha_f32(0.08),
590 pressed: th.on_surface.with_alpha_f32(0.12),
591 dragged: th.on_surface.with_alpha_f32(0.12),
592 disabled: Color::TRANSPARENT,
593 }
594 }
595}
596
597pub struct TopAppBarDefaults;
599
600impl TopAppBarDefaults {
601 pub const HEIGHT: f32 = 64.0;
602 pub fn container_color() -> Color {
603 theme().surface
604 }
605 pub fn scrolled_container_color() -> Color {
606 theme().surface_container
607 }
608 pub fn title_content_color() -> Color {
609 theme().on_surface
610 }
611 pub fn subtitle_content_color() -> Color {
612 theme().on_surface_variant
613 }
614 pub fn navigation_icon_content_color() -> Color {
615 theme().on_surface
616 }
617 pub fn action_icon_content_color() -> Color {
618 theme().on_surface_variant
619 }
620}
621
622pub struct TabDefaults;
624
625impl TabDefaults {
626 pub const HEIGHT: f32 = 48.0;
627 pub const INDICATOR_HEIGHT: f32 = 3.0;
628 pub const INDICATOR_CORNER: f32 = 1.5;
629 pub fn container_color() -> Color {
630 theme().surface
631 }
632 pub fn selected_content_color() -> Color {
633 theme().primary
634 }
635 pub fn unselected_content_color() -> Color {
636 theme().on_surface_variant
637 }
638 pub fn indicator_color() -> Color {
639 theme().primary
640 }
641}
642
643pub struct NavigationBarDefaults;
645
646impl NavigationBarDefaults {
647 pub const HEIGHT: f32 = 80.0;
648 pub const TONAL_ELEVATION: f32 = 0.0;
649 pub const ITEM_ACTIVE_INDICATOR_OPACITY: f32 = 1.0;
650 pub const ITEM_SPACING: f32 = 8.0;
651 pub const ACTIVE_INDICATOR_WIDTH: f32 = 56.0;
652 pub const ACTIVE_INDICATOR_HEIGHT: f32 = 32.0;
653 pub fn container_color() -> Color {
654 theme().surface_container
655 }
656 pub fn content_color() -> Color {
657 theme().on_surface
658 }
659 pub fn selected_icon_color() -> Color {
660 theme().on_secondary_container
661 }
662 pub fn selected_text_color() -> Color {
663 theme().secondary
664 }
665 pub fn unselected_icon_color() -> Color {
666 theme().on_surface_variant
667 }
668 pub fn unselected_text_color() -> Color {
669 theme().on_surface_variant
670 }
671 pub fn indicator_color() -> Color {
672 theme().secondary_container
673 }
674 pub const INDICATOR_RADIUS: f32 = 16.0;
675}
676
677pub struct NavigationRailDefaults;
679
680impl NavigationRailDefaults {
681 pub const WIDTH: f32 = 80.0;
682 pub const ITEM_RADIUS: f32 = 16.0;
683 pub const ITEM_MIN_HEIGHT: f32 = 56.0;
684 pub const ITEM_ACTIVE_INDICATOR_OPACITY: f32 = 1.0;
685 pub const ITEM_SPACING: f32 = 4.0;
686 pub const ACTIVE_INDICATOR_WIDTH: f32 = 56.0;
687 pub const ACTIVE_INDICATOR_HEIGHT: f32 = 32.0;
688 pub fn container_color() -> Color {
689 theme().surface
690 }
691 pub fn selected_icon_color() -> Color {
692 theme().on_secondary_container
693 }
694 pub fn selected_text_color() -> Color {
695 theme().secondary
696 }
697 pub fn unselected_icon_color() -> Color {
698 theme().on_surface_variant
699 }
700 pub fn unselected_text_color() -> Color {
701 theme().on_surface_variant
702 }
703 pub fn indicator_color() -> Color {
704 theme().secondary_container
705 }
706}
707
708pub struct SegmentedButtonDefaults;
710
711impl SegmentedButtonDefaults {
712 pub const HEIGHT: f32 = 40.0;
713 pub const SHAPE_RADIUS: f32 = 20.0;
714 pub const CONTENT_PADDING: PaddingValues = PaddingValues {
715 left: 12.0,
716 right: 12.0,
717 top: 0.0,
718 bottom: 0.0,
719 };
720 pub fn border_color() -> Color {
721 theme().outline
722 }
723 pub fn selected_container_color() -> Color {
724 theme().secondary_container
725 }
726 pub fn selected_content_color() -> Color {
727 theme().on_secondary_container
728 }
729 pub fn unselected_content_color() -> Color {
730 theme().on_surface
731 }
732 pub fn state_colors_default() -> StateColors {
733 let th = theme();
734 StateColors {
735 default: Color::TRANSPARENT,
736 hovered: th.on_surface.with_alpha_f32(0.08),
737 pressed: th.on_surface.with_alpha_f32(0.12),
738 dragged: th.on_surface.with_alpha_f32(0.12),
739 disabled: Color::TRANSPARENT,
740 }
741 }
742}
743
744pub struct FABDefaults;
746
747impl FABDefaults {
748 pub const SMALL_SIZE: f32 = 40.0;
749 pub const SMALL_SHAPE_RADIUS: f32 = 12.0;
750 pub const SIZE: f32 = 56.0;
751 pub const LARGE_SIZE: f32 = 96.0;
752 pub const SHAPE_RADIUS: f32 = 28.0;
753 pub const LARGE_SHAPE_RADIUS: f32 = 28.0;
754 pub fn container_color() -> Color {
755 theme().primary_container
756 }
757 pub fn content_color() -> Color {
758 theme().on_primary_container
759 }
760 pub fn state_elevation() -> StateElevation {
761 StateElevation {
762 default: theme().elevation.level3,
763 hovered: theme().elevation.level4,
764 pressed: theme().elevation.level5,
765 dragged: theme().elevation.level5,
766 disabled: 0.0,
767 }
768 }
769}
770
771pub struct ChipDefaults;
773
774impl ChipDefaults {
775 pub const HEIGHT: f32 = 32.0;
776 pub const HORIZONTAL_PADDING: f32 = 16.0;
777 pub const SHAPE_RADIUS: f32 = 8.0;
778 pub const BORDER_WIDTH: f32 = 1.0;
779
780 pub fn container_color() -> Color {
782 Color::TRANSPARENT
783 }
784 pub fn label_color() -> Color {
785 theme().on_surface_variant
786 }
787 pub fn leading_icon_color() -> Color {
788 theme().primary
789 }
790 pub fn trailing_icon_color() -> Color {
791 theme().primary
792 }
793
794 pub fn disabled_container_color() -> Color {
796 Color::TRANSPARENT
797 }
798 pub fn disabled_label_color() -> Color {
799 theme().on_surface.with_alpha_f32(0.38)
800 }
801 pub fn disabled_leading_icon_color() -> Color {
802 theme().on_surface.with_alpha_f32(0.38)
803 }
804 pub fn disabled_trailing_icon_color() -> Color {
805 theme().on_surface.with_alpha_f32(0.38)
806 }
807
808 pub fn selected_container_color() -> Color {
810 theme().secondary_container
811 }
812 pub fn selected_label_color() -> Color {
813 theme().on_secondary_container
814 }
815 pub fn selected_leading_icon_color() -> Color {
816 theme().primary
817 }
818 pub fn selected_trailing_icon_color() -> Color {
819 theme().on_secondary_container
820 }
821
822 pub fn disabled_selected_container_color() -> Color {
824 theme()
825 .on_surface
826 .with_alpha_f32(0.12)
827 .composite_over(theme().secondary_container)
828 }
829
830 pub fn border_color() -> Color {
832 theme().outline_variant
833 }
834 pub fn selected_border_color() -> Color {
835 Color::TRANSPARENT
836 }
837 pub fn disabled_border_color() -> Color {
838 theme().on_surface.with_alpha_f32(0.12)
839 }
840 pub fn disabled_selected_border_color() -> Color {
841 Color::TRANSPARENT
842 }
843
844 pub fn elevation_default() -> f32 {
846 0.0
847 }
848 pub fn elevation_hovered() -> f32 {
849 0.0
850 }
851 pub fn elevation_focused() -> f32 {
852 0.0
853 }
854 pub fn elevation_pressed() -> f32 {
855 0.0
856 }
857 pub fn elevation_dragged() -> f32 {
858 0.0
859 }
860 pub fn elevation_disabled() -> f32 {
861 0.0
862 }
863
864 pub fn elevated_elevation_default() -> f32 {
866 theme().elevation.level1
867 }
868 pub fn elevated_elevation_hovered() -> f32 {
869 theme().elevation.level2
870 }
871 pub fn elevated_elevation_focused() -> f32 {
872 theme().elevation.level1
873 }
874 pub fn elevated_elevation_pressed() -> f32 {
875 theme().elevation.level1
876 }
877 pub fn elevated_elevation_dragged() -> f32 {
878 theme().elevation.level4
880 }
881 pub fn elevated_elevation_disabled() -> f32 {
882 0.0
883 }
884
885 pub fn elevated_container_color() -> Color {
887 theme().surface_container_low
888 }
889 pub fn elevated_selected_container_color() -> Color {
890 theme().secondary_container
891 }
892 pub fn disabled_elevated_container_color() -> Color {
893 theme()
894 .on_surface
895 .with_alpha_f32(0.12)
896 .composite_over(theme().surface_container_low)
897 }
898}
899
900pub struct ScaffoldDefaults;
902
903impl ScaffoldDefaults {
904 pub fn container_color() -> Color {
905 theme().background
906 }
907 pub fn content_color() -> Color {
908 theme().on_background
909 }
910 pub const TOP_BAR_HEIGHT: f32 = 64.0;
911 pub const BOTTOM_BAR_HEIGHT: f32 = 80.0;
912 pub const FAB_MARGIN: f32 = 16.0;
913}
914
915pub struct NavigationDrawerDefaults;
917
918impl NavigationDrawerDefaults {
919 pub const WIDTH: f32 = 300.0;
920 pub const TONAL_ELEVATION: f32 = 0.0;
921 pub fn container_color() -> Color {
922 theme().surface_container_low
923 }
924 pub fn content_color() -> Color {
925 theme().on_surface_variant
926 }
927 pub fn scrim_color() -> Color {
928 theme().scrim.with_alpha(82)
929 }
930 pub const SHAPE_RADIUS: f32 = 16.0;
931}
932
933pub struct BottomSheetDefaults;
935
936impl BottomSheetDefaults {
937 pub const TONAL_ELEVATION: f32 = 0.0;
938 pub fn container_color() -> Color {
939 theme().surface_container_low
940 }
941 pub fn content_color() -> Color {
942 theme().on_surface
943 }
944 pub fn drag_handle_color() -> Color {
945 theme().on_surface_variant
946 }
947 pub fn scrim_color() -> Color {
948 theme().scrim.with_alpha(85)
949 }
950 pub const DRAG_HANDLE_WIDTH: f32 = 32.0;
951 pub const DRAG_HANDLE_HEIGHT: f32 = 4.0;
952 pub const SHAPE_RADIUS: f32 = 16.0;
953 pub const PEEK_HEIGHT: f32 = 56.0;
954 pub const MAX_WIDTH: f32 = 640.0;
955}
956
957pub struct SearchBarDefaults;
959
960impl SearchBarDefaults {
961 pub const HEIGHT: f32 = 56.0;
962 pub const EXPANDED_WIDTH: f32 = 360.0;
963 pub const COLLAPSED_WIDTH: f32 = 240.0;
964 pub const DOCKED_HEIGHT: f32 = 400.0;
965 pub const TONAL_ELEVATION: f32 = 0.0;
966 pub const SHADOW_ELEVATION: f32 = 0.0;
967 pub const SHAPE_RADIUS: f32 = 28.0; pub const ACTIVE_SHAPE_RADIUS: f32 = 28.0;
969 pub const DOCKED_SHAPE_RADIUS: f32 = 28.0;
970 pub const DROPDOWN_SHAPE_RADIUS: f32 = 12.0;
971 pub const DROPDOWN_GAP_SIZE: f32 = 2.0;
972 pub const MIN_WIDTH: f32 = Self::COLLAPSED_WIDTH;
973 pub const MAX_WIDTH: f32 = 720.0;
974 pub const VERTICAL_PADDING: f32 = 8.0;
975
976 pub const CONTENT_PADDING: PaddingValues = PaddingValues {
977 left: 16.0,
978 right: 16.0,
979 top: 0.0,
980 bottom: 0.0,
981 };
982
983 pub fn container_color() -> Color {
984 theme().surface_container
985 }
986 pub fn active_container_color() -> Color {
987 theme().surface_container_high
988 }
989 pub fn content_color() -> Color {
990 theme().on_surface
991 }
992 pub fn placeholder_color() -> Color {
993 theme().on_surface_variant
994 }
995 pub fn divider_color() -> Color {
996 theme().outline_variant
997 }
998 pub fn scrim_color() -> Color {
999 theme().scrim.with_alpha(85)
1000 }
1001 pub fn scrolled_container_color() -> Color {
1002 theme().surface_container_highest
1003 }
1004 pub fn app_bar_container_color() -> Color {
1005 theme().surface
1006 }
1007 pub fn scrolled_app_bar_container_color() -> Color {
1008 theme().surface_container
1009 }
1010 pub fn navigation_icon_content_color() -> Color {
1011 theme().on_surface
1012 }
1013 pub fn action_icon_content_color() -> Color {
1014 theme().on_surface_variant
1015 }
1016 pub fn dropdown_scrim_color() -> Color {
1017 Color::TRANSPARENT
1018 }
1019}
1020
1021pub struct DropdownMenuDefaults;
1023
1024impl DropdownMenuDefaults {
1025 pub const MIN_WIDTH: f32 = 112.0;
1026 pub const ITEM_HEIGHT: f32 = 48.0;
1027 pub const VERTICAL_MARGIN: f32 = 48.0;
1028 pub const HORIZONTAL_MARGIN: f32 = 8.0;
1029 pub const MAX_WIDTH: f32 = 280.0;
1030 pub fn container_color() -> Color {
1031 theme().surface_container
1032 }
1033 pub fn item_text_color() -> Color {
1034 theme().on_surface
1035 }
1036 pub fn disabled_item_text_color() -> Color {
1037 theme().on_surface.with_alpha_f32(0.38)
1038 }
1039 pub fn divider_color() -> Color {
1040 theme().outline_variant
1041 }
1042}
1043
1044pub struct TooltipDefaults;
1046
1047impl TooltipDefaults {
1048 pub const OFFSET_Y: f32 = -28.0;
1049 pub const HORIZONTAL_PADDING: f32 = 8.0;
1050 pub const VERTICAL_PADDING: f32 = 4.0;
1051 pub const MAX_WIDTH: f32 = 200.0;
1052 pub fn container_color() -> Color {
1053 theme().inverse_surface
1054 }
1055 pub fn content_color() -> Color {
1056 theme().inverse_on_surface
1057 }
1058}
1059
1060pub struct PullToRefreshDefaults;
1062
1063impl PullToRefreshDefaults {
1064 pub const THRESHOLD: f32 = 64.0;
1065 pub fn indicator_color() -> Color {
1066 theme().primary
1067 }
1068 pub fn container_color() -> Color {
1069 Color::TRANSPARENT
1070 }
1071}
1072
1073pub struct AlertDialogDefaults;
1075
1076impl AlertDialogDefaults {
1077 pub const MIN_WIDTH: f32 = 280.0;
1078 pub const MAX_WIDTH: f32 = 560.0;
1079 pub const HORIZONTAL_PADDING: f32 = 24.0;
1080 pub fn scrim_color() -> Color {
1081 theme().scrim.with_alpha(82)
1082 }
1083}
1084
1085pub struct OutlinedTextFieldDefaults;
1087
1088impl OutlinedTextFieldDefaults {
1089 pub const MIN_HEIGHT: f32 = 56.0;
1090 pub const MIN_WIDTH: f32 = 280.0;
1091 pub const UNFOCUSED_BORDER_THICKNESS: f32 = 1.0;
1092 pub const FOCUSED_BORDER_THICKNESS: f32 = 2.0;
1093 pub const TEXT_FIELD_PADDING: f32 = 16.0;
1094 pub const VERTICAL_PADDING_WITH_LABEL: f32 = 8.0;
1095
1096 pub fn label_color() -> Color {
1097 theme().on_surface_variant
1098 }
1099 pub fn focused_label_color() -> Color {
1100 theme().primary
1101 }
1102 pub fn error_label_color() -> Color {
1103 theme().error
1104 }
1105 pub fn input_color() -> Color {
1106 theme().on_surface
1107 }
1108 pub fn disabled_input_color() -> Color {
1109 theme().on_surface.with_alpha_f32(0.38)
1110 }
1111 pub fn supporting_color() -> Color {
1112 theme().on_surface_variant
1113 }
1114 pub fn placeholder_color() -> Color {
1115 theme().on_surface_variant
1116 }
1117 pub fn leading_icon_color() -> Color {
1118 theme().on_surface_variant
1119 }
1120 pub fn trailing_icon_color() -> Color {
1121 theme().on_surface_variant
1122 }
1123 pub fn unfocused_border_color() -> Color {
1124 theme().outline
1125 }
1126 pub fn focused_border_color() -> Color {
1127 theme().primary
1128 }
1129 pub fn error_border_color() -> Color {
1130 theme().error
1131 }
1132 pub fn cursor_color() -> Color {
1133 theme().primary
1134 }
1135 pub fn container_color() -> Color {
1136 theme().surface
1137 }
1138}
1139
1140pub struct DatePickerDefaults;
1142
1143impl DatePickerDefaults {
1144 pub const CONTAINER_WIDTH: f32 = 360.0;
1145 pub const CONTAINER_HEIGHT: f32 = 568.0;
1146 pub const HEADER_CONTAINER_HEIGHT: f32 = 120.0;
1147 pub const DATE_CELL_SIZE: f32 = 40.0;
1148 pub const YEAR_CELL_HEIGHT: f32 = 36.0;
1149 pub const YEAR_CELL_WIDTH: f32 = 72.0;
1150 pub const TODAY_BORDER_WIDTH: f32 = 1.0;
1151 pub const HORIZONTAL_PADDING: f32 = 12.0;
1152
1153 pub fn container_color() -> Color {
1154 theme().surface_container_high
1155 }
1156 pub fn header_color() -> Color {
1157 theme().on_surface_variant
1158 }
1159 pub fn weekday_color() -> Color {
1160 theme().on_surface
1161 }
1162 pub fn day_color() -> Color {
1163 theme().on_surface
1164 }
1165 pub fn selected_day_color() -> Color {
1166 theme().on_primary
1167 }
1168 pub fn selected_day_container_color() -> Color {
1169 theme().primary
1170 }
1171 pub fn today_content_color() -> Color {
1172 theme().primary
1173 }
1174 pub fn today_border_color() -> Color {
1175 theme().primary
1176 }
1177 pub fn year_selected_container_color() -> Color {
1178 theme().primary
1179 }
1180 pub fn year_selected_content_color() -> Color {
1181 theme().on_primary
1182 }
1183 pub fn year_unselected_content_color() -> Color {
1184 theme().on_surface_variant
1185 }
1186}
1187
1188pub struct TimePickerDefaults;
1190
1191impl TimePickerDefaults {
1192 pub const CLOCK_DIAL_CONTAINER_SIZE: f32 = 256.0;
1193 pub const CLOCK_DIAL_MIN_CONTAINER_SIZE: f32 = 200.0;
1194 pub const PERIOD_SELECTOR_HORIZONTAL_WIDTH: f32 = 216.0;
1195 pub const PERIOD_SELECTOR_HORIZONTAL_HEIGHT: f32 = 38.0;
1196 pub const PERIOD_SELECTOR_VERTICAL_WIDTH: f32 = 52.0;
1197 pub const PERIOD_SELECTOR_VERTICAL_HEIGHT: f32 = 80.0;
1198 pub const TIME_SELECTOR_CONTAINER_WIDTH: f32 = 96.0;
1199 pub const TIME_SELECTOR_CONTAINER_HEIGHT: f32 = 80.0;
1200 pub const TIME_SELECTOR_24H_WIDTH: f32 = 114.0;
1201 pub const MAX_HEIGHT: f32 = 384.0;
1202
1203 pub fn clock_dial_color() -> Color {
1204 theme().surface_container_highest
1205 }
1206 pub fn clock_dial_selected_content_color() -> Color {
1207 theme().on_primary
1208 }
1209 pub fn clock_dial_unselected_content_color() -> Color {
1210 theme().on_surface
1211 }
1212 pub fn selector_color() -> Color {
1213 theme().primary
1214 }
1215 pub fn container_color() -> Color {
1216 theme().surface_container_high
1217 }
1218 pub fn period_selector_selected_container_color() -> Color {
1219 theme().tertiary_container
1220 }
1221 pub fn period_selector_unselected_container_color() -> Color {
1222 Color::TRANSPARENT
1223 }
1224 pub fn period_selector_selected_content_color() -> Color {
1225 theme().on_tertiary_container
1226 }
1227 pub fn period_selector_unselected_content_color() -> Color {
1228 theme().on_surface_variant
1229 }
1230 pub fn period_selector_border_color() -> Color {
1231 theme().outline
1232 }
1233 pub fn time_selector_selected_container_color() -> Color {
1234 theme().primary_container
1235 }
1236 pub fn time_selector_selected_content_color() -> Color {
1237 theme().on_primary_container
1238 }
1239 pub fn time_selector_unselected_container_color() -> Color {
1240 theme().surface_container_highest
1241 }
1242 pub fn time_selector_unselected_content_color() -> Color {
1243 theme().on_surface
1244 }
1245 pub fn time_selector_separator_color() -> Color {
1246 theme().on_surface
1247 }
1248}
1249
1250pub struct SwipeToDismissDefaults;
1252
1253impl SwipeToDismissDefaults {
1254 pub const POSITIONAL_THRESHOLD: f32 = 56.0;
1255 pub const DISMISS_THRESHOLD: f32 = 150.0;
1256 pub const DISMISSED_OFFSET: f32 = 300.0;
1257 pub const MAX_WIDTH: f32 = 400.0;
1258}
1259
1260pub struct SplitButtonDefaults;
1264
1265impl SplitButtonDefaults {
1266 pub const SPACING: f32 = 2.0;
1268 pub const LEADING_BUTTON_MIN_WIDTH: f32 = 48.0;
1269
1270 pub const XSMALL_CONTAINER_HEIGHT: f32 = 32.0;
1271 pub const SMALL_CONTAINER_HEIGHT: f32 = 40.0; pub const MEDIUM_CONTAINER_HEIGHT: f32 = 56.0;
1273 pub const LARGE_CONTAINER_HEIGHT: f32 = 64.0; pub const XLARGE_CONTAINER_HEIGHT: f32 = 72.0; pub const OUTER_CORNER_SIZE: f32 = f32::INFINITY; pub const SMALL_INNER_CORNER_SIZE: f32 = 4.0;
1280 pub const XSMALL_INNER_CORNER_SIZE: f32 = 4.0;
1282 pub const MEDIUM_INNER_CORNER_SIZE: f32 = 4.0;
1284 pub const LARGE_INNER_CORNER_SIZE: f32 = 4.0;
1286 pub const XLARGE_INNER_CORNER_SIZE: f32 = 4.0;
1288
1289 pub const XSMALL_INNER_CORNER_SIZE_PRESSED: f32 = 6.0;
1291 pub const SMALL_INNER_CORNER_SIZE_PRESSED: f32 = 6.0;
1292 pub const MEDIUM_INNER_CORNER_SIZE_PRESSED: f32 = 6.0;
1293 pub const LARGE_INNER_CORNER_SIZE_PRESSED: f32 = 6.0;
1294 pub const XLARGE_INNER_CORNER_SIZE_PRESSED: f32 = 6.0;
1295
1296 pub const LEADING_ICON_SIZE: f32 = 18.0;
1298 pub const TRAILING_ICON_SIZE: f32 = 22.0;
1300 pub const XSMALL_TRAILING_ICON_SIZE: f32 = 22.0;
1301 pub const MEDIUM_TRAILING_ICON_SIZE: f32 = 26.0;
1302 pub const LARGE_TRAILING_ICON_SIZE: f32 = 26.0;
1303 pub const XLARGE_TRAILING_ICON_SIZE: f32 = 26.0;
1304
1305 pub fn small_leading_content_padding() -> PaddingValues {
1309 PaddingValues {
1310 left: 16.0,
1311 right: 12.0,
1312 top: 0.0,
1313 bottom: 0.0,
1314 }
1315 }
1316
1317 pub fn small_trailing_content_padding() -> PaddingValues {
1321 PaddingValues {
1322 left: 13.0,
1323 right: 13.0,
1324 top: 0.0,
1325 bottom: 0.0,
1326 }
1327 }
1328
1329 pub fn xsmall_leading_content_padding() -> PaddingValues {
1333 PaddingValues {
1334 left: 12.0,
1335 right: 10.0,
1336 top: 0.0,
1337 bottom: 0.0,
1338 }
1339 }
1340
1341 pub fn xsmall_trailing_content_padding() -> PaddingValues {
1345 PaddingValues {
1346 left: 13.0,
1347 right: 13.0,
1348 top: 0.0,
1349 bottom: 0.0,
1350 }
1351 }
1352
1353 pub fn medium_leading_content_padding() -> PaddingValues {
1357 PaddingValues {
1358 left: 24.0,
1359 right: 24.0,
1360 top: 0.0,
1361 bottom: 0.0,
1362 }
1363 }
1364
1365 pub fn medium_trailing_content_padding() -> PaddingValues {
1369 PaddingValues {
1370 left: 15.0,
1371 right: 15.0,
1372 top: 0.0,
1373 bottom: 0.0,
1374 }
1375 }
1376
1377 pub fn large_leading_content_padding() -> PaddingValues {
1379 PaddingValues {
1380 left: 32.0,
1381 right: 32.0,
1382 top: 0.0,
1383 bottom: 0.0,
1384 }
1385 }
1386
1387 pub fn large_trailing_content_padding() -> PaddingValues {
1389 PaddingValues {
1390 left: 24.0,
1391 right: 24.0,
1392 top: 0.0,
1393 bottom: 0.0,
1394 }
1395 }
1396
1397 pub fn xlarge_leading_content_padding() -> PaddingValues {
1399 PaddingValues {
1400 left: 32.0,
1401 right: 32.0,
1402 top: 0.0,
1403 bottom: 0.0,
1404 }
1405 }
1406
1407 pub fn xlarge_trailing_content_padding() -> PaddingValues {
1409 PaddingValues {
1410 left: 24.0,
1411 right: 24.0,
1412 top: 0.0,
1413 bottom: 0.0,
1414 }
1415 }
1416}
1417
1418pub struct ButtonGroupDefaults;
1423
1424impl ButtonGroupDefaults {
1425 pub const EXPANDED_RATIO: f32 = 0.15;
1427
1428 pub const STANDARD_GAP: f32 = 12.0;
1431
1432 pub const CONNECTED_GAP: f32 = 2.0;
1435
1436 pub const CONTAINER_HEIGHT: f32 = 40.0;
1437
1438 pub const CONNECTED_INNER_CORNER: f32 = 8.0; pub const CONNECTED_PRESSED_INNER_CORNER: f32 = 4.0; pub const CONNECTED_CHECKED_CORNER: f32 = f32::INFINITY;
1446 pub const CONNECTED_OUTER_CORNER: f32 = f32::INFINITY;
1448}
1449
1450pub struct CarouselDefaults;
1452
1453impl CarouselDefaults {
1454 pub const MIN_SMALL_ITEM_SIZE: f32 = 40.0;
1455 pub const MAX_SMALL_ITEM_SIZE: f32 = 56.0;
1456 pub const ANCHOR_SIZE: f32 = 10.0;
1457}