You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
decky/lib/widgets/status_chip.dart

45 lines
1.0 KiB

import 'package:flutter/material.dart';
import 'package:practice_engine/practice_engine.dart';
class StatusChip extends StatelessWidget {
final QuestionStatusChange statusChange;
const StatusChip({
super.key,
required this.statusChange,
});
@override
Widget build(BuildContext context) {
String label;
IconData icon;
Color color;
switch (statusChange) {
case QuestionStatusChange.improved:
label = 'Improved';
icon = Icons.trending_up;
color = Colors.green;
break;
case QuestionStatusChange.regressed:
label = 'Regressed';
icon = Icons.trending_down;
color = Colors.red;
break;
case QuestionStatusChange.unchanged:
label = 'Unchanged';
icon = Icons.remove;
color = Colors.grey;
break;
}
return Chip(
label: Text(label),
avatar: Icon(icon, size: 18, color: color),
backgroundColor: color.withValues(alpha: 0.1),
side: BorderSide(color: color),
);
}
}

Powered by TurnKey Linux.