Daily Streak Component
The Daily Streak component for Flutter tracks and displays daily streaks for any metric, offering visual progress indicators and customizable options to fit your app’s needs
Last updated
dependencies:
questlabs_flutter_sdk:
git:
url: "Replace with your github URL"
ref: master
flutter_bloc: ^8.1.6
themeConfig: QuestThemeConfig(
secondaryColor: Colors.red,
primaryColor: Colors.blue,
buttonColor: Colors.yellow,
backgroundColor: Colors.yellow,
fontStyle: "libre baskerville",
borderColor: Colors.red
)void main() {
runApp(const MyApp());
getItInit();
getIt<SharedPref>().init();
}providers: [
BlocProvider(
create: (context) => getIt<ComponentStateCubit>(),
),
],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,
// ),
// ],
),
),
),
);
}
}