44 lines
1.3 KiB
Dart
44 lines
1.3 KiB
Dart
import 'package:anyway/structs/trip.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
class CurrentTripSummary extends StatefulWidget {
|
|
final Trip trip;
|
|
const CurrentTripSummary({
|
|
super.key,
|
|
required this.trip,
|
|
});
|
|
|
|
@override
|
|
State<CurrentTripSummary> createState() => _CurrentTripSummaryState();
|
|
}
|
|
|
|
class _CurrentTripSummaryState extends State<CurrentTripSummary> {
|
|
@override
|
|
Widget build(BuildContext context) => ListenableBuilder(
|
|
listenable: widget.trip,
|
|
builder: (context, child) => Padding(
|
|
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 20),
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
const Icon(Icons.flag, size: 20),
|
|
const Padding(padding: EdgeInsets.only(right: 10)),
|
|
Text('${widget.trip.landmarks.length} stops', style: Theme.of(context).textTheme.bodyLarge),
|
|
]
|
|
),
|
|
Row(
|
|
children: [
|
|
const Icon(Icons.hourglass_bottom_rounded, size: 20),
|
|
const Padding(padding: EdgeInsets.only(right: 10)),
|
|
Text('${widget.trip.totalTime.inHours}h ${widget.trip.totalTime.inMinutes.remainder(60)}min', style: Theme.of(context).textTheme.bodyLarge),
|
|
]
|
|
),
|
|
],
|
|
)
|
|
)
|
|
);
|
|
}
|