47 lines
1.8 KiB
Dart
47 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:intl/intl.dart' show DateFormat;
|
|
import 'package:reverse_nn/application/controllers/schedule_controller.dart';
|
|
|
|
class CurrentStatusComponent extends StatelessWidget {
|
|
const CurrentStatusComponent({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final ScheduleController controller = Get.put(ScheduleController());
|
|
return Container(
|
|
decoration: BoxDecoration(
|
|
color: Theme.of(context).colorScheme.primaryContainer,
|
|
borderRadius: BorderRadius.circular(10),
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(10),
|
|
child: GetBuilder<ScheduleController>(
|
|
builder: (scheduleController) {
|
|
return Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: [
|
|
const Icon(Icons.exit_to_app, size: 96),
|
|
const SizedBox(width: 16),
|
|
Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
if(scheduleController.currentSchedule.value != null) ...[
|
|
Text(scheduleController.currentSchedule.value?['direction'] ?? '', style: Theme.of(context).textTheme.headlineLarge),
|
|
Text('C ${formatDate(scheduleController.currentSchedule.value?['start'])} До ${formatDate(scheduleController.currentSchedule.value!['end'])}', style: Theme.of(context).textTheme.titleMedium)
|
|
]
|
|
],
|
|
)
|
|
],
|
|
);
|
|
}
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
String formatDate(DateTime date) => DateFormat('hh:mm').format(date);
|
|
|
|
} |