fluttercn 0.0.5
fluttercn: ^0.0.5 copied to clipboard
A CLI tool for adding beautiful, production-ready Flutter components to your projects. Components are copied directly into your project, giving you complete ownership and full control.
A Dart CLI tool for adding beautiful, production-ready Flutter components to your projects. Components are copied directly into your project, giving you complete ownership and full control.
β¨ Features #
- π¨ Beautiful Components - Carefully crafted UI components following Flutter design principles
- π¦ Copy-Paste Philosophy - Components are copied directly into your project, giving you complete ownership
- π― Zero Dependencies - No external packages required, just Flutter
- π Easy to Use - Simple CLI tool to add components to your project
- π¨ Fully Customizable - Modify, extend, or customize components however you need
- βΏ Accessible - Built with accessibility in mind
π¦ Installation #
Global Installation (Recommended) #
Install the CLI globally using Dart's pub:
dart pub global activate fluttercn
Important: Make sure ~/.pub-cache/bin is in your PATH. Add it by running:
export PATH="$PATH":"$HOME/.pub-cache/bin"
To make this permanent, add the above line to your shell profile (~/.zshrc, ~/.bashrc, etc.).
Verify Installation #
Check if the CLI is installed correctly:
fluttercn --version
You should see the version number (e.g., 0.0.5).
π Quick Start #
-
Navigate to your Flutter project:
cd your-flutter-project -
Initialize fluttercn:
fluttercn initThis creates the theme configuration file at
lib/config/theme.dart. -
List available components:
fluttercn list -
Add a component:
fluttercn add button fluttercn add card
That's it! Components are copied to lib/widgets/common/ in your project.
π Commands #
init #
Initialize fluttercn in your Flutter project. This command creates the theme configuration file that components depend on.
fluttercn init
What it does:
- Creates
lib/config/theme.dartwith theme configuration - Validates that you're in a Flutter project
- Sets up the necessary directory structure
add <component> #
Add a Flutter component to your project. Components are copied to lib/widgets/common/.
fluttercn add <component-name>
Available components:
button- Customizable button with multiple variants and sizescard- Card component with header, content, and footer sectionsavatar- Avatar with network, asset, and initials fallbackbadge- Badge, count badge, and status badge primitivescheckbox- Animated checkbox with tristate support
Examples:
# Add a button component
fluttercn add button
# Add a card component
fluttercn add card
# Add multiple components
fluttercn add avatar
fluttercn add badge
fluttercn add checkbox
list (or ls) #
List all available components in the registry.
fluttercn list
# or
fluttercn ls
--version / -v #
Display the version number.
fluttercn --version
# or
fluttercn -v
--help / -h #
Display help information.
fluttercn --help
# or
fluttercn -h
π Usage Examples #
Basic Workflow #
# 1. Initialize fluttercn
fluttercn init
# 2. See what's available
fluttercn list
# 3. Add components you need
fluttercn add button
fluttercn add card
π§ Requirements #
- Dart SDK: 3.0.0 or higher
- Flutter project: Must have
pubspec.yamlandlib/directory - PATH configuration:
~/.pub-cache/binmust be in your PATH
π Troubleshooting #
Flutter project validation failed #
Problem: CLI says you're not in a Flutter project.
Solution:
- Make sure you're running the command from the root of your Flutter project
- Verify that
pubspec.yamlexists in the current directory - Check that
lib/directory exists
fluttercn is not initialized #
Problem: Error when trying to add a component.
Solution:
fluttercn init
Run this command first to set up fluttercn in your project.
Component not found #
Problem: Component name doesn't exist.
Solution:
fluttercn list
Use this command to see all available components and their exact names.
Command not found: fluttercn #
Problem: fluttercn command is not recognized.
Solution:
-
Make sure you've installed the CLI:
dart pub global activate fluttercn -
Add
~/.pub-cache/binto your PATH:export PATH="$PATH":"$HOME/.pub-cache/bin" -
Restart your terminal or run:
source ~/.zshrc # or ~/.bashrc
Permission denied #
Problem: Permission errors when running commands.
Solution:
chmod +x ~/.pub-cache/bin/fluttercn
More components are coming soon! Check the documentation for updates.
π Resources #
- π Documentation
- π Report Issues
- π¬ Discussions
- π¦ pub.flutter-io.cn Package
π License #
This project is licensed under the BSD-3-Clause License - see the LICENSE file for details.
π Acknowledgments #
Inspired by shadcn/ui and its philosophy of production-ready, copy-paste components.