import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:notifications/src/core/activity_list.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

class AlertScreen extends ConsumerStatefulWidget {
  const AlertScreen({super.key});

  @override
  ConsumerState<AlertScreen> createState() => AlertScreenState();
}

class AlertScreenState extends ConsumerState<AlertScreen> {
  final activity = [
    {"type": "goal"},
    {"type": "wage", "amount": 5},
    {"type": "lock"},
    {"type": "lock"},
  ];
  bool edit = false;

  @override
  void initState() {
    edit = false;
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    final theme = ref.watch(themePortProvider);

    return SafeArea(
      child: Container(
        color: theme.getColorFor(ThemeCode.backgroundSecondary),
        margin: EdgeInsets.symmetric(horizontal: 24, vertical: 16),
        child: Column(
          spacing: 32,
          children: [
            Row(
              children: [
                Text(
                  "Alertas",
                    style: TextStyle(
                      fontSize: 24,
                      letterSpacing: 0,
                      fontWeight: FontWeight.w500
                    )
                ),
                Spacer(),
                TextButton(
                  onPressed: () => setState(() {
                    edit = !edit;
                  }),
                  child: Text("Editar", style: TextStyle(fontSize: 16, letterSpacing: 0)),
                ),
              ],
            ),
            Expanded(
              child: SingleChildScrollView(
                child: ActivityList(activity: activity, edit: edit)
              )
            )
          ],
        ),
      ),
    );
  }
}
