getFaqUiTemplate function

String getFaqUiTemplate({
  1. required String className,
  2. required String isLoading,
  3. required String projectName,
})

Implementation

String getFaqUiTemplate(
    {required String className,
    required String isLoading,
    required String projectName}) {
  final appName = projectName[0].toUpperCase() + projectName.substring(1);
  return '''
CustomBody(
      title: "FAQ",
      isLoading: $isLoading,
      child: ListView.builder(
        padding: EdgeInsets.all(16.sp),
        itemCount: 5,
        itemBuilder: (context, index) {
          final faqs = [
            {"q": "What is $appName?", "a": "$appName is a social discovery platform helping you find new friends nearby."},
            {"q": "How does $appName work?", "a": "Swipe right to like and left to pass. If both members are a match, you can start chatting!"},
            {"q": "Is $appName free?", "a": "Yes, $appName is free to download and use for all fundamental features."},
            {"q": "Who is $appName for?", "a": "$appName is for anyone looking to expand their social circle and find friends."},
            {"q": "Is it safe?", "a": "Safety is our priority. We use verified profiles and reporting systems."}
          ];

          final item = faqs[index % faqs.length];
          final isExpanded = state.expandedIndices.contains(index);

          return Padding(
            padding: EdgeInsets.only(bottom: 12.sp),
            child: ExpandCollapseWidget(
              title: item["q"]!,
              item: index,
              isExpanded: isExpanded,
              onToggle: () {
                 context.read<${className}Bloc>().add(${className}ToggleFaq(index));
              },
              child: Container(
                padding: EdgeInsets.all(15.sp),
                decoration: BoxDecoration(
                  color: Colors.white,
                  border: Border.all(color: AppColors.primary.withOpacity(0.3)),
                  borderRadius: BorderRadius.only(
                    bottomLeft: Radius.circular(12.sp),
                    bottomRight: Radius.circular(12.sp),
                  ),
                ),
                child: TextWidget(
                  text: item["a"]!,
                  textSize: 14.sp,
                  color: Colors.black87,
                ),
              ),
            ),
          );
        },
      ),
    )''';
}