Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sonigeez committed Mar 21, 2023
1 parent 994849a commit e55e9c9
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 71 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# saheli_app

A new Flutter project.

## Getting Started
## App Flow

This project is a starting point for a Flutter application.
1. User Registration or Login
2. Home Screen:
- Display a live map showing the user's current location.
- Provide a search bar for users to enter their destination, and short notes about their journey.
3. Find Saheli
- After entering the destination, display a list of nearby Sahelis traveling in the same direction, along with their profiles, and distance from the user.
4. In-app Chat:
- Once a request is accepted, enable users to communicate through an in-app chat for coordination and trust-building.
5. Start Journey:
- When both users are ready, they can start the journey together.


A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
2 changes: 1 addition & 1 deletion lib/repo/networking_urls.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class NetworkingUrls {
NetworkingUrls._();

static const String baseUrl = "https://43e0-117-250-3-86.in.ngrok.io/";
static const String baseUrl = "https://saheli-backend.onrender.com/";
static const String signup = "signup";
static const String login = "login";
static const String verifyOtp = "verify";
Expand Down
59 changes: 49 additions & 10 deletions lib/screens/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,13 @@ class HomePageState extends State<HomePage> {
polylineId: PolylineId("test")),
},
initialCameraPosition: const CameraPosition(
target: LatLng(0, 0), zoom: 13),
target: LatLng(26.9124, 75.7873), zoom: 13),
onMapCreated:
(GoogleMapController controller) async {
_mapController = controller;
final provider =
context.read<HomeScreenProvider>();
if (provider.currentLocation == null) {
await _getCurrentLocation();
}
await _getCurrentLocation();
},
gestureRecognizers: {
Factory<OneSequenceGestureRecognizer>(
Expand Down Expand Up @@ -297,23 +295,64 @@ class HomePageState extends State<HomePage> {
color: Colors.white,
borderRadius: BorderRadius.circular(6),
),
height: 50,
child: TextField(
controller: _shortNoteController,
decoration: const InputDecoration(
prefixIcon: Padding(
decoration: InputDecoration(
suffixIcon: Padding(
padding: const EdgeInsets.symmetric(horizontal: 18),
child: InkWell(
onTap: () {
// show dialog
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: const Text("About Short Note"),
content: Column(
mainAxisSize: MainAxisSize.min,
children: const [
Text(
"A short description about your journey"),
SizedBox(
height: 10,
),
Text(
"e.g. I'm going to the sector 12 market to buy some groceries at ",
style: TextStyle(
fontSize: 13,
color: Colors.grey)),
],
),
actions: [
TextButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text("Ok"),
),
],
);
});
},
child: const Icon(
Icons.info_outline,
color: Colors.grey,
),
),
),
prefixIcon: const Padding(
padding: EdgeInsets.symmetric(horizontal: 18),
child: Icon(
Icons.note_add,
color: Colors.grey,
),
),
hintStyle: TextStyle(
hintStyle: const TextStyle(
color: Colors.grey,
fontSize: 16,
),
hintText: 'Enter Short Note',
border: OutlineInputBorder(
border: const OutlineInputBorder(
borderRadius: BorderRadius.all(
Radius.circular(6),
),
Expand Down Expand Up @@ -350,7 +389,7 @@ class HomePageState extends State<HomePage> {
),
),
child: const Padding(
padding: EdgeInsets.all(12.0),
padding: EdgeInsets.all(15.0),
child: Text('Find Saheli'),
),
),
Expand Down
23 changes: 16 additions & 7 deletions lib/screens/onboarding_screen.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:saheli_app/router/app_router.gr.dart';
import 'package:saheli_app/utils/onboarding_content.dart';
import 'package:saheli_app/utils/size_config.dart';
Expand Down Expand Up @@ -118,9 +119,11 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
? Padding(
padding: const EdgeInsets.all(30),
child: ElevatedButton(
onPressed: () {
onPressed: () async {
// AppRouter().popAndPush()
// appRouter.push(const HomeRoute());
await Geolocator.requestPermission();

context.router.popAndPush(const LoginRoute());
},
style: ElevatedButton.styleFrom(
Expand All @@ -129,9 +132,12 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
borderRadius: BorderRadius.circular(50),
),
padding: (width <= 550)
? const EdgeInsets.symmetric(horizontal: 100, vertical: 20)
: EdgeInsets.symmetric(horizontal: width * 0.2, vertical: 25),
textStyle: TextStyle(fontSize: (width <= 550) ? 13 : 17),
? const EdgeInsets.symmetric(
horizontal: 100, vertical: 20)
: EdgeInsets.symmetric(
horizontal: width * 0.2, vertical: 25),
textStyle:
TextStyle(fontSize: (width <= 550) ? 13 : 17),
),
child: const Text("START"),
),
Expand Down Expand Up @@ -171,9 +177,12 @@ class _OnboardingScreenState extends State<OnboardingScreen> {
),
elevation: 0,
padding: (width <= 550)
? const EdgeInsets.symmetric(horizontal: 30, vertical: 20)
: const EdgeInsets.symmetric(horizontal: 30, vertical: 25),
textStyle: TextStyle(fontSize: (width <= 550) ? 13 : 17),
? const EdgeInsets.symmetric(
horizontal: 30, vertical: 20)
: const EdgeInsets.symmetric(
horizontal: 30, vertical: 25),
textStyle: TextStyle(
fontSize: (width <= 550) ? 13 : 17),
),
child: const Text("NEXT"),
),
Expand Down
23 changes: 15 additions & 8 deletions lib/services/auth_services.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ class AuthServices {
data: {
'firstName': firstName,
'lastName': lastName,
'aadhar': aadharNumber,
'aadhaar': aadharNumber,
'phone': phoneNo,
},
);
} catch (e) {
debugPrint("error: $e");
}

return response != null && response.statusCode.toString().substring(0, 1) == "2";
return response != null &&
response.statusCode.toString().substring(0, 1) == "2";
}

static Future<UserModel?> verifyOtp(String otp, String phoneNo) async {
Expand All @@ -43,9 +44,12 @@ class AuthServices {

if (response.statusCode.toString().substring(0, 1) == "2") {
user = UserModel.fromJson(response.data['user']);
await SharedPreferencesHelper.storage.setString("authToken", response.data['token']);
await SharedPreferencesHelper.storage.setString("username", user.username);
await SharedPreferencesHelper.storage.setString("sudoName", user.sudoName);
await SharedPreferencesHelper.storage
.setString("authToken", response.data['token']);
await SharedPreferencesHelper.storage
.setString("username", user.username);
await SharedPreferencesHelper.storage
.setString("sudoName", user.sudoName);
await SharedPreferencesHelper.storage.setString("name", user.name);
await SharedPreferencesHelper.storage.setString("userId", user.id);
SharedPreferencesHelper.storage.setBool("onboarded", true);
Expand All @@ -64,7 +68,8 @@ class AuthServices {
} catch (e) {
debugPrint(e.toString());
}
return response != null && response.statusCode.toString().substring(0, 1) == "2";
return response != null &&
response.statusCode.toString().substring(0, 1) == "2";
}

static Future<bool> setAvailability(bool value) async {
Expand All @@ -75,7 +80,8 @@ class AuthServices {
NetworkingUrls.outside,
data: {"outside": value},
options: Options(headers: {
"Authorization": "Bearer ${SharedPreferencesHelper.storage.getString("authToken")}",
"Authorization":
"Bearer ${SharedPreferencesHelper.storage.getString("authToken")}",
}),
);
} catch (e) {
Expand All @@ -84,6 +90,7 @@ class AuthServices {

debugPrint("${response?.data}");

return response != null && response.statusCode.toString().substring(0, 1) == "2";
return response != null &&
response.statusCode.toString().substring(0, 1) == "2";
}
}
3 changes: 3 additions & 0 deletions lib/ui/screens/chats_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ class _ChatsPageState extends State<ChatsPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Chats"),
),
body: RefreshIndicator(
onRefresh: _channelListController.refresh,
child: StreamChannelListView(
Expand Down
35 changes: 1 addition & 34 deletions lib/ui/screens/nearby_users_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class _NearbyUsersListState extends State<NearbyUsersList> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Users List"),
title: const Text("Nearby Saheli's List"),
),
body: FutureBuilder(
future: LocationServices.getNearMe(),
Expand Down Expand Up @@ -67,39 +67,6 @@ class UserWidget extends StatelessWidget {
onTap: () {
_createChannel(context);
},
// child: Container(
// decoration: BoxDecoration(
// color: Colors.white,
// borderRadius: BorderRadius.circular(10),
// ),
// margin: const EdgeInsets.all(8),
// height: 100,
// width: double.infinity,
// padding: const EdgeInsets.all(8),
// child: Column(
// mainAxisAlignment: MainAxisAlignment.spaceEvenly,
// children: [
// Text(
// user.firstname + user.lastname,
// maxLines: 1,
// overflow: TextOverflow.ellipsis,
// style: Theme.of(context).textTheme.bodyMedium,
// ),
// // short note
// Text(
// user.shortDesc,
// maxLines: 3,
// overflow: TextOverflow.ellipsis,
// style: Theme.of(context).textTheme.bodySmall,
// ),
// // distance
// Text(
// "Distance: ${user.distance} Km",
// style: Theme.of(context).textTheme.bodySmall,
// ),
// ],
// ),
// ),
child: Column(
children: [
ListTile(
Expand Down

0 comments on commit e55e9c9

Please sign in to comment.