mobile_skt/lib/screens/home/components/task_detail_col.dart

69 lines
2.4 KiB
Dart
Raw Normal View History

2024-03-19 11:09:07 +08:00
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:sk_base_mobile/constants/bg_color.dart';
import 'package:sk_base_mobile/constants/data.dart';
import 'package:sk_base_mobile/screens/home/home_controller.dart';
class TaskTitle extends StatelessWidget {
TaskTitle({super.key, required this.index, required this.ind});
final int index;
final int ind;
final int randomColor1 = Random().nextInt(9);
final int randomColor2 = Random().nextInt(9);
final controller = Get.put(HomeController());
@override
Widget build(BuildContext context) {
return Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
controller.list[ind][index].title,
style: const TextStyle(
color: Colors.black, fontWeight: FontWeight.bold, fontSize: 20),
),
Text(
'${controller.list[ind][index].startTime} - ${controller.list[ind][index].endTime}',
style: const TextStyle(
color: Colors.grey, fontWeight: FontWeight.w300, fontSize: 12),
),
const SizedBox(
height: defaultPadding / 2,
),
Row(
children: [
Container(
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 10),
decoration: BoxDecoration(
color: Data().colors[randomColor1].withOpacity(.5),
borderRadius: BorderRadius.circular(10),
),
child: Text(
Data().tags[Random().nextInt(13)],
style: TextStyle(color: Data().colors[randomColor1]),
),
),
const SizedBox(
width: defaultPadding / 2,
),
Container(
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 10),
decoration: BoxDecoration(
color: Data().colors[randomColor2].withOpacity(.5),
borderRadius: BorderRadius.circular(10)),
child: Text(
Data().tags[Random().nextInt(13)],
style: TextStyle(color: Data().colors[randomColor2]),
),
)
],
),
],
);
}
}