getPresentationWidgetsOnboardingCardTemplate function
String
getPresentationWidgetsOnboardingCardTemplate(
- String projectName
)
Implementation
String getPresentationWidgetsOnboardingCardTemplate(String projectName) {
return '''
import 'package:flutter/material.dart';
import 'package:${projectName}/core/constants/app_assets.dart';
import 'package:${projectName}/core/utils/responsive_size.dart';
class OnboardingCard extends StatelessWidget {
final String title;
final String description;
final VoidCallback onNext;
final VoidCallback onSkip;
final int currentIndex;
final double? height;
const OnboardingCard({
super.key,
required this.title,
required this.description,
required this.onNext,
required this.onSkip,
required this.currentIndex,
this.height,
});
@override
Widget build(BuildContext context) {
return Container(
width: 100.sw,
height: height,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(""),
fit: BoxFit.fill,
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 15.sp),
/// Title
Text(
title,
style: const TextStyle(
fontSize: 26,
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 10),
/// Description
Text(
description,
style: const TextStyle(fontSize: 14, color: Colors.white),
),
const SizedBox(height: 20),
/// Indicator
Row(
children: [
Container(
width: currentIndex == 0 ? 28 : 10,
height: 6,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(10),
),
),
const SizedBox(width: 6),
Container(
width: currentIndex == 1 ? 28 : 10,
height: 6,
decoration: BoxDecoration(
color: Colors.white.withValues(alpha: 0.5),
borderRadius: BorderRadius.circular(10),
),
),
],
),
const SizedBox(height: 30),
/// Buttons
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
GestureDetector(
onTap: onSkip,
child: const Text(
"Skip",
style: TextStyle(
color: Colors.white,
decoration: TextDecoration.underline,
),
),
),
OutlinedButton(
onPressed: onNext,
style: OutlinedButton.styleFrom(
side: const BorderSide(color: Colors.white),
padding: const EdgeInsets.symmetric(
horizontal: 30,
vertical: 12,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
),
),
child: const Text(
"Next",
style: TextStyle(color: Colors.white),
),
),
],
),
],
),
);
}
}
''';
}