Skip to content

Commit

Permalink
Update dependencies and remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
Nde-Dilan committed Feb 13, 2024
1 parent faf2e76 commit 15c3e11
Show file tree
Hide file tree
Showing 32 changed files with 1,369 additions and 197 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ if (flutterVersionName == null) {

android {
namespace "com.example.ride_sharing_app"
compileSdkVersion flutter.compileSdkVersion
compileSdkVersion 33
ndkVersion flutter.ndkVersion

compileOptions {
Expand Down
22 changes: 22 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,26 @@
<meta-data android:name="com.google.android.geo.API_KEY"
android:value="AIzaSyDXhM3t-i2ZfiPiG0AZYKJMDqm-ZVZSnUY"/>
</application>
<queries>
<!-- If your app opens https URLs -->
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<!-- If your app makes calls -->
<intent>
<action android:name="android.intent.action.DIAL" />
<data android:scheme="tel" />
</intent>
<!-- If your sends SMS messages -->
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="smsto" />
</intent>
<!-- If your app sends emails -->
<intent>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />
</intent>
</queries>
</manifest>
Binary file added assets/icons/user.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/user1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 17 additions & 3 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,17 @@ import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:ride_sharing_app/firebase_options.dart';
import 'package:ride_sharing_app/pages/about_us.dart';
import 'package:ride_sharing_app/pages/dashboard.dart';
import 'package:ride_sharing_app/pages/flutter_map_test.dart';
import 'package:ride_sharing_app/pages/help_center.dart';
import 'package:ride_sharing_app/pages/home_page.dart';
import 'package:ride_sharing_app/pages/landing_page.dart';
import 'package:ride_sharing_app/pages/login_page.dart';
import 'package:ride_sharing_app/pages/my_profile.dart';
import 'package:ride_sharing_app/pages/payment_methods.dart';
import 'package:ride_sharing_app/pages/sign_up.dart';
import 'package:ride_sharing_app/pages/test.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -27,17 +34,24 @@ class MyApp extends StatelessWidget {

routes: {
'/sign-up': (context) => const SignUpPage(),
'/sign-in': (context) => const LoginPage(),
'/home-page': (context) => const MapPage(),
'/sign-in': (context) => const LoginPage(),
'/about-us': (context) => const AboutUsPage(),
'/dashboard': (context) => const Dashboard(),
'/payment': (context) => const PaymentMethod(),
'/profile': (context) => const MyProfile(),
'/help': (context) => const HelpCenter(),
},
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: const Color.fromARGB(255, 233, 92, 50)),
useMaterial3: true,
),
// home: const MapPage(),
home: const MyHomePage(title: 'Flutter Demo Home Page'),
// home: const MyAppMap(),
home: const MapPage(),
// home: const MapSample(),
// home: const MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
Expand Down
1 change: 0 additions & 1 deletion lib/models/marker.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:flutter/material.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';

class CustomMarker {
Expand Down
46 changes: 46 additions & 0 deletions lib/pages/about_us.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import 'package:flutter/material.dart';

class AboutUsPage extends StatelessWidget {
const AboutUsPage({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('About Us'),
),
body: const Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
CircleAvatar(
radius: 80,
backgroundImage: AssetImage('assets/icons/RideShare.png'),
),
SizedBox(height: 20),
Text(
'RideShare 🚀',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
SizedBox(height: 10),
Text(
'Version: 1.0.0',
style: TextStyle(fontSize: 16),
),
SizedBox(height: 10),
Text(
'Developer Info',
style: TextStyle(fontSize: 16),
),
SizedBox(height: 10),
Text('Name: NDE HURICH DILAN'),
SizedBox(height: 10),
Text('Phone: +237694525931'),
SizedBox(height: 10),
Text("Email: techwithdilan2@gmail"),
],
),
),
);
}
}
19 changes: 11 additions & 8 deletions lib/pages/dashboard.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
import 'package:flutter/material.dart';

class MyWidget extends StatefulWidget {
const MyWidget({super.key});
class Dashboard extends StatefulWidget {
const Dashboard({super.key});

@override
State<MyWidget> createState() => _MyWidgetState();
State<Dashboard> createState() => _DashboardState();
}

class _MyWidgetState extends State<MyWidget> {
class _DashboardState extends State<Dashboard> {
@override
Widget build(BuildContext context) {
return const Scaffold(
body: Center(
child: Text("Dashboard"),
));
return Scaffold(
appBar: AppBar(
title: const Text('Dashboard'),
),
body: const Center(
child: Text("Dashboard"),
));
}
}
156 changes: 156 additions & 0 deletions lib/pages/flutter_map_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
import 'package:geocoding/geocoding.dart';
import 'package:geolocator/geolocator.dart';
import 'package:latlong2/latlong.dart';
import 'package:http/http.dart' as http;
import 'package:ride_sharing_app/utils/get_current_location.dart';
import 'package:ride_sharing_app/utils/get_position.dart';
import 'dart:convert';

// import 'package:geocoding/geocoding.dart';
import '../widgets/my_input.dart';
// import 'package:flutter_map/plugin_api.dart';

import 'package:geolocator_android/geolocator_android.dart';
import 'package:geolocator_apple/geolocator_apple.dart';

void _registerPlatformInstance() {
if (Platform.isAndroid) {
GeolocatorAndroid.registerWith();
} else if (Platform.isIOS) {
GeolocatorApple.registerWith();
}
}

class MyAppMap extends StatefulWidget {
const MyAppMap({super.key});

@override
_MyAppMapState createState() => _MyAppMapState();
}

class _MyAppMapState extends State<MyAppMap> {
final end = TextEditingController();
List<LatLng> routepoints = [const LatLng(52.05884, -1.345583)];

late Future<Position> _currentPosition;

@override
void initState() {
super.initState();
_registerPlatformInstance();
_currentPosition = getCurrentPosition();
}

Future<Position> getCurrentPosition() {
return Geolocator.getCurrentPosition();
}

@override
Widget build(BuildContext context) {
return FutureBuilder<Position>(
future: _currentPosition,
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return const Center(child: CircularProgressIndicator());
} else if (snapshot.hasError) {
return const Center(child: Text('Error getting location'));
} else {
Position position = snapshot.data!;
return Scaffold(
appBar: AppBar(
title: const Text(
'My App',
style: TextStyle(fontSize: 20, fontWeight: FontWeight.w700),
),
backgroundColor: Colors.grey[500],
),
body: Stack(
children: [
FlutterMap(
options: MapOptions(
initialCenter:
LatLng(position.latitude, position.longitude),
initialZoom: 17.2,
),
children: [
TileLayer(
urlTemplate:
'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'com.example.ride_sharing_app',
),
CurrentLocationLayer(
style: const LocationMarkerStyle(
markerSize: Size(40, 40),
markerDirection: MarkerDirection.heading,
marker: DefaultLocationMarker(
child: Icon(
Icons.navigation,
color: Colors.white,
),
),
)),
PolylineLayer(
polylineCulling: true,
polylines: [
Polyline(points: routepoints, color: Colors.blue, strokeWidth: 9)
],
),
Column(
children: [
myInput(controler: end, hint: 'Where are you going?'),
const SizedBox(height: 13),
elevateBtn(context, end),
],
)
],
),
],
),
);
}
},
);
}

elevateBtn(BuildContext context, TextEditingController end) {
return ElevatedButton(
style: ElevatedButton.styleFrom(backgroundColor: Colors.grey[500]),
onPressed: () async {
List<Location> end_l =
await locationFromAddress(end.text, localeIdentifier: "en_CM");

var v1 = await _currentPosition;
var v3 = end_l[0].latitude;
var v4 = end_l[0].longitude;
print("object : ${end_l}");

print("${end.text} : $v3, $v4");

var url = Uri.parse(
'http://router.project-osrm.org/route/v1/driving/${v1.longitude},${v1.latitude};$v4,$v3?steps=true&annotations=true&geometries=geojson&overview=full');
var response = await http.get(url);
print("response.body : ${response.body}");
setState(() {
routepoints = [];
var routes = jsonDecode(response.body)['routes'][0]['geometry']
['coordinates'];
for (int i = 0; i < routes.length; i++) {
var route = routes[i].toString();
route = route.replaceAll("[", "");
route = route.replaceAll("]", "");
var lat1 = route.split(',');
var long1 = route.split(",");
routepoints
.add(LatLng(double.parse(lat1[1]), double.parse(long1[0])));
}
print(routepoints);
});
},
child: const Text('Press'));
}
}
16 changes: 16 additions & 0 deletions lib/pages/help_center.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:flutter/material.dart';

class HelpCenter extends StatelessWidget {
const HelpCenter({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Help Center'),
),
body: const Center(
child: Text("Help Center"),
));
}
}
Loading

0 comments on commit 15c3e11

Please sign in to comment.