Skip to content
Snippets Groups Projects
Commit 2c182566 authored by alper-savas's avatar alper-savas
Browse files

Bugfix, improve core functionality.

parent 24fda6e9
No related branches found
No related tags found
1 merge request!6final project merge into main
// 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:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart'; import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:intl/intl.dart'; import 'package:intl/intl.dart';
...@@ -10,6 +10,7 @@ import 'package:geocoding/geocoding.dart'; ...@@ -10,6 +10,7 @@ import 'package:geocoding/geocoding.dart';
import 'package:geolocator/geolocator.dart'; import 'package:geolocator/geolocator.dart';
import 'package:http/http.dart' as http; import 'package:http/http.dart' as http;
import 'dart:convert'; import 'dart:convert';
import 'package:weather_icons/weather_icons.dart';
void main() => runApp(MyApp()); void main() => runApp(MyApp());
...@@ -23,7 +24,7 @@ class MyApp extends StatelessWidget { ...@@ -23,7 +24,7 @@ class MyApp extends StatelessWidget {
home: MyHomePage(), home: MyHomePage(),
theme: ThemeData( theme: ThemeData(
fontFamily: 'Rubik', 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), accentColor: Color.fromRGBO(250, 250, 250, 0.85),
), ),
); );
...@@ -43,28 +44,28 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -43,28 +44,28 @@ class _MyHomePageState extends State<MyHomePage> {
CameraPosition(target: LatLng(52.5163, 13.3777), zoom: 12); CameraPosition(target: LatLng(52.5163, 13.3777), zoom: 12);
late GoogleMapController _mapController; 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. // Set origin/dest coords, respective markers, lat/lng coords between poits and polyline corresponding to coords.
late LatLng _originCoordinates; late LatLng _originCoordinates;
late LatLng _destCoordinates; late LatLng _destCoordinates;
int _markerCounter = 0;
final Set<Marker> _markers = {}; final Set<Marker> _markers = {};
late Directions _info; late Directions _info;
final Set<Polyline> _polyline = {}; Set<Polyline> _polyline = {};
// Input field texts for origin/dest points. // Variables for calendar and weather filter
String originText = 'Starting Point...';
String destinationText = 'Destination...';
// Variables for calendar
DateTimeRange _dateRange = DateTimeRange( DateTimeRange _dateRange = DateTimeRange(
start: DateTime.now(), start: DateTime.now(),
end: DateTime.now(), end: DateTime.now(),
); );
bool _isDateChosen = false; bool _isDateChosen = false;
bool _showAdditionalButtons = false;
List<String> _selectedOptions = [];
FloatingActionButtonLocation _floatingActionButtonLocation = // Format input text.
FloatingActionButtonLocation.centerFloat;
// Format text.
String getFormattedText(String inputText) { String getFormattedText(String inputText) {
if (inputText != null) { if (inputText != null) {
if (inputText.length > 15) { if (inputText.length > 15) {
...@@ -74,6 +75,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -74,6 +75,7 @@ class _MyHomePageState extends State<MyHomePage> {
return inputText; return inputText;
} }
// -------------------Section For Input Pages-------------------
// Wait return value of input page to take origin point and update it's coords. // Wait return value of input page to take origin point and update it's coords.
void _awaitStartingPointReturnValue(BuildContext context) async { void _awaitStartingPointReturnValue(BuildContext context) async {
final result = await Navigator.push( final result = await Navigator.push(
...@@ -98,6 +100,8 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -98,6 +100,8 @@ class _MyHomePageState extends State<MyHomePage> {
CameraPosition(target: _originCoordinates, zoom: 14), CameraPosition(target: _originCoordinates, zoom: 14),
), ),
); );
_addOriginMarker();
_resetPolyline();
} }
// Wait return value of input page to take dest point and update it's coords. // Wait return value of input page to take dest point and update it's coords.
...@@ -125,82 +129,34 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -125,82 +129,34 @@ class _MyHomePageState extends State<MyHomePage> {
CameraPosition(target: _destCoordinates, zoom: 14), CameraPosition(target: _destCoordinates, zoom: 14),
), ),
); );
_addDestinationMarker();
_resetPolyline();
} }
// Pick date // -----------Section For Map Operations, Coords, Polyline..----------------
_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 '';
}
// Get shortest path. // Get shortest path.
void _getShortestPath() async { void _getShortestPath() async {
_addMarker(); _resetPolyline();
_getDirections();
_drawPolyline(); _drawPolyline();
// Animate camera to the shortest path.
_mapController.animateCamera(
CameraUpdate.newLatLngBounds(_info.bounds, 100.0),
);
} }
// Add markers for origin/dest coords. // Add markers for origin/dest coords.
void _addMarker() { void _addOriginMarker() {
_markers.add( _markers.add(
Marker( Marker(
markerId: MarkerId('origin'), markerId: MarkerId('origin'),
infoWindow: InfoWindow(title: 'Origin'), infoWindow: InfoWindow(title: 'Origin'),
icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueAzure), icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueGreen),
position: _originCoordinates, position: _originCoordinates,
), ),
); );
setState(() {
_markers;
_markerCounter = 1;
});
}
void _addDestinationMarker() {
_markers.add( _markers.add(
Marker( Marker(
markerId: MarkerId('destination'), markerId: MarkerId('destination'),
...@@ -209,34 +165,49 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -209,34 +165,49 @@ class _MyHomePageState extends State<MyHomePage> {
position: _destCoordinates, position: _destCoordinates,
), ),
); );
setState(() { setState(() {
_markers; _markers;
_markerCounter = 0;
}); });
} }
// Get coords between origin/dest points corresponding to shortest path and update _info. // 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. // 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( final directions = await DirectionsRepo().getDirections(
origin: _originCoordinates, destination: _destCoordinates); origin: _originCoordinates, destination: _destCoordinates);
setState(() { setState(() {
_info = directions; _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() { void _drawPolyline() {
_getDirections().then((value) {
_polyline.add(Polyline( _polyline.add(Polyline(
polylineId: PolylineId("polylineId"), polylineId: PolylineId("polylineId"),
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
width: 4, width: 4,
points: _info.polylinePoints points: value.polylinePoints
.map((e) => LatLng(e.latitude, e.longitude)) .map((e) => LatLng(e.latitude, e.longitude))
.toList(), .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(() { setState(() {
_polyline; _polyline;
}); });
...@@ -257,17 +228,252 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -257,17 +228,252 @@ class _MyHomePageState extends State<MyHomePage> {
setState(() { setState(() {
originText = originText =
json.decode(response.body)['results'][0]['formatted_address']; 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( ).catchError(
(e) { (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 @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
...@@ -280,13 +486,16 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -280,13 +486,16 @@ class _MyHomePageState extends State<MyHomePage> {
onMapCreated: (controller) => _mapController = controller, onMapCreated: (controller) => _mapController = controller,
markers: _markers, markers: _markers,
polylines: _polyline, polylines: _polyline,
), onLongPress: _markerCounter == 0
Column( ? _appearOriginMarkerOnTouch
: _appearDestMarkerOnTouch),
SafeArea(
child: Column(
children: [ children: [
// Starting Input // Starting Input
Container( Container(
margin: margin:
EdgeInsets.only(top: 60, right: 20, bottom: 10, left: 20), EdgeInsets.only(top: 10, right: 20, bottom: 10, left: 20),
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
width: 0.7, width: 0.7,
...@@ -300,19 +509,19 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -300,19 +509,19 @@ class _MyHomePageState extends State<MyHomePage> {
child: Row( child: Row(
children: [ children: [
SizedBox( SizedBox(
height: 45, height: 40,
child: Container( child: Container(
padding: EdgeInsets.only(right: 15, left: 10), padding: EdgeInsets.only(right: 15, left: 10),
child: Icon( child: Icon(
Icons.person_pin_circle_outlined, Icons.person_pin_circle_outlined,
size: 34, size: 32,
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
), ),
), ),
), ),
Expanded( Expanded(
child: SizedBox( child: SizedBox(
height: 45, height: 40,
child: TextField( child: TextField(
decoration: InputDecoration( decoration: InputDecoration(
labelStyle: TextStyle( labelStyle: TextStyle(
...@@ -322,10 +531,11 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -322,10 +531,11 @@ class _MyHomePageState extends State<MyHomePage> {
border: InputBorder.none, border: InputBorder.none,
prefixText: getFormattedText(originText), prefixText: getFormattedText(originText),
labelText: getFormattedText(originText), labelText: getFormattedText(originText),
floatingLabelBehavior: FloatingLabelBehavior.never, floatingLabelBehavior:
FloatingLabelBehavior.never,
), ),
style: TextStyle( style: TextStyle(
fontSize: 22, fontSize: 20,
), ),
onTap: () { onTap: () {
_awaitStartingPointReturnValue(context); _awaitStartingPointReturnValue(context);
...@@ -334,7 +544,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -334,7 +544,7 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
), ),
SizedBox( SizedBox(
height: 45, height: 40,
child: Container( child: Container(
padding: EdgeInsets.only(right: 6, left: 10), padding: EdgeInsets.only(right: 6, left: 10),
child: IconButton( child: IconButton(
...@@ -366,7 +576,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -366,7 +576,7 @@ class _MyHomePageState extends State<MyHomePage> {
child: Row( child: Row(
children: [ children: [
SizedBox( SizedBox(
height: 45, height: 40,
child: Container( child: Container(
padding: EdgeInsets.only(right: 15, left: 10), padding: EdgeInsets.only(right: 15, left: 10),
child: Icon( child: Icon(
...@@ -378,7 +588,7 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -378,7 +588,7 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
Expanded( Expanded(
child: SizedBox( child: SizedBox(
height: 45, height: 40,
child: TextField( child: TextField(
decoration: InputDecoration( decoration: InputDecoration(
labelStyle: TextStyle( labelStyle: TextStyle(
...@@ -388,10 +598,11 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -388,10 +598,11 @@ class _MyHomePageState extends State<MyHomePage> {
border: InputBorder.none, border: InputBorder.none,
prefixText: getFormattedText(destinationText), prefixText: getFormattedText(destinationText),
labelText: getFormattedText(destinationText), labelText: getFormattedText(destinationText),
floatingLabelBehavior: FloatingLabelBehavior.never, floatingLabelBehavior:
FloatingLabelBehavior.never,
), ),
style: TextStyle( style: TextStyle(
fontSize: 21, fontSize: 20,
), ),
onTap: () { onTap: () {
_awaitDestinationPointReturnValue(context); _awaitDestinationPointReturnValue(context);
...@@ -399,24 +610,104 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -399,24 +610,104 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
), ),
), ),
// Date Picker Icon ],
Container( ),
margin: EdgeInsets.only(right: 5), ),
Row(
children: [
Expanded(
child: SizedBox(
child: Container(
margin: EdgeInsets.only(left: 25),
child: Column( child: Column(
children: [ children: [
IconButton( 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), icon: Icon(Icons.calendar_month),
iconSize: 26, color:
onPressed: () => _rangeDatePicker(context), 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,
),
), ),
], ],
), ),
) ),
], ],
), ),
],
),
),
),
),
Container(
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( DraggableScrollableSheet(
initialChildSize: 0.1, initialChildSize: 0.1,
minChildSize: 0.1, minChildSize: 0.1,
...@@ -431,17 +722,6 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -431,17 +722,6 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
color: Theme.of(context).primaryColor, 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( child: ListView.builder(
controller: scrollController, controller: scrollController,
itemCount: 1, itemCount: 1,
...@@ -449,13 +729,34 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -449,13 +729,34 @@ class _MyHomePageState extends State<MyHomePage> {
itemBuilder: (BuildContext context, int index) { itemBuilder: (BuildContext context, int index) {
return Container( return Container(
width: double.infinity, width: double.infinity,
height: 94, 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),
),
),
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Container(
padding: EdgeInsets.only(right: 3, top: 4),
child: Icon(
Icons.double_arrow_rounded,
color: Theme.of(context).accentColor,
size: 18,
),
),
Text( Text(
'Picked Date: ', 'Picked Date ',
style: TextStyle( style: TextStyle(
letterSpacing: 0.6,
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context).accentColor), color: Theme.of(context).accentColor),
...@@ -469,34 +770,62 @@ class _MyHomePageState extends State<MyHomePage> { ...@@ -469,34 +770,62 @@ class _MyHomePageState extends State<MyHomePage> {
), ),
], ],
), ),
);
},
), ),
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,
), ),
);
},
)
],
), ),
floatingActionButton: Container( Text(
padding: EdgeInsets.only(bottom: 50), 'Undesired Weather',
child: FloatingActionButton.extended(
onPressed: _getShortestPath,
label: Text(
'Get Route',
style: TextStyle( style: TextStyle(
fontSize: 18, 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(),
],
),
],
), ),
icon: Icon(
Icons.navigation,
size: 26,
), ),
backgroundColor: Theme.of(context).primaryColor, ],
foregroundColor: Theme.of(context).accentColor, ),
);
},
), ),
);
},
)
],
), ),
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
); );
} }
} }
...@@ -25,7 +25,7 @@ class _ReturnDestinationState extends State<ReturnDestination> { ...@@ -25,7 +25,7 @@ class _ReturnDestinationState extends State<ReturnDestination> {
); );
var jsonData = jsonDecode(response.body); var jsonData = jsonDecode(response.body);
suggestions = []; 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()); suggestions.add(jsonData['predictions'][i]['description'].toString());
} }
return suggestions; return suggestions;
...@@ -46,7 +46,7 @@ class _ReturnDestinationState extends State<ReturnDestination> { ...@@ -46,7 +46,7 @@ class _ReturnDestinationState extends State<ReturnDestination> {
'Destination Point', 'Destination Point',
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).accentColor,
fontSize: 24, fontSize: 22,
), ),
), ),
leading: IconButton( leading: IconButton(
...@@ -79,7 +79,7 @@ class _ReturnDestinationState extends State<ReturnDestination> { ...@@ -79,7 +79,7 @@ class _ReturnDestinationState extends State<ReturnDestination> {
Radius.circular(30), Radius.circular(30),
), ),
), ),
height: 50, height: 45,
child: TypeAheadField( child: TypeAheadField(
animationStart: 0, animationStart: 0,
animationDuration: Duration.zero, animationDuration: Duration.zero,
...@@ -98,7 +98,7 @@ class _ReturnDestinationState extends State<ReturnDestination> { ...@@ -98,7 +98,7 @@ class _ReturnDestinationState extends State<ReturnDestination> {
floatingLabelBehavior: FloatingLabelBehavior.never, floatingLabelBehavior: FloatingLabelBehavior.never,
), ),
style: TextStyle( style: TextStyle(
fontSize: 22, fontSize: 20,
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
), ),
), ),
...@@ -125,7 +125,7 @@ class _ReturnDestinationState extends State<ReturnDestination> { ...@@ -125,7 +125,7 @@ class _ReturnDestinationState extends State<ReturnDestination> {
child: Text( child: Text(
textField.toString(), textField.toString(),
style: TextStyle( style: TextStyle(
fontSize: 21, fontSize: 20,
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
), ),
), ),
......
...@@ -24,7 +24,7 @@ class _ReturnOriginState extends State<ReturnOrigin> { ...@@ -24,7 +24,7 @@ class _ReturnOriginState extends State<ReturnOrigin> {
); );
var jsonData = jsonDecode(response.body); var jsonData = jsonDecode(response.body);
suggestions = []; 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()); suggestions.add(jsonData['predictions'][i]['description'].toString());
} }
return suggestions; return suggestions;
...@@ -45,7 +45,7 @@ class _ReturnOriginState extends State<ReturnOrigin> { ...@@ -45,7 +45,7 @@ class _ReturnOriginState extends State<ReturnOrigin> {
'Starting Point', 'Starting Point',
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentColor, color: Theme.of(context).accentColor,
fontSize: 24, fontSize: 22,
), ),
), ),
leading: IconButton( leading: IconButton(
...@@ -78,7 +78,7 @@ class _ReturnOriginState extends State<ReturnOrigin> { ...@@ -78,7 +78,7 @@ class _ReturnOriginState extends State<ReturnOrigin> {
Radius.circular(30), Radius.circular(30),
), ),
), ),
height: 50, height: 45,
child: TypeAheadField( child: TypeAheadField(
animationStart: 0, animationStart: 0,
animationDuration: Duration.zero, animationDuration: Duration.zero,
...@@ -97,7 +97,7 @@ class _ReturnOriginState extends State<ReturnOrigin> { ...@@ -97,7 +97,7 @@ class _ReturnOriginState extends State<ReturnOrigin> {
floatingLabelBehavior: FloatingLabelBehavior.never, floatingLabelBehavior: FloatingLabelBehavior.never,
), ),
style: TextStyle( style: TextStyle(
fontSize: 22, fontSize: 20,
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
), ),
), ),
...@@ -124,7 +124,7 @@ class _ReturnOriginState extends State<ReturnOrigin> { ...@@ -124,7 +124,7 @@ class _ReturnOriginState extends State<ReturnOrigin> {
child: Text( child: Text(
textField.toString(), textField.toString(),
style: TextStyle( style: TextStyle(
fontSize: 21, fontSize: 20,
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
), ),
), ),
......
...@@ -25,6 +25,14 @@ packages: ...@@ -25,6 +25,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" 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: characters:
dependency: transitive dependency: transitive
description: description:
...@@ -589,6 +597,14 @@ packages: ...@@ -589,6 +597,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.4" 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: wkt_parser:
dependency: transitive dependency: transitive
description: description:
......
...@@ -37,6 +37,7 @@ dependencies: ...@@ -37,6 +37,7 @@ dependencies:
google_maps_flutter: ^2.0.2 google_maps_flutter: ^2.0.2
geocoding: ^2.1.0 geocoding: ^2.1.0
location: ^4.2.0 location: ^4.2.0
weather_icons: ^3.0.0
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
...@@ -48,6 +49,7 @@ dependencies: ...@@ -48,6 +49,7 @@ dependencies:
latlong2: ^0.8.1 latlong2: ^0.8.1
geolocator: ^9.0.2 geolocator: ^9.0.2
geocoder: ^0.2.1 geocoder: ^0.2.1
bottom_bar_with_sheet: ^2.4.0
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment