How to use it?
Add as Dependency
onboarding_package:
git:
url: git@github.com:Hacathon-Projects/on-boarding-package.git
Make sure your SSH key is added to the github repo
Should require Provider to work, as it handles the state using provider
Example:
import 'package:flutter/material.dart';
import 'package:onboarding_package/onboarding_package.dart'; // Import the package
import 'package:provider/provider.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: ChangeNotifierProvider(
create: (_) => OnboardingProvider(),
child: OnBoardingScreen(
pages: [
{
'title': "Stay on Target",
'buttonText': "Next",
"image": Image.asset('assets/onboarding1.png'), // Use your own image
"description": "Track your daily progress with precision.",
'skip': true,
},
{
'title': "Join the Community",
'buttonText': "Next",
"image": Image.asset('assets/onboarding2.png'), // Use your own image
"description": "Connect with fellow participants and share your journey.",
'skip': false,
},
{
'title': "Stay Accountable",
'buttonText': "Next",
"image": Image.asset('assets/onboarding3.png'), // Use your own image
"description": "Pair up with an accountability partner to stay motivated.",
'skip': false,
},
],
onSkip: () {
// Handle skip logic
print("Onboarding skipped");
// Navigate to the next screen (e.g., login or home)
},
onComplete: () {
// Handle completion logic
print("Onboarding completed");
// Navigate to the next screen (e.g., login or home)
},
primaryColor: Colors.blue, // Customize the primary color
skipButtonText: "Skip", // Customize the skip button text
),
),
);
}
}