overhaul using a trip struct that notifies its ui dependencies
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import 'package:anyway/structs/landmark.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geocoding/geocoding.dart';
|
||||
|
||||
import 'package:anyway/layout.dart';
|
||||
import 'package:anyway/structs/preferences.dart';
|
||||
import 'package:anyway/utils/fetch_trip.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:anyway/structs/preferences.dart';
|
||||
import "package:anyway/structs/trip.dart";
|
||||
|
||||
|
||||
@@ -64,7 +66,16 @@ class _NewTripPageState extends State<NewTripPage> {
|
||||
double.parse(lonController.text)
|
||||
];
|
||||
Future<UserPreferences> preferences = loadUserPreferences();
|
||||
Future<Trip>? trip = fetchTrip(startPoint, preferences);
|
||||
Trip trip = Trip();
|
||||
trip.landmarks.add(
|
||||
Landmark(
|
||||
location: startPoint,
|
||||
name: "start",
|
||||
type: LandmarkType(name: 'start'),
|
||||
uuid: "pending"
|
||||
)
|
||||
);
|
||||
fetchTrip(trip, preferences);
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (context) => BasePage(mainScreen: "map", trip: trip)
|
||||
|
@@ -10,10 +10,10 @@ import 'package:anyway/modules/greeter.dart';
|
||||
|
||||
|
||||
class NavigationOverview extends StatefulWidget {
|
||||
final Future<Trip> trip;
|
||||
final Trip trip;
|
||||
|
||||
NavigationOverview({
|
||||
required this.trip
|
||||
required this.trip,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -27,53 +27,56 @@ class _NavigationOverviewState extends State<NavigationOverview> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SlidingUpPanel(
|
||||
renderPanelSheet: false,
|
||||
panel: _floatingPanel(),
|
||||
collapsed: _floatingCollapsed(),
|
||||
body: MapWidget(trip: widget.trip)
|
||||
// collapsed: _floatingCollapsed(),
|
||||
body: MapWidget(trip: widget.trip),
|
||||
// renderPanelSheet: false,
|
||||
// backdropEnabled: true,
|
||||
maxHeight: MediaQuery.of(context).size.height * 0.8,
|
||||
padding: EdgeInsets.all(10),
|
||||
// panelSnapping: false,
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(25), topRight: Radius.circular(25)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
blurRadius: 20.0,
|
||||
color: Colors.black,
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
Widget _floatingCollapsed(){
|
||||
final ThemeData theme = Theme.of(context);
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: theme.canvasColor,
|
||||
borderRadius: BorderRadius.only(topLeft: Radius.circular(24.0), topRight: Radius.circular(24.0)),
|
||||
boxShadow: []
|
||||
),
|
||||
|
||||
child: Greeter(standalone: true, trip: widget.trip)
|
||||
return Greeter(
|
||||
trip: widget.trip
|
||||
);
|
||||
}
|
||||
|
||||
Widget _floatingPanel(){
|
||||
final ThemeData theme = Theme.of(context);
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.all(Radius.circular(24.0)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
blurRadius: 20.0,
|
||||
color: theme.shadowColor,
|
||||
),
|
||||
]
|
||||
),
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: SingleChildScrollView(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Greeter(standalone: false, trip: widget.trip),
|
||||
LandmarksOverview(trip: widget.trip),
|
||||
],
|
||||
),
|
||||
return Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15),
|
||||
child:
|
||||
Center(
|
||||
child: Container(
|
||||
width: 40,
|
||||
height: 5,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.grey[300],
|
||||
borderRadius: BorderRadius.all(Radius.circular(12.0)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
Greeter(trip: widget.trip),
|
||||
LandmarksOverview(trip: widget.trip)
|
||||
]
|
||||
)
|
||||
)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user