Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# <img src="https://github.com/JahezAcademy/flutter_rocket/blob/dev/images/logo.png" width="40"> Flutter Rocket
# <img width="40" height="40" alt="logo-2" src="https://github.com/user-attachments/assets/d89f912e-fac9-4341-845e-dc33d70ee70c" /> Flutter Rocket

**The ultimate power-up for your Flutter state management and API integration.**

Expand Down Expand Up @@ -26,9 +26,12 @@ Flutter Rocket is a high-performance, lightweight state management and API integ
| Package | Version | Description |
| --- | --- | --- |
| [flutter_rocket](https://pub.dev/packages/flutter_rocket) | [![pub package](https://img.shields.io/pub/v/flutter_rocket.svg)](https://pub.dev/packages/flutter_rocket) | Core bundle for Flutter. |
| [rocket_model](https://pub.dev/packages/rocket_model) | [![pub package](https://img.shields.io/pub/v/rocket_model.svg)](https://pub.dev/packages/rocket_model) | Base model and state logic. |
| [rocket_model](https://pub.dev/packages/rocket_model) | [![pub package](https://img.shields.io/pub/v/rocket_model.svg)](https://pub.dev/packages/rocket_model) | A type‑safe, reactive model layer. |
| [rocket_client](https://pub.dev/packages/rocket_client) | [![pub package](https://img.shields.io/pub/v/rocket_client.svg)](https://pub.dev/packages/rocket_client) | HTTP client with caching. |
| [rocket_view](https://pub.dev/packages/rocket_view) | [![pub package](https://img.shields.io/pub/v/rocket_view.svg)](https://pub.dev/packages/rocket_view) | UI state management widgets. |
| [rocket_mini_view](https://pub.dev/packages/rocket_mini_view) | [![pub package](https://img.shields.io/pub/v/rocket_mini_view.svg)](https://pub.dev/packages/rocket_mini_view) | A tiny, reactive widget. |
| [rocket_singleton](https://pub.dev/packages/rocket_singleton) | [![pub package](https://img.shields.io/pub/v/rocket_singleton.svg)](https://pub.dev/packages/rocket_singleton) | Fast, type‑safe in‑memory storage. |
| [rocket_cache](https://pub.dev/packages/rocket_cache) | [![pub package](https://img.shields.io/pub/v/rocket_cache.svg)](https://pub.dev/packages/rocket_cache) | A persistence and caching layer. |
| [rocket_cli](https://pub.dev/packages/rocket_cli) | [![pub package](https://img.shields.io/pub/v/rocket_cli.svg)](https://pub.dev/packages/rocket_cli) | CLI for model generation. |

---
Expand All @@ -53,8 +56,9 @@ Flutter Rocket is a high-performance, lightweight state management and API integ

## 🎨 Graphic Tutorial

![Flutter Rocket Architecture](https://github.com/JahezAcademy/flutter_rocket/blob/dev/images/flutter_rocket_schema.jpg)
[Explore the Miro Board](https://miro.com/app/board/uXjVPndHj2s=/?share_link_id=307293362528)
![Flutter Rocket Architecture](https://github.com/user-attachments/assets/b60a34bd-e480-4e6b-81af-1bb9905c0017)

[Explore the Miro Board](https://miro.com/app/board/uXjVJal1g3o=/?share_link_id=335195782321)

---

Expand Down
2 changes: 1 addition & 1 deletion packages/flutter_rocket/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: flutter_rocket
description: Powerful package for state management & request.
version: 0.0.9
repository: https://github.com/JahezAcademy/flutter_rocket/flutter_rocket
repository: https://github.com/JahezAcademy/flutter_rocket
issue_tracker: https://github.com/JahezAcademy/flutter_rocket/labels/flutter_rocket
homepage: https://github.com/JahezAcademy/flutter_rocket

Expand Down
129 changes: 56 additions & 73 deletions packages/rocket_mini_view/README.md
Original file line number Diff line number Diff line change
@@ -1,99 +1,82 @@
# Rocket MiniView
# Rocket MiniView 🚀

`RocketMiniView` is a widget provided by the `rocket_listenable` package that listens to changes in a `RocketListenable` object and rebuilds when a change occurs. It is designed to be used in conjunction with `RocketValue` objects to build reactive UIs in Flutter.
[![pub package](https://img.shields.io/pub/v/rocket_mini_view.svg)](https://pub.dev/packages/rocket_mini_view)
[![license](https://img.shields.io/github/license/JahezAcademy/mvc_rocket.svg)](LICENSE)

## Usage
A tiny, **reactive** widget that rebuilds automatically when a `RocketListenable` (e.g. `RocketValue`) changes. It lives in the `rocket_listenable` ecosystem and lets you write concise, declarative UI code without boilerplate.

To use `RocketMiniView`, import it into your Dart file:
## 📦 Installation

```dart
import 'package:flutter/material.dart';
import 'package:rocket_listenable/rocket_listenable.dart';
import 'package:your_app/constants.dart';

import 'rocket_mini_view.dart';

final RocketValue value = [].mini;
...
RocketMiniView(
value: value,
builder: () {
return Text(value.length.toString());
},
)
```

The `RocketMiniView` widget takes two required parameters:

- `value`: The `RocketListenable` object to listen to.
- `builder`: A function that returns the widget tree to build.
Add the dependency to your `pubspec.yaml`:

The `builder` function should return the widget tree that needs to be rebuilt when the `RocketListenable` object changes.

## API Reference

### `RocketMiniView`

The `RocketMiniView` widget is a widget that listens to changes in a `RocketListenable` object and rebuilds when a change occurs.

#### Constructor

```dart
RocketMiniView({
Key? key,
required this.value,
required this.builder,
})
```yaml
dependencies:
rocket_mini_view: ^0.0.1
```

- `key`: An optional `Key` object to use for the widget.
- `value`: The `RocketListenable` object to listen to.
- `builder`: A function that returns the widget tree to build.
Then fetch the packages:

#### `MiniViewRocketState`

The `MiniViewRocketState` class is the state object for the `RocketMiniView` widget.

#### `initState` Method

```dart
void initState()
```bash
flutter pub get
```

Called when the widget is first inserted into the widget tree.
## 🎯 Getting Started

#### `didUpdateWidget` Method
Import the widget:

```dart
void didUpdateWidget(RocketMiniView oldWidget)
import 'package:rocket_mini_view/rocket_mini_view.dart';
```

Called when the widget is updated with new parameters.

#### `dispose` Method
### Simple example

```dart
void dispose()
import 'package:flutter/material.dart';
import 'package:rocket_listenable/rocket_listenable.dart';
import 'package:rocket_mini_view/rocket_mini_view.dart';

final RocketValue<List<String>> items = RocketValue([]);

class CounterDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('MiniView Demo')),
body: Center(
child: RocketMiniView(
value: items,
builder: () => Text('Items count: ${items.value.length}'),
),
),
floatingActionButton: FloatingActionButton(
onPressed: () => items.value = [...items.value, 'Item ${items.value.length + 1}'],
child: const Icon(Icons.add),
),
);
}
}
```

Called when the widget is removed from the widget tree.

#### `_rebuildWidget` Method
The `builder` runs each time `items` changes, giving you an instantly‑updating UI.

```dart
void _rebuildWidget()
```
## 🛠️ API Overview

Called when the `RocketListenable` object changes.
| Class / Constructor | Description |
|---------------------|-------------|
| `RocketMiniView({Key? key, required RocketListenable<T> value, required Widget Function() builder})` | Core widget that listens to `value` and rebuilds using `builder`. |
| `MiniViewRocketState` | Internal `State` implementation – handles subscription lifecycle (`initState`, `didUpdateWidget`, `dispose`). |
| `_rebuildWidget()` | Private helper called when the listened object notifies listeners. |
| `build(BuildContext context)` | Returns the widget produced by `builder`. |

#### `build` Method
### Parameters
- **`value`** – The `RocketListenable` (e.g. `RocketValue`, `RocketListenable`) you want to observe.
- **`builder`** – A zero‑argument function that returns the widget tree to render.
- **`key`** – Optional widget key.

```dart
Widget build(BuildContext context)
```
## 🤝 Contributing

Builds the widget tree using the `builder` function.
Feel free to open issues or submit pull requests on the [GitHub repository](https://github.com/JahezAcademy/mvc_rocket). Contributions that add examples, improve documentation, or extend functionality are especially welcome.

## Conclusion
## 📄 License

`RocketMiniView` is a useful widget provided by the `rocket_listenable` package that enables you to build reactive UIs in Flutter. Its simple API and ability to listen to changes in `RocketListenable` objects make it an ideal choice for building Flutter applications that need to react to changes in data.
This package is released under the MIT License – see the [LICENSE](LICENSE) file for details.
Loading