diff --git a/lib/main.dart b/lib/main.dart index 777ef3e4b72c47c56d37ed7e9c842fa2a47cca3a..154184723adf4c8160e8d21b09e5e648c9428e0b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,4 +1,4 @@ -// ignore_for_file: prefer_const_constructors, sort_child_properties_last, import_of_legacy_library_into_null_safe, prefer_is_not_empty, unnecessary_null_comparison, deprecated_member_use, depend_on_referenced_packages +// ignore_for_file: prefer_const_constructors, sort_child_properties_last, import_of_legacy_library_into_null_safe, prefer_is_not_empty, unnecessary_null_comparison, deprecated_member_use, depend_on_referenced_packages, avoid_function_literals_in_foreach_calls import 'package:flutter/material.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:intl/intl.dart'; @@ -10,6 +10,7 @@ import 'package:geocoding/geocoding.dart'; import 'package:geolocator/geolocator.dart'; import 'package:http/http.dart' as http; import 'dart:convert'; +import 'package:weather_icons/weather_icons.dart'; void main() => runApp(MyApp()); @@ -23,7 +24,7 @@ class MyApp extends StatelessWidget { home: MyHomePage(), theme: ThemeData( fontFamily: 'Rubik', - primaryColor: Color.fromRGBO(22, 31, 68, 0.95), + primaryColor: Color.fromRGBO(22, 31, 68, 1), accentColor: Color.fromRGBO(250, 250, 250, 0.85), ), ); @@ -43,28 +44,28 @@ class _MyHomePageState extends State<MyHomePage> { CameraPosition(target: LatLng(52.5163, 13.3777), zoom: 12); late GoogleMapController _mapController; + // Input field texts for origin/dest points. + String originText = 'Starting Point...'; + String destinationText = 'Destination...'; + // Set origin/dest coords, respective markers, lat/lng coords between poits and polyline corresponding to coords. late LatLng _originCoordinates; late LatLng _destCoordinates; + int _markerCounter = 0; final Set<Marker> _markers = {}; late Directions _info; - final Set<Polyline> _polyline = {}; - - // Input field texts for origin/dest points. - String originText = 'Starting Point...'; - String destinationText = 'Destination...'; + Set<Polyline> _polyline = {}; - // Variables for calendar + // Variables for calendar and weather filter DateTimeRange _dateRange = DateTimeRange( start: DateTime.now(), end: DateTime.now(), ); bool _isDateChosen = false; + bool _showAdditionalButtons = false; + List<String> _selectedOptions = []; - FloatingActionButtonLocation _floatingActionButtonLocation = - FloatingActionButtonLocation.centerFloat; - - // Format text. + // Format input text. String getFormattedText(String inputText) { if (inputText != null) { if (inputText.length > 15) { @@ -74,6 +75,7 @@ class _MyHomePageState extends State<MyHomePage> { return inputText; } + // -------------------Section For Input Pages------------------- // Wait return value of input page to take origin point and update it's coords. void _awaitStartingPointReturnValue(BuildContext context) async { final result = await Navigator.push( @@ -98,6 +100,8 @@ class _MyHomePageState extends State<MyHomePage> { CameraPosition(target: _originCoordinates, zoom: 14), ), ); + _addOriginMarker(); + _resetPolyline(); } // Wait return value of input page to take dest point and update it's coords. @@ -125,82 +129,34 @@ class _MyHomePageState extends State<MyHomePage> { CameraPosition(target: _destCoordinates, zoom: 14), ), ); + _addDestinationMarker(); + _resetPolyline(); } - // Pick date - _rangeDatePicker(BuildContext ctx) async { - DateTimeRange? newDateTimeRange = await showDateRangePicker( - initialEntryMode: DatePickerEntryMode.calendarOnly, - context: context, - firstDate: DateTime.now(), - lastDate: DateTime(DateTime.now().year + 2), - initialDateRange: _dateRange, - builder: (context, child) { - return Theme( - data: Theme.of(context).copyWith( - colorScheme: ColorScheme.light( - primary: Theme.of(context).primaryColor, - onPrimary: Theme.of(context).accentColor, - onSurface: Theme.of(context).accentColor, - ), - textButtonTheme: TextButtonThemeData( - style: TextButton.styleFrom( - primary: Theme.of(context).accentColor, // Button text color - ), - ), - ), - child: child!, - ); - }, - ); - - // Update chosen date of global date variable. - if (newDateTimeRange == null) return; - setState(() { - _dateRange = newDateTimeRange; - _isDateChosen = true; - }); - } - - // Format and display date. - String convertDateFormat(date) { - DateFormat formatter = DateFormat('dd/MM'); - String formatted = formatter.format(date); - return formatted; - } - - String displayDate() { - if (_isDateChosen) { - return "${convertDateFormat(_dateRange.start)} - ${convertDateFormat(_dateRange.end)}"; - } - return ''; - } - + // -----------Section For Map Operations, Coords, Polyline..---------------- // Get shortest path. void _getShortestPath() async { - _addMarker(); - - _getDirections(); - + _resetPolyline(); _drawPolyline(); - - // Animate camera to the shortest path. - _mapController.animateCamera( - CameraUpdate.newLatLngBounds(_info.bounds, 100.0), - ); } // Add markers for origin/dest coords. - void _addMarker() { + void _addOriginMarker() { _markers.add( Marker( markerId: MarkerId('origin'), infoWindow: InfoWindow(title: 'Origin'), - icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueAzure), + icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueGreen), position: _originCoordinates, ), ); + setState(() { + _markers; + _markerCounter = 1; + }); + } + void _addDestinationMarker() { _markers.add( Marker( markerId: MarkerId('destination'), @@ -209,34 +165,49 @@ class _MyHomePageState extends State<MyHomePage> { position: _destCoordinates, ), ); - setState(() { _markers; + _markerCounter = 0; }); } // Get coords between origin/dest points corresponding to shortest path and update _info. // This part is going to be updated to take directions from backend instead of Direction API. - void _getDirections() async { + Future<Directions> _getDirections() async { final directions = await DirectionsRepo().getDirections( origin: _originCoordinates, destination: _destCoordinates); setState(() { _info = directions; }); + + return _info; } - // Draw Polyline between given list of coordinates and update _polyline.. + // Draw Polyline between given list of coordinates and update _polyline void _drawPolyline() { - _polyline.add(Polyline( - polylineId: PolylineId("polylineId"), - color: Theme.of(context).primaryColor, - width: 4, - points: _info.polylinePoints - .map((e) => LatLng(e.latitude, e.longitude)) - .toList(), - )); + _getDirections().then((value) { + _polyline.add(Polyline( + polylineId: PolylineId("polylineId"), + color: Theme.of(context).primaryColor, + width: 4, + points: value.polylinePoints + .map((e) => LatLng(e.latitude, e.longitude)) + .toList(), + )); + setState(() { + _polyline; + }); + // Animate camera to the shortest path. + _mapController.animateCamera( + CameraUpdate.newLatLngBounds(_info.bounds, 110.0), + ); + }); + } + // Helper function to reset polyline before calculating new polyline for another route. + void _resetPolyline() { + _polyline = {}; setState(() { _polyline; }); @@ -257,165 +228,485 @@ class _MyHomePageState extends State<MyHomePage> { setState(() { originText = json.decode(response.body)['results'][0]['formatted_address']; + _originCoordinates = + LatLng(position.latitude, position.longitude); }); + _mapController.animateCamera( + CameraUpdate.newCameraPosition( + CameraPosition(target: _destCoordinates, zoom: 14), + ), + ); + _addDestinationMarker(); + _resetPolyline(); }, ).catchError( (e) { - throw Error(); + print(e); }, ), }, ); } + void _appearOriginMarkerOnTouch(LatLng pos) async { + _resetPolyline(); + _markers.add( + Marker( + markerId: MarkerId('origin'), + infoWindow: InfoWindow(title: 'Origin'), + icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueGreen), + position: pos, + ), + ); + final url = Uri.parse( + 'https://maps.googleapis.com/maps/api/geocode/json?latlng=${pos.latitude},${pos.longitude}&key='); + final response = await http.get(url); + originText = json.decode(response.body)['results'][0]['formatted_address']; + setState(() { + _markers; + originText; + _originCoordinates = LatLng(pos.latitude, pos.longitude); + _markerCounter = 1; + }); + } + + void _appearDestMarkerOnTouch(LatLng pos) async { + _resetPolyline(); + _markers.add( + Marker( + markerId: MarkerId('dest'), + infoWindow: InfoWindow(title: 'Dest'), + icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueRed), + position: pos, + ), + ); + final url = Uri.parse( + 'https://maps.googleapis.com/maps/api/geocode/json?latlng=${pos.latitude},${pos.longitude}&key='); + final response = await http.get(url); + destinationText = + json.decode(response.body)['results'][0]['formatted_address']; + setState(() { + _markers; + destinationText; + _destCoordinates = LatLng(pos.latitude, pos.longitude); + _markerCounter = 0; + }); + } + +// ----------Section For Filter Functions, Calendar, Weather------------ +// Pick date + _rangeDatePicker(BuildContext ctx) async { + DateTimeRange? newDateTimeRange = await showDateRangePicker( + initialEntryMode: DatePickerEntryMode.calendarOnly, + context: context, + firstDate: DateTime.now(), + lastDate: DateTime(DateTime.now().year + 2), + initialDateRange: _dateRange, + builder: (context, child) { + return Theme( + data: Theme.of(context).copyWith( + colorScheme: ColorScheme.light( + primary: Theme.of(context).primaryColor, + onPrimary: Theme.of(context).accentColor, + onSurface: Theme.of(context).accentColor, + ), + textButtonTheme: TextButtonThemeData( + style: TextButton.styleFrom( + primary: Theme.of(context).accentColor, // Button text color + ), + ), + ), + child: child!, + ); + }, + ); + + // Update chosen date of global date variable. + if (newDateTimeRange == null) return; + setState(() { + _dateRange = newDateTimeRange; + _isDateChosen = true; + }); + } + + // Format and display date. + String convertDateFormat(date) { + DateFormat formatter = DateFormat('dd/MM'); + String formatted = formatter.format(date); + return formatted; + } + + String displayDate() { + if (_isDateChosen) { + return "${convertDateFormat(_dateRange.start)} - ${convertDateFormat(_dateRange.end)}"; + } + return ''; + } + + // Expand buttons + void _toggleAdditionalButtons() { + setState(() { + _showAdditionalButtons = !_showAdditionalButtons; + }); + } + + // Show weather options in bottom sheet + void _showOptions(BuildContext context) { + showModalBottomSheet( + context: context, + builder: (BuildContext context) { + return Container( + child: Wrap( + children: [ + ListTile( + leading: Icon(WeatherIcons.rain), + title: Text('Rain'), + onTap: () { + setState(() { + if (!_selectedOptions.contains('Rain')) { + _selectedOptions.add('Rain'); + } + }); + Navigator.of(context).pop(); + }, + ), + ListTile( + leading: Icon(WeatherIcons.wind_beaufort_1), + title: Text('Wind'), + onTap: () { + setState(() { + if (!_selectedOptions.contains('Wind')) { + _selectedOptions.add('Wind'); + } + }); + Navigator.of(context).pop(); + }, + ), + ListTile( + leading: Icon(WeatherIcons.snow), + title: Text('Snow'), + onTap: () { + setState(() { + if (!_selectedOptions.contains('Snow')) { + _selectedOptions.add('Snow'); + } + }); + Navigator.of(context).pop(); + }, + ), + ListTile( + leading: Icon(WeatherIcons.fog), + title: Text('Frost'), + onTap: () { + setState(() { + if (!_selectedOptions.contains('Frost')) { + _selectedOptions.add('Frost'); + } + }); + Navigator.of(context).pop(); + }, + ), + ], + ), + ); + }, + ); + } + + // Display selected weather conditions with icons + List<Widget> returnWidget() { + List<Widget> widgetList = []; + for (var item in _selectedOptions) { + widgetList.add(Text( + item, + style: TextStyle( + letterSpacing: 0.6, + fontSize: 19, + fontWeight: FontWeight.w400, + color: Theme.of(context).accentColor), + )); + widgetList.add(SizedBox( + child: Text(' '), + )); + widgetList.add( + Container(margin: EdgeInsets.only(bottom: 10), child: getIcon(item)), + ); + widgetList.add( + Text( + ' , ', + style: TextStyle(color: Theme.of(context).accentColor, fontSize: 26), + ), + ); + } + return widgetList.sublist(0, widgetList.length - 1); + } + + // Helper function to get corresponding icon + Icon getIcon(String iconName) { + switch (iconName) { + case 'Rain': + return Icon( + WeatherIcons.rain, + color: Theme.of(context).accentColor, + size: 22, + ); + case 'Wind': + return Icon( + WeatherIcons.wind_beaufort_1, + color: Theme.of(context).accentColor, + size: 22, + ); + case 'Snow': + return Icon( + WeatherIcons.snow, + color: Theme.of(context).accentColor, + size: 22, + ); + case 'Frost': + return Icon( + WeatherIcons.fog, + color: Theme.of(context).accentColor, + size: 22, + ); + default: + return Icon(Icons.abc); + } + } + + // Main App @override Widget build(BuildContext context) { return Scaffold( body: Stack( children: [ GoogleMap( - initialCameraPosition: _initialCameraPosition, - myLocationButtonEnabled: false, - zoomControlsEnabled: false, - onMapCreated: (controller) => _mapController = controller, - markers: _markers, - polylines: _polyline, - ), - Column( - children: [ - // Starting Input - Container( - margin: - EdgeInsets.only(top: 60, right: 20, bottom: 10, left: 20), - decoration: BoxDecoration( - border: Border.all( - width: 0.7, - color: Color.fromRGBO(0, 0, 0, 0.4), - ), - color: Theme.of(context).accentColor, - borderRadius: BorderRadius.all( - Radius.circular(30), + initialCameraPosition: _initialCameraPosition, + myLocationButtonEnabled: false, + zoomControlsEnabled: false, + onMapCreated: (controller) => _mapController = controller, + markers: _markers, + polylines: _polyline, + onLongPress: _markerCounter == 0 + ? _appearOriginMarkerOnTouch + : _appearDestMarkerOnTouch), + SafeArea( + child: Column( + children: [ + // Starting Input + Container( + margin: + EdgeInsets.only(top: 10, right: 20, bottom: 10, left: 20), + decoration: BoxDecoration( + border: Border.all( + width: 0.7, + color: Color.fromRGBO(0, 0, 0, 0.4), + ), + color: Theme.of(context).accentColor, + borderRadius: BorderRadius.all( + Radius.circular(30), + ), ), - ), - child: Row( - children: [ - SizedBox( - height: 45, - child: Container( - padding: EdgeInsets.only(right: 15, left: 10), - child: Icon( - Icons.person_pin_circle_outlined, - size: 34, - color: Theme.of(context).primaryColor, + child: Row( + children: [ + SizedBox( + height: 40, + child: Container( + padding: EdgeInsets.only(right: 15, left: 10), + child: Icon( + Icons.person_pin_circle_outlined, + size: 32, + color: Theme.of(context).primaryColor, + ), ), ), - ), - Expanded( - child: SizedBox( - height: 45, - child: TextField( - decoration: InputDecoration( - labelStyle: TextStyle( - letterSpacing: 1, - color: Color.fromRGBO(20, 20, 20, 1), + Expanded( + child: SizedBox( + height: 40, + child: TextField( + decoration: InputDecoration( + labelStyle: TextStyle( + letterSpacing: 1, + color: Color.fromRGBO(20, 20, 20, 1), + ), + border: InputBorder.none, + prefixText: getFormattedText(originText), + labelText: getFormattedText(originText), + floatingLabelBehavior: + FloatingLabelBehavior.never, ), - border: InputBorder.none, - prefixText: getFormattedText(originText), - labelText: getFormattedText(originText), - floatingLabelBehavior: FloatingLabelBehavior.never, - ), - style: TextStyle( - fontSize: 22, + style: TextStyle( + fontSize: 20, + ), + onTap: () { + _awaitStartingPointReturnValue(context); + }, ), - onTap: () { - _awaitStartingPointReturnValue(context); - }, ), ), - ), - SizedBox( - height: 45, - child: Container( - padding: EdgeInsets.only(right: 6, left: 10), - child: IconButton( - iconSize: 24, - icon: Icon( - Icons.my_location_outlined, - color: Theme.of(context).primaryColor, + SizedBox( + height: 40, + child: Container( + padding: EdgeInsets.only(right: 6, left: 10), + child: IconButton( + iconSize: 24, + icon: Icon( + Icons.my_location_outlined, + color: Theme.of(context).primaryColor, + ), + onPressed: _getCurrentLocation, ), - onPressed: _getCurrentLocation, ), ), - ), - ], + ], + ), ), - ), - // Destination Input - Container( - margin: EdgeInsets.only(right: 20, bottom: 15, left: 20), - decoration: BoxDecoration( - border: Border.all( - width: 0.7, - color: Color.fromRGBO(0, 0, 0, 0.4), + // Destination Input + Container( + margin: EdgeInsets.only(right: 20, bottom: 15, left: 20), + decoration: BoxDecoration( + border: Border.all( + width: 0.7, + color: Color.fromRGBO(0, 0, 0, 0.4), + ), + color: Theme.of(context).accentColor, + borderRadius: BorderRadius.all( + Radius.circular(30), + ), ), - color: Theme.of(context).accentColor, - borderRadius: BorderRadius.all( - Radius.circular(30), + child: Row( + children: [ + SizedBox( + height: 40, + child: Container( + padding: EdgeInsets.only(right: 15, left: 10), + child: Icon( + Icons.pin_drop_outlined, + size: 32, + color: Colors.red, + ), + ), + ), + Expanded( + child: SizedBox( + height: 40, + child: TextField( + decoration: InputDecoration( + labelStyle: TextStyle( + letterSpacing: 1, + color: Color.fromRGBO(20, 20, 20, 1), + ), + border: InputBorder.none, + prefixText: getFormattedText(destinationText), + labelText: getFormattedText(destinationText), + floatingLabelBehavior: + FloatingLabelBehavior.never, + ), + style: TextStyle( + fontSize: 20, + ), + onTap: () { + _awaitDestinationPointReturnValue(context); + }, + ), + ), + ), + ], ), ), - child: Row( + Row( children: [ - SizedBox( - height: 45, - child: Container( - padding: EdgeInsets.only(right: 15, left: 10), - child: Icon( - Icons.pin_drop_outlined, - size: 32, - color: Colors.red, - ), - ), - ), Expanded( child: SizedBox( - height: 45, - child: TextField( - decoration: InputDecoration( - labelStyle: TextStyle( - letterSpacing: 1, - color: Color.fromRGBO(20, 20, 20, 1), - ), - border: InputBorder.none, - prefixText: getFormattedText(destinationText), - labelText: getFormattedText(destinationText), - floatingLabelBehavior: FloatingLabelBehavior.never, + child: Container( + margin: EdgeInsets.only(left: 25), + child: Column( + children: [ + Row( + children: [ + CircleAvatar( + radius: 23, + backgroundColor: + Theme.of(context).primaryColor, + child: IconButton( + onPressed: _toggleAdditionalButtons, + icon: Icon(Icons.menu), + color: Theme.of(context).accentColor, + ), + ), + SizedBox(width: 10), + if (_showAdditionalButtons) + Expanded( + child: Row( + children: [ + CircleAvatar( + backgroundColor: + Theme.of(context).primaryColor, + radius: 20, + child: IconButton( + onPressed: () { + _rangeDatePicker(context); + // Do something when the first additional button is pressed + }, + icon: Icon(Icons.calendar_month), + color: + Theme.of(context).accentColor, + ), + ), + SizedBox(width: 10), + CircleAvatar( + backgroundColor: + Theme.of(context).primaryColor, + radius: 20, + child: IconButton( + onPressed: () { + _showOptions(context); + // Do something when the second additional button is pressed + }, + icon: Icon(Icons.sunny), + color: + Theme.of(context).accentColor, + ), + ), + SizedBox(width: 10), + CircleAvatar( + backgroundColor: + Theme.of(context).primaryColor, + radius: 20, + child: IconButton( + onPressed: () {}, + icon: Icon(Icons.car_crash), + color: + Theme.of(context).accentColor, + ), + ), + ], + ), + ), + ], + ), + ], ), - style: TextStyle( - fontSize: 21, - ), - onTap: () { - _awaitDestinationPointReturnValue(context); - }, ), ), ), - // Date Picker Icon Container( - margin: EdgeInsets.only(right: 5), - child: Column( - children: [ - IconButton( - icon: Icon(Icons.calendar_month), - iconSize: 26, - onPressed: () => _rangeDatePicker(context), - ), - ], + child: RawMaterialButton( + onPressed: _getShortestPath, + elevation: 5, + fillColor: Theme.of(context).primaryColor, + child: Icon( + Icons.navigation_rounded, + color: Theme.of(context).accentColor, + size: 24, + ), + padding: EdgeInsets.all(12), + shape: CircleBorder(), ), - ) + ), ], ), - ), - ], + ], + ), ), DraggableScrollableSheet( initialChildSize: 0.1, @@ -431,72 +722,110 @@ class _MyHomePageState extends State<MyHomePage> { ), color: Theme.of(context).primaryColor, ), - child: NotificationListener( - onNotification: (ScrollNotification scrollInfo) { - setState(() { - if (scrollInfo.metrics.pixels > 0.0) { - _floatingActionButtonLocation = - FloatingActionButtonLocation.miniCenterDocked; - } - }); - - return true; - }, - child: ListView.builder( - controller: scrollController, - itemCount: 1, - padding: EdgeInsets.all(30), - itemBuilder: (BuildContext context, int index) { - return Container( - width: double.infinity, - height: 94, - child: Row( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - 'Picked Date: ', - style: TextStyle( - fontSize: 22, - fontWeight: FontWeight.w500, - color: Theme.of(context).accentColor), + child: ListView.builder( + controller: scrollController, + itemCount: 1, + padding: EdgeInsets.all(30), + itemBuilder: (BuildContext context, int index) { + return Container( + width: double.infinity, + height: 150, + child: Column( + children: [ + Container( + margin: EdgeInsets.only(bottom: 15), + padding: EdgeInsets.only(bottom: 15), + decoration: BoxDecoration( + border: Border( + bottom: BorderSide( + color: Theme.of(context).accentColor, + width: 0.4), + ), ), - Text( - displayDate(), - style: TextStyle( - fontSize: 21, - fontWeight: FontWeight.w400, - color: Theme.of(context).accentColor), + child: Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + padding: EdgeInsets.only(right: 3, top: 4), + child: Icon( + Icons.double_arrow_rounded, + color: Theme.of(context).accentColor, + size: 18, + ), + ), + Text( + 'Picked Date ', + style: TextStyle( + letterSpacing: 0.6, + fontSize: 22, + fontWeight: FontWeight.w500, + color: Theme.of(context).accentColor), + ), + Text( + displayDate(), + style: TextStyle( + fontSize: 21, + fontWeight: FontWeight.w400, + color: Theme.of(context).accentColor), + ), + ], ), - ], - ), - ); - }, - ), + ), + Container( + margin: EdgeInsets.only(bottom: 10), + padding: EdgeInsets.only(bottom: 20), + child: Column( + children: [ + Container( + margin: EdgeInsets.only(bottom: 5), + child: Row( + crossAxisAlignment: + CrossAxisAlignment.start, + children: [ + Container( + padding: + EdgeInsets.only(right: 3, top: 4), + child: Icon( + Icons.double_arrow_rounded, + color: Theme.of(context).accentColor, + size: 18, + ), + ), + Text( + 'Undesired Weather', + style: TextStyle( + letterSpacing: 0.6, + fontSize: 22, + fontWeight: FontWeight.w500, + color: + Theme.of(context).accentColor), + ), + ], + ), + ), + Row( + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + SizedBox( + width: 10, + ), + if (!_selectedOptions.isEmpty) + ...returnWidget(), + ], + ), + ], + ), + ), + ], + ), + ); + }, ), ); }, ) ], ), - floatingActionButton: Container( - padding: EdgeInsets.only(bottom: 50), - child: FloatingActionButton.extended( - onPressed: _getShortestPath, - label: Text( - 'Get Route', - style: TextStyle( - fontSize: 18, - ), - ), - icon: Icon( - Icons.navigation, - size: 26, - ), - backgroundColor: Theme.of(context).primaryColor, - foregroundColor: Theme.of(context).accentColor, - ), - ), - floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat, ); } } diff --git a/lib/widgets/returnDestination.dart b/lib/widgets/returnDestination.dart index b2675023ae421f2067a5d684c16ac974ca84dfc3..de579e3bbfdd6206df54d01aea1ffc8e02bfa888 100644 --- a/lib/widgets/returnDestination.dart +++ b/lib/widgets/returnDestination.dart @@ -25,7 +25,7 @@ class _ReturnDestinationState extends State<ReturnDestination> { ); var jsonData = jsonDecode(response.body); suggestions = []; - for (int i = 0; i < 10; i++) { + for (int i = 0; i < jsonData['predictions'][i].length; i++) { suggestions.add(jsonData['predictions'][i]['description'].toString()); } return suggestions; @@ -46,7 +46,7 @@ class _ReturnDestinationState extends State<ReturnDestination> { 'Destination Point', style: TextStyle( color: Theme.of(context).accentColor, - fontSize: 24, + fontSize: 22, ), ), leading: IconButton( @@ -79,7 +79,7 @@ class _ReturnDestinationState extends State<ReturnDestination> { Radius.circular(30), ), ), - height: 50, + height: 45, child: TypeAheadField( animationStart: 0, animationDuration: Duration.zero, @@ -98,7 +98,7 @@ class _ReturnDestinationState extends State<ReturnDestination> { floatingLabelBehavior: FloatingLabelBehavior.never, ), style: TextStyle( - fontSize: 22, + fontSize: 20, color: Theme.of(context).primaryColor, ), ), @@ -125,7 +125,7 @@ class _ReturnDestinationState extends State<ReturnDestination> { child: Text( textField.toString(), style: TextStyle( - fontSize: 21, + fontSize: 20, color: Theme.of(context).primaryColor, ), ), diff --git a/lib/widgets/returnOrigin.dart b/lib/widgets/returnOrigin.dart index 67af48b998903cc60992d83396a8163f52d25808..03f285c022b90eb765dae9b1bac0e8253d51b8d4 100644 --- a/lib/widgets/returnOrigin.dart +++ b/lib/widgets/returnOrigin.dart @@ -24,7 +24,7 @@ class _ReturnOriginState extends State<ReturnOrigin> { ); var jsonData = jsonDecode(response.body); suggestions = []; - for (int i = 0; i < 10; i++) { + for (int i = 0; i < jsonData['predictions'][i].length; i++) { suggestions.add(jsonData['predictions'][i]['description'].toString()); } return suggestions; @@ -45,7 +45,7 @@ class _ReturnOriginState extends State<ReturnOrigin> { 'Starting Point', style: TextStyle( color: Theme.of(context).accentColor, - fontSize: 24, + fontSize: 22, ), ), leading: IconButton( @@ -78,7 +78,7 @@ class _ReturnOriginState extends State<ReturnOrigin> { Radius.circular(30), ), ), - height: 50, + height: 45, child: TypeAheadField( animationStart: 0, animationDuration: Duration.zero, @@ -97,7 +97,7 @@ class _ReturnOriginState extends State<ReturnOrigin> { floatingLabelBehavior: FloatingLabelBehavior.never, ), style: TextStyle( - fontSize: 22, + fontSize: 20, color: Theme.of(context).primaryColor, ), ), @@ -124,7 +124,7 @@ class _ReturnOriginState extends State<ReturnOrigin> { child: Text( textField.toString(), style: TextStyle( - fontSize: 21, + fontSize: 20, color: Theme.of(context).primaryColor, ), ), diff --git a/pubspec.lock b/pubspec.lock index d0380820a4a861a9557ef7151481da98c1e0ecc5..773397f32c4b60ac236861ca6495ad3e1d93ea5a 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -25,6 +25,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.1" + bottom_bar_with_sheet: + dependency: "direct main" + description: + name: bottom_bar_with_sheet + sha256: c9a43e90cb6886d1e012be661693a8b847d1b1879c81176b74d72a29eb4bf644 + url: "https://pub.dev" + source: hosted + version: "2.4.0" characters: dependency: transitive description: @@ -589,6 +597,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" + weather_icons: + dependency: "direct main" + description: + name: weather_icons + sha256: "76bd96fda0b723fba74a35083b6d77313306aae4c0f915636cbb7299b69d3b91" + url: "https://pub.dev" + source: hosted + version: "3.0.0" wkt_parser: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 306b871454cd3e682950093c260697b1f04966d3..082bf5a0ac010d73c5670102a9a80ef4331f840e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -37,6 +37,7 @@ dependencies: google_maps_flutter: ^2.0.2 geocoding: ^2.1.0 location: ^4.2.0 + weather_icons: ^3.0.0 # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. @@ -48,6 +49,7 @@ dependencies: latlong2: ^0.8.1 geolocator: ^9.0.2 geocoder: ^0.2.1 + bottom_bar_with_sheet: ^2.4.0 dev_dependencies: flutter_test: