> For the complete documentation index, see [llms.txt](https://docs.questera.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.questera.ai/questera-ai-sdks/flutter-sdk-components/gamification/daily-streak-component.md).

# Daily Streak Component

## Components Visuals&#x20;

{% tabs %}
{% tab title="Overview" %}

<figure><img src="/files/ZySKqYdS4S8bQUPLtB6P" alt="" width="563"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Visual 1" %}

<figure><img src="/files/I880bjpjTsCQDy5uNx9a" alt="" width="563"><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Viusal 2" %}

<figure><img src="/files/hjFOBdjRnfhYFlrOOpZu" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

{% hint style="info" %}
To unlock early access to the component                                                           [**Get Access**](https://bijfwfnqtsj.typeform.com/to/eUXDpbuh)
{% endhint %}

### Installation

To use the get started component , you need to install `questlabs_flutter_sdk` package into your project&#x20;

* First, navigate to the root directory of your Flutter project. Open the `pubspec.yaml` file using your preferred code editor.
* Under the `dependencies` section in your `pubspec.yaml` file, add the following line to include the `questlabs_flutter_sdk` package
* After saving your changes, open your terminal or command prompt and run the following command to fetch the new dependency

```dart
dependencies:
  questlabs_flutter_sdk:
    git:
      url: "Replace with your github URL"
      ref: master  
  flutter_bloc: ^8.1.6
```

## Props of Daily Streak Component

<table><thead><tr><th width="170">Prop Name</th><th width="178">Type</th><th width="343">Description</th><th>Required</th></tr></thead><tbody><tr><td>questProvider</td><td>QuestProvider</td><td>Provides necessary configuration such as API key, entity ID, and optional theme settings</td><td>Yes</td></tr><tr><td>apiKey</td><td>String</td><td>API key to authenticate requests.</td><td>Yes</td></tr><tr><td>entityId</td><td>String</td><td>Entity ID associated with the quest.</td><td>Yes</td></tr><tr><td>themeConfig</td><td>QuestThemeConfig</td><td>Customizes theme settings like background color, font style, border color, button color, etc.</td><td>No</td></tr><tr><td>primaryColor</td><td>Color</td><td>Sets the primary color of the component .</td><td>no</td></tr><tr><td>secondaryColor</td><td>Color</td><td>Sets the secondary color of the component .</td><td>no</td></tr><tr><td>buttonColor</td><td>Color</td><td>Defines the color of buttons within the component .</td><td>no</td></tr><tr><td>backgroundColor</td><td>Color</td><td>Specifies the background color of the component .</td><td>no</td></tr><tr><td>borderColor</td><td>Color</td><td>Defines the color of the component's border.</td><td>no</td></tr><tr><td>fontStyle</td><td>String</td><td>Sets the font style for text within the component (e.g., <code>"poppins"</code>)</td><td>no</td></tr><tr><td>streakProps</td><td>StreakProps</td><td>Contains user ID, quest ID, token, and display options for the "Daily Streak Component" </td><td>Yes</td></tr><tr><td>userId</td><td>String</td><td>Unique user identifier.</td><td>Yes</td></tr><tr><td>token</td><td>String</td><td>Token for authenticating the user session.</td><td>Yes</td></tr><tr><td>questId</td><td>String</td><td>Unique quest identifier.</td><td>Yes</td></tr><tr><td>filledStreakImg</td><td>String</td><td>set completed Steak image(it must be image url)</td><td>no</td></tr><tr><td>pendingStreakImg</td><td>String</td><td>set pending Streak image(it must be image url)</td><td>no</td></tr><tr><td>stepDetails</td><td>List&#x3C;stepDetails></td><td>you can modify your  descreption , title and range </td><td>no</td></tr><tr><td>description</td><td>String</td><td>descreption for indivisual streak component </td><td>no</td></tr><tr><td>title</td><td>String</td><td>title for indivisual streak component </td><td>np</td></tr><tr><td>range</td><td>int</td><td>range for indivisual streak component </td><td>no</td></tr></tbody></table>

**You can customize the UI with the type of** QuestThemeConfig **would be**

```dart

          themeConfig: QuestThemeConfig(
              secondaryColor: Colors.red,
              primaryColor: Colors.blue,
              buttonColor: Colors.yellow,
              backgroundColor: Colors.yellow,
              fontStyle: "libre baskerville",
              borderColor: Colors.red
          )
```

### **Basic Usage:**

* In your `main()` function, ensure you initialize the app and dependencies as follows:

```dart
void main() {
  runApp(const MyApp());
  getItInit();
  getIt<SharedPref>().init();
}
```

* Add the following `BlocProvider` setup to your `providers` list to initialize the `ComponentStateCubit` for state management:

```dart
providers: [
  BlocProvider(
            create: (context) => getIt<ComponentStateCubit>(),
          ),
],
```

{% hint style="info" %}
Ensure you provide your entity ID, API key, token, user ID, and quest ID
{% endhint %}

```dart
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:questlabs_flutter_sdk/questlabs_flutter_sdk.dart';

void main() {
  runApp(const MyApp());
  getItInit();
  getIt<SharedPref>().init();
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MultiBlocProvider(
      providers: [
        BlocProvider(
          create: (context) => getIt<GamificationQuizCubit>(),
        ),
      ],
      child: MaterialApp(
        title: 'Flutter Demo',
        home:  DailyStreakComponent(
          questProvider: QuestProvider(
              apiKey: "apiKey",
              entityId: "entityId",
              themeConfig: QuestThemeConfig(
                // secondaryColor: Colors.red,
                // primaryColor: Colors.green,
                // buttonColor: Colors.yellow,
                // backgroundColor: Colors.yellow,
                // fontStyle: "poppins",
                // borderColor: Colors.black
              )
          ),
          streakProps: StreakProps(
            userId: "userId",
            token: "token",
            questId: "questId",
            // filledStreakImg: "https://plus.unsplash.com/premium_photo-1683865776032-07bf70b0add1?q=80&w=1932&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D",
            // stepDetails: [
            //   StepDetails(
            //     description: 'This is the longest streak you’ve ever had',
            //     title: 'Confident reader',
            //     range: 3,
            //   ),
            //   StepDetails(
            //     description: 'This is the longest streak you’ve ever had',
            //     title: 'Responsible reader',
            //     range: 2,
            //   ),
            //   StepDetails(
            //     description: 'This is the longest streak you’ve ever had',
            //     title: 'Serious learner',
            //     range: 5,
            //   ),
            //   StepDetails(
            //     description: 'This is the longest streak you’ve ever had',
            //     title: 'Absolute reader',
            //     range: 3,
            //   ),
            // ],
          ),
        ),
      ),
    );
  }
}



```

Watch the video below for a step-by-step guide on testing the daily Streak component in your Flutter project.

{% embed url="<https://www.loom.com/share/9c287e2a69b943d182357ef26d23ac78?sid=141c96c5-fe44-4279-a82f-cc000c2805cd>" %}
