getPresentationWidgetsCommonEmptyDetailPageTemplate function

String getPresentationWidgetsCommonEmptyDetailPageTemplate(
  1. String projectName
)

Implementation

String getPresentationWidgetsCommonEmptyDetailPageTemplate(String projectName) {
  return '''
import 'package:flutter/material.dart';

class CommonEmptyDetailPage extends StatelessWidget {
  final String? title;
  final String? message;
  final Widget? icon;
  final VoidCallback? onRetry;

  const CommonEmptyDetailPage({
    super.key,
    this.title,
    this.message,
    this.icon,
    this.onRetry,
  });

  @override
  Widget build(BuildContext context) {
    return Center(
      child: Padding(
        padding: const EdgeInsets.symmetric(horizontal: 30),
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            icon ??
                const Icon(Icons.info_outline, size: 60, color: Colors.grey),

            const SizedBox(height: 20),

            Text(
              title ?? "No Data Available",
              style: const TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
              textAlign: TextAlign.center,
            ),

            const SizedBox(height: 10),

            Text(
              message ?? "We couldn't find any details to display.",
              style: const TextStyle(fontSize: 14, color: Colors.grey),
              textAlign: TextAlign.center,
            ),

            if (onRetry != null) ...[
              const SizedBox(height: 20),

              ElevatedButton(onPressed: onRetry, child: const Text("Retry")),
            ],
          ],
        ),
      ),
    );
  }
}
''';
}