79 lines
2.5 KiB
Dart
79 lines
2.5 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:reverse_nn/enums/direction.dart';
|
|
import 'package:reverse_nn/enums/schedule.dart';
|
|
import 'package:sprintf/sprintf.dart';
|
|
|
|
class CurrentReversWidget extends StatelessWidget {
|
|
const CurrentReversWidget({super.key, required this.scheduleElement});
|
|
|
|
final ScheduleElement scheduleElement;
|
|
|
|
IconData _getIconData() {
|
|
switch(scheduleElement.direction) {
|
|
case Direction.inCity: return Icons.arrow_upward;
|
|
case Direction.outCity: return Icons.arrow_downward;
|
|
case Direction.change: return Icons.cancel_outlined;
|
|
}
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.all(16.0),
|
|
|
|
decoration: BoxDecoration(
|
|
borderRadius: const BorderRadius.all(Radius.circular(8.0)),
|
|
color: Theme.of(context).colorScheme.primaryContainer
|
|
),
|
|
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
Icon(_getIconData(), size: 56.0),
|
|
const SizedBox(width: 10),
|
|
Column(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text('Реверс: ${scheduleElement.direction.displayName}', style: const TextStyle(fontSize: 20)),
|
|
Text('${scheduleElement.getStartedTimeString()} - ${scheduleElement.getEndedTimeString()}', style: const TextStyle(fontSize: 36)),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class ScheduledReversWidget extends StatelessWidget {
|
|
const ScheduledReversWidget({super.key, required this.scheduleElement});
|
|
|
|
final ScheduleElement scheduleElement;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
padding: const EdgeInsets.all(8),
|
|
margin: const EdgeInsets.symmetric(horizontal: 8),
|
|
|
|
decoration: BoxDecoration(
|
|
borderRadius: const BorderRadius.all(Radius.circular(8.0)),
|
|
color: Theme.of(context).colorScheme.secondaryContainer
|
|
),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
children: <Widget>[
|
|
Text(sprintf('Следующий статус в %02i:%02i - %s', [
|
|
scheduleElement.startHours,
|
|
scheduleElement.startMinutes,
|
|
scheduleElement.direction.displayName
|
|
])),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
} |