import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'package:sf_app_platform/payments/domain/ports/theme_port.dart'; class AlertScreen extends StatefulWidget { const AlertScreen({super.key}); @override State createState() => AlertScreenState(); } class AlertScreenState extends State{ 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) { ThemePort theme = context.read(); return Scaffold( backgroundColor: theme.getColorFor(ThemeCode.background_secondary), body: Container( margin: EdgeInsets.all(30), child: Column( children: [ Row( children: [ Text("Alertas"), Spacer(), TextButton(onPressed: ()=>setState((){edit = !edit;}), child: Text("Editar")) ], ), Column( spacing: 20, children: buildActivity(context, activity, edit) ), ], ), ), ); } List buildActivity(BuildContext context, List activity, bool edit){ ThemePort theme = context.read(); final colors = [Colors.cyan, Colors.pinkAccent, Colors.deepOrangeAccent, Colors.red]; final icons = {"wage": Icons.wallet, "goal": Icons.emoji_events_outlined, "lock": Icons.lock_outline}; return List.generate(activity.length, (int index) { var logItem = Container( padding: EdgeInsets.all(20), decoration: BoxDecoration( color: theme.getColorFor(ThemeCode.background_primary), borderRadius: BorderRadius.all(Radius.circular(20)), border: BoxBorder.fromLTRB(left: BorderSide(color: colors[index%colors.length], width: 5)) ), child: Column( children: [ Row( children: [ Icon(icons[activity[index]["type"]], color: colors[index%colors.length]), Text("Entrega de paga", style: TextStyle(fontWeight: FontWeight.bold)), //Spacer(), Text("14/01/2005") ] ), Text("Ana tiene ya su paga de 5€ en el reloj") ] ) ); if(edit){ return Row(children: [ Checkbox( value: true, onChanged: (value)=>{}, activeColor: theme.getColorFor(ThemeCode.button_primary), semanticLabel: "Eliminar"), logItem ]); } else { return logItem; } }); } }