This commit is contained in:
2024-12-16 02:35:30 +03:00
parent 3800860d02
commit de1d6c85e5
12 changed files with 351 additions and 39 deletions

View File

@@ -2,6 +2,7 @@ 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';
import 'package:reverse_nn/application/services/schedule.dart';
class CurrentStatusComponent extends StatelessWidget {
const CurrentStatusComponent({super.key});
@@ -22,15 +23,16 @@ class CurrentStatusComponent extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Icon(Icons.exit_to_app, size: 96),
Icon(ScheduleService.getIconByDirection(scheduleController.currentSchedule.value?['direction']), 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)
Text(ScheduleService.formatDirection(scheduleController.currentSchedule.value?['direction'] ?? ''), style: Theme.of(context).textTheme.headlineLarge),
Text('C\t\t\t\t${formatDate(scheduleController.currentSchedule.value?['start'], showDate: scheduleController.currentSchedule.value!['need_show_end_date'])}', style: Theme.of(context).textTheme.titleMedium),
Text('До\t${formatDate(scheduleController.currentSchedule.value!['end'], showDate: scheduleController.currentSchedule.value!['need_show_end_date'])}', style: Theme.of(context).textTheme.titleMedium),
]
],
)
@@ -42,6 +44,6 @@ class CurrentStatusComponent extends StatelessWidget {
);
}
String formatDate(DateTime date) => DateFormat('hh:mm').format(date);
String formatDate(DateTime date, {bool showDate = false}) => DateFormat(showDate ? 'hh:mm (dd.MM.yyyy)' : 'hh:mm').format(date);
}