radartui 0.0.1
radartui: ^0.0.1 copied to clipboard
A flutter-like TUI framework for dart.
RadarTUI: A Flutter-Inspired TUI Framework for Dart #
RadarTUI is a Flutter-style framework for building beautiful and responsive Terminal User Interfaces (TUIs) using Dart. Easily develop complex terminal applications with a declarative widget paradigm.
π― Key Features #
- β¨ Declarative UI: A Flutter-like widget tree structure where the UI automatically updates when the state changes.
- π¦ Rich Widget Library: Provides essential layout and UI widgets like
Row,Column,Text,Container,Button,TextField, and more. - β‘οΈ Efficient Rendering: Intelligent diff-based terminal rendering optimization that only redraws the parts that have changed.
- β¨οΈ Flexible Input Handling: Easily handle keyboard events and interact with the application state.
- π¨ Flexible Layout System: Easily configure complex UIs with a powerful Flexbox-based layout widget.
- π§ Intuitive State Management: Clear and predictable state management through
StatelessWidgetandStatefulWidgetpatterns.
ποΈ Architecture #
RadarTUI follows a layered architecture inspired by Flutter. Each layer has a clearly defined role, enhancing the code's maintainability and scalability.
ββββββββββββββββββββββββββββ
β Application Layer β (User Applications)
ββββββββββββββββββββββββββββ€
β Widgets Layer β (Declarative UI Widgets)
ββββββββββββββββββββββββββββ€
β Scheduler Layer β (Frame Scheduling & Lifecycle)
ββββββββββββββββββββββββββββ€
β Rendering Layer β (Layout & Painting)
ββββββββββββββββββββββββββββ€
β Services Layer β (Terminal Control, I/O)
ββββββββββββββββββββββββββββ€
β Foundation Layer β (Basic Data Types)
ββββββββββββββββββββββββββββ
For more detailed architecture information, please refer to the AGENTS.md document.
π Getting Started #
1. Add Dependency #
Add RadarTUI to your pubspec.yaml file.
dependencies:
radartui:
path: ../ # Or specify the pub.dev version
2. Basic Example Code #
Here is a simple counter application example.
import 'package:radartui/radartui.dart';
void main() {
runApp(const CounterApp());
}
class CounterApp extends StatefulWidget {
const CounterApp({Key? key}) : super(key: key);
@override
State<CounterApp> createState() => _CounterAppState();
}
class _CounterAppState extends State<CounterApp> {
int _counter = 0;
StreamSubscription? _subscription;
@override
void initState() {
super.initState();
_subscription = SchedulerBinding.instance.keyboard.keyEvents.listen((event) {
if (event.key == 'q') {
shutdown();
} else {
setState(() {
_counter++;
});
}
});
}
@override
void dispose() {
_subscription?.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Center(
child: Text(
'Press any key to increment the counter: $_counter
Press 'q' to quit.',
style: const TextStyle(color: AnsiColor.green),
),
);
}
}
π¦ How to Run Examples #
Check out the various examples included in the project to see the features of RadarTUI.
-
Navigate to the
exampledirectory.cd example -
Install dependencies.
dart pub get -
Run the desired example. (
main.dartprovides a menu to select various examples)dart run
πΊοΈ Roadmap #
RadarTUI is continuously evolving. Many core features are already implemented:
β Implemented #
- Animation System: Basic animation support with indicators
- Focus Management System: Keyboard navigation and focus control between widgets
- Theme System: Centralized management of colors and styles for the entire application
- Widget Testing Framework: Testing utilities for TUI applications
- Advanced Layout Widgets:
Grid,Stack,ListView,Wrap,IndexedStack - Rich Widgets:
DataTable,TabBar/TabBarView,DropdownButton,Icon - Input Handling:
Shortcuts/Actionsfor keyboard shortcuts
π§ Planned #
- Enhanced Animation System: Smooth visual transitions for state changes
- Mouse Support: Optional mouse event handling
- More Widgets: Additional Flutter-compatible widgets
π€ Contributing #
Contributions to RadarTUI are welcome! Bug reports, feature suggestions, code contributions, and any other form of participation are appreciated.
Before you start contributing, reading the AGENTS.md architecture document will be very helpful in understanding the project structure.
π License #
RadarTUI is distributed under the MIT License.