52 lines
1.8 KiB
Dart
52 lines
1.8 KiB
Dart
import 'package:anyway/constants.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:sliding_up_panel/sliding_up_panel.dart';
|
|
|
|
import 'package:anyway/structs/trip.dart';
|
|
import 'package:anyway/modules/current_trip_map.dart';
|
|
import 'package:anyway/modules/current_trip_panel.dart';
|
|
|
|
|
|
|
|
class TripPage extends StatefulWidget {
|
|
final Trip trip;
|
|
|
|
TripPage({
|
|
required this.trip,
|
|
});
|
|
|
|
@override
|
|
State<TripPage> createState() => _TripPageState();
|
|
}
|
|
|
|
|
|
|
|
class _TripPageState extends State<TripPage> {
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SlidingUpPanel(
|
|
// use panelBuilder instead of panel so that we can reuse the scrollcontroller for the listview
|
|
panelBuilder: (scrollcontroller) => CurrentTripPanel(controller: scrollcontroller, trip: widget.trip),
|
|
// using collapsed and panelBuilder seems to show both at the same time, so we include the greeter in the panelBuilder
|
|
// collapsed: Greeter(trip: widget.trip),
|
|
body: CurrentTripMap(trip: widget.trip),
|
|
minHeight: MediaQuery.of(context).size.height * TRIP_PANEL_MIN_HEIGHT,
|
|
maxHeight: MediaQuery.of(context).size.height * TRIP_PANEL_MAX_HEIGHT,
|
|
// padding in this context is annoying: it offsets the notion of vertical alignment.
|
|
// children that want to be centered vertically need to have their size adjusted by 2x the padding
|
|
padding: const EdgeInsets.only(top: 10),
|
|
// Panel snapping should not be disabled because it significantly improves the user experience
|
|
// panelSnapping: false
|
|
borderRadius: const BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)),
|
|
parallaxEnabled: true,
|
|
boxShadow: const [
|
|
BoxShadow(
|
|
blurRadius: 20.0,
|
|
color: Colors.black,
|
|
)
|
|
],
|
|
);
|
|
}
|
|
}
|