import 'package:flutter/material.dart';
import 'package:sliding_up_panel/sliding_up_panel.dart';

import 'package:anyway/structs/trip.dart';

import 'package:anyway/modules/landmarks_overview.dart';
import 'package:anyway/modules/map.dart';
import 'package:anyway/modules/greeter.dart';



class NavigationOverview extends StatefulWidget {
  final Future<Trip> trip;

  NavigationOverview({
    required this.trip
  });

  @override
  State<NavigationOverview> createState() => _NavigationOverviewState();
}



class _NavigationOverviewState extends State<NavigationOverview> {

  @override
  Widget build(BuildContext context) {
    return SlidingUpPanel(
        renderPanelSheet: false,
        panel: _floatingPanel(),
        collapsed: _floatingCollapsed(),
        body: MapWidget(trip: widget.trip)
    );
  }

  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)
    );
  }

  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),
            ],
          ),
        ),
      ),
    ),
    );
  }

}