Skip to content
Shokhjakhon Komiljonov edited this page Feb 15, 2024 · 6 revisions

Getting Started

To get started with fcnui, follow these steps:

  1. Install fcnui:

    • Install fcnui as a Dart global dependency by running the following command:
    dart pub global activate fcnui

    Note: You may need to restart the terminal or open a new one after installation.

  2. Initialize your Flutter project:

    • Navigate to your Flutter project directory.
    • Run the following command to initialize fcnui:
    fcnui init

    This command creates a fcnui.json file, which is used to manage components, and prompts you to select the components library (default is /lib/components).

  3. Add fcnui_base dependency:

    • Inside your Flutter project, add fcnui_base from pub.dev as a dependency. You can do this by running:
    flutter pub add fcnui_base
  4. Wrap MaterialApp/CupertinoApp with ThemeProvider:

    • Wrap your MaterialApp or CupertinoApp with ThemeProvider and configure it accordingly:
    ThemeProvider(
      builder: (context, vm) => MaterialApp(
        // Configure theme, dark theme, and theme mode as needed
        // theme: vm.theme, //Optional. Enables fcnui theme to affect whole application
        title: 'Your App Title',
        home: YourHomePage(),
      ),
    );

    Optionally, you can use fcnui as your default theme. If not needed, simply wrap it.

  5. Start adding components:

    • Begin adding components to your project by running the following command:
    fcnui add [component_name]

    Replace [component_name] with the name of the component you want to add.

That's it! You're now ready to leverage the power of fcnui in your projects. Happy coding!

Clone this wiki locally