import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:go_router/go_router.dart';
import 'package:kasy_kit/components/kasy_app_bar.dart';
import 'package:kasy_kit/core/home_widgets/home_widget_mywidget_service.dart';
import 'package:kasy_kit/core/theme/theme.dart';
import 'package:kasy_kit/core/widgets/kasy_scroll_behavior.dart';
import 'package:kasy_kit/features/settings/ui/widgets/admin_card.dart';
import 'package:kasy_kit/i18n/translations.g.dart';

class AdminHomeWidgets extends ConsumerWidget {
  const AdminHomeWidgets({super.key});

  @override
  Widget build(BuildContext context, WidgetRef ref) {
    return ScrollConfiguration(
      behavior: const KasyKitScrollBehavior(),
      child: KasyOverlayScaffold(
        title: t.settings.admin.home_widgets_title,
        onBack: () => context.pop(),
        slivers: [
          SliverList.list(
            children: [
              AdminPanelCard(
                title: t.settings.admin.update_mywidget_title,
                description: t.settings.admin.update_mywidget_desc,
                onTap: () => ref
                    .watch(myWidgetHomeWidgetProvider.notifier)
                    .update(),
              ),
              const SizedBox(height: KasySpacing.md),
            ],
          ),
        ],
      ),
    );
  }
}
