Show scrollable doc example in multiple places
This commit is contained in:
parent
24fcc57873
commit
94f0e0a212
2 changed files with 62 additions and 2 deletions
|
|
@ -681,7 +681,27 @@ where
|
|||
|
||||
/// Creates a new [`Scrollable`] with the provided content.
|
||||
///
|
||||
/// [`Scrollable`]: crate::Scrollable
|
||||
/// Scrollables let users navigate an endless amount of content with a scrollbar.
|
||||
///
|
||||
/// # Example
|
||||
/// ```no_run
|
||||
/// # mod iced { pub mod widget { pub use iced_widget::*; } }
|
||||
/// # pub type State = ();
|
||||
/// # pub type Element<'a, Message> = iced_widget::core::Element<'a, Message, iced_widget::Theme, iced_widget::Renderer>;
|
||||
/// use iced::widget::{column, scrollable, vertical_space};
|
||||
///
|
||||
/// enum Message {
|
||||
/// // ...
|
||||
/// }
|
||||
///
|
||||
/// fn view(state: &State) -> Element<'_, Message> {
|
||||
/// scrollable(column![
|
||||
/// "Scroll me!",
|
||||
/// vertical_space().height(3000),
|
||||
/// "You did it!",
|
||||
/// ]).into()
|
||||
/// }
|
||||
/// ```
|
||||
pub fn scrollable<'a, Message, Theme, Renderer>(
|
||||
content: impl Into<Element<'a, Message, Theme, Renderer>>,
|
||||
) -> Scrollable<'a, Message, Theme, Renderer>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue