docs(examples): move custom-widget example to examples folder (#1644)
This commit is contained in:
9
Cargo.lock
generated
9
Cargo.lock
generated
@@ -751,6 +751,15 @@ dependencies = [
|
||||
"phf",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "custom-widget"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"color-eyre",
|
||||
"crossterm",
|
||||
"ratatui",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "darling"
|
||||
version = "0.20.10"
|
||||
|
||||
@@ -73,6 +73,10 @@ This interactive example shows how different constraints can be used to layout w
|
||||
|
||||
This example shows different types of constraints. [Source](./apps/constraints/).
|
||||
|
||||
## Custom widget demo
|
||||
|
||||
This example shows how to create a custom widget that can be interacted with the mouse. [Source](./apps/custom-widget/).
|
||||
|
||||
## Flex demo
|
||||
|
||||
This interactive example shows how to use the flex layouts. [Source](./apps/flex/).
|
||||
|
||||
14
examples/apps/custom-widget/Cargo.toml
Normal file
14
examples/apps/custom-widget/Cargo.toml
Normal file
@@ -0,0 +1,14 @@
|
||||
[package]
|
||||
name = "custom-widget"
|
||||
publish = false
|
||||
license.workspace = true
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
color-eyre.workspace = true
|
||||
crossterm.workspace = true
|
||||
ratatui.workspace = true
|
||||
|
||||
[lints]
|
||||
workspace = true
|
||||
9
examples/apps/custom-widget/README.md
Normal file
9
examples/apps/custom-widget/README.md
Normal file
@@ -0,0 +1,9 @@
|
||||
# Custom widget demo
|
||||
|
||||
This example shows how to create a custom widget that can be interacted with the mouse.
|
||||
|
||||
To run this demo:
|
||||
|
||||
```shell
|
||||
cargo run -p custom-widget
|
||||
```
|
||||
@@ -1,18 +1,11 @@
|
||||
//! # [Ratatui] Custom Widget example
|
||||
//!
|
||||
//! The latest version of this example is available in the [examples] folder in the repository.
|
||||
//!
|
||||
//! Please note that the examples are designed to be run against the `main` branch of the Github
|
||||
//! repository. This means that you may not be able to compile with the latest release version on
|
||||
//! crates.io, or the one that you have installed locally.
|
||||
//!
|
||||
//! See the [examples readme] for more information on finding examples that match the version of the
|
||||
//! library you are using.
|
||||
//!
|
||||
//! [Ratatui]: https://github.com/ratatui/ratatui
|
||||
//! [examples]: https://github.com/ratatui/ratatui/blob/main/examples
|
||||
//! [examples readme]: https://github.com/ratatui/ratatui/blob/main/examples/README.md
|
||||
|
||||
/// A Ratatui example that demonstrates how to create a custom widget that can be interacted
|
||||
/// with using the mouse.
|
||||
///
|
||||
/// This example runs with the Ratatui library code in the branch that you are currently
|
||||
/// reading. See the [`latest`] branch for the code which works with the most recent Ratatui
|
||||
/// release.
|
||||
///
|
||||
/// [`latest`]: https://github.com/ratatui/ratatui/tree/latest
|
||||
use std::{io::stdout, ops::ControlFlow, time::Duration};
|
||||
|
||||
use color_eyre::Result;
|
||||
@@ -142,11 +142,6 @@ bench = false
|
||||
name = "main"
|
||||
harness = false
|
||||
|
||||
[[example]]
|
||||
name = "custom_widget"
|
||||
required-features = ["crossterm"]
|
||||
doc-scrape-examples = true
|
||||
|
||||
[[example]]
|
||||
name = "docsrs"
|
||||
required-features = ["crossterm"]
|
||||
|
||||
Reference in New Issue
Block a user