docs(examples): move flex example to examples folder (#1642)

This commit is contained in:
Orhun Parmaksız 2025-02-05 03:36:38 +03:00 committed by GitHub
parent f5fde0ef53
commit fa8ca0121a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 48 additions and 20 deletions

10
Cargo.lock generated
View File

@ -993,6 +993,16 @@ version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"
[[package]]
name = "flex"
version = "0.0.0"
dependencies = [
"color-eyre",
"crossterm",
"ratatui",
"strum",
]
[[package]]
name = "fnv"
version = "1.0.7"

View File

@ -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/).
## Flex demo
This interactive example shows how to use the flex layouts. [Source](./apps/flex/).
## Hello World demo
This example shows how to create a simple TUI with a text. [Source](./apps/hello-world/).

View File

@ -0,0 +1,15 @@
[package]
name = "flex"
publish = false
license.workspace = true
edition.workspace = true
rust-version.workspace = true
[dependencies]
color-eyre.workspace = true
crossterm.workspace = true
ratatui.workspace = true
strum.workspace = true
[lints]
workspace = true

View File

@ -0,0 +1,9 @@
# Flex demo
This interactive example shows how to use the flex layouts.
To run this demo:
```shell
cargo run -p flex
```

View File

@ -1,18 +1,13 @@
//! # [Ratatui] Flex 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 different types of flex layouts.
///
/// You can also change the spacing between the constraints, and toggle between different types
/// of flex layouts.
///
/// 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::num::NonZeroUsize;
use color_eyre::Result;

View File

@ -152,11 +152,6 @@ name = "docsrs"
required-features = ["crossterm"]
doc-scrape-examples = false
[[example]]
name = "flex"
required-features = ["crossterm"]
doc-scrape-examples = true
[[example]]
name = "gauge-widget"
required-features = ["crossterm"]