clean console problems
This commit is contained in:
@@ -4,9 +4,9 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class ActivityList extends ConsumerStatefulWidget {
|
||||
final List activity;
|
||||
bool edit = false;
|
||||
final bool edit;
|
||||
|
||||
ActivityList({super.key, required this.activity, required this.edit});
|
||||
const ActivityList({super.key, required this.activity, this.edit = false});
|
||||
|
||||
@override
|
||||
ConsumerState<ActivityList> createState() => ActivityListState();
|
||||
@@ -17,27 +17,29 @@ class ActivityListState extends ConsumerState<ActivityList> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
values = List<bool>.generate(widget.activity.length, (_) => false);
|
||||
super.initState();
|
||||
values = List<bool>.generate(widget.activity.length, (_) => false);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
final colors = [
|
||||
const colors = [
|
||||
Colors.cyan,
|
||||
Colors.pinkAccent,
|
||||
Colors.deepOrangeAccent,
|
||||
Colors.red,
|
||||
];
|
||||
final icons = {
|
||||
|
||||
const icons = {
|
||||
"wage": Icons.wallet,
|
||||
"goal": Icons.emoji_events_outlined,
|
||||
"lock": Icons.lock_outline,
|
||||
"reload": Icons.attach_money_outlined,
|
||||
};
|
||||
final titles = {
|
||||
|
||||
const titles = {
|
||||
"wage": "Entrega de paga",
|
||||
"goal": "¡Objetivo cumplido!",
|
||||
"lock": "Bloqueo de pago",
|
||||
@@ -47,33 +49,35 @@ class ActivityListState extends ConsumerState<ActivityList> {
|
||||
return Column(
|
||||
spacing: 20,
|
||||
children: List<Widget>.generate(widget.activity.length, (int index) {
|
||||
var logItem = Container(
|
||||
padding: EdgeInsets.all(20),
|
||||
final color = colors[index % colors.length];
|
||||
final type = widget.activity[index]["type"] as String;
|
||||
|
||||
final logItem = Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
borderRadius: BorderRadius.all(Radius.circular(20)),
|
||||
border: BoxBorder.fromLTRB(
|
||||
left: BorderSide(color: colors[index % colors.length], width: 5),
|
||||
),
|
||||
borderRadius: const BorderRadius.all(Radius.circular(20)),
|
||||
border: Border(left: BorderSide(color: color, width: 5)),
|
||||
),
|
||||
child: Column(
|
||||
spacing: 15,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Icon(
|
||||
icons[widget.activity[index]["type"]],
|
||||
color: colors[index % colors.length],
|
||||
),
|
||||
Icon(icons[type], color: color),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
titles[widget.activity[index]["type"]]!,
|
||||
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 16),
|
||||
titles[type]!,
|
||||
style: const TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
Spacer(),
|
||||
Text("14/01/2005"),
|
||||
const Spacer(),
|
||||
const Text("14/01/2005"),
|
||||
],
|
||||
),
|
||||
Align(
|
||||
const Align(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Text("Ana ya tiene su paga de 5€ en el reloj"),
|
||||
),
|
||||
@@ -86,10 +90,10 @@ class ActivityListState extends ConsumerState<ActivityList> {
|
||||
children: [
|
||||
Checkbox(
|
||||
value: values[index],
|
||||
onChanged: (value) => {
|
||||
onChanged: (_) {
|
||||
setState(() {
|
||||
values[index] = !values[index];
|
||||
}),
|
||||
});
|
||||
},
|
||||
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
|
||||
semanticLabel: "Eliminar",
|
||||
|
||||
Reference in New Issue
Block a user