import 'package:flutter/material.dart';
import 'difficulty.dart';
class Task extends StatefulWidget {
final String taskName;
final String taskImage;
final int taskPrice;
const Task(
{super.key,
required this.taskName,
required this.taskImage,
required this.taskPrice});
@override
State<Task> createState() => _TaskState();
}
class _TaskState extends State<Task> {
int level = 0;
int mastery = 10;
Color color = const Color.fromARGB(250, 26, 35, 126);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Stack(
children: [
Container(...),
Column(
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(4),
color: Colors.white),
height: 100,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(...),
Column(...),
SizedBox(
width: 70,
height: 55,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: const Color.fromARGB(250, 26, 35, 126),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(6.0))),
onPressed: () {
setState(() {
if(level < mastery){
level++;
}else{
level = 1;
mastery = mastery + 10;
switch(mastery){
case 20:
color = const Color.fromARGB(
250, 182, 137, 53);
break;
case 30:
color = const Color.fromARGB(
250, 57, 182, 53);
break;
case 40:
color = const Color.fromARGB(
250, 182, 53, 53);
break;
case 50:
color = const Color.fromARGB(
250, 12, 12, 12);
break;
default:
color = const Color.fromARGB(250, 26, 35, 126);
}
}
});
},
child: const Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(
Icons.arrow_drop_up,
color: Colors.white,
),
Text("UP",
style: TextStyle(
color: Colors.white, fontSize: 12))
],
)),
)
],
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(
width: 200,
child: LinearProgressIndicator(
backgroundColor: Colors.white,
color: const Color.fromARGB(250, 26, 35, 100),
value: level / mastery,
)),
Text(
'Nivel $level',
style: const TextStyle(color: Colors.white),
),
],
),
),
],
),
],
),
);
}
}