cosmic/widget/
toggler.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// Copyright 2022 System76 <info@system76.com>
// SPDX-License-Identifier: MPL-2.0

use iced::{widget, Length};
use iced_core::text;

pub fn toggler<'a, Message, Theme: iced_widget::toggler::Catalog, Renderer>(
    is_checked: bool,
) -> widget::Toggler<'a, Message, Theme, Renderer>
where
    Renderer: iced_core::Renderer + text::Renderer,
{
    widget::Toggler::new(is_checked)
        .size(24)
        .spacing(0)
        .width(Length::Shrink)
}