Skip to content

Commit

Permalink
configured app to work correctly on android
Browse files Browse the repository at this point in the history
  • Loading branch information
Oluwaseun Jimoh committed Aug 29, 2024
1 parent bea2bbc commit fba85c1
Show file tree
Hide file tree
Showing 27 changed files with 302 additions and 456 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ android {
applicationId = "com.example.nursing_mother_medical_app"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdk = flutter.minSdkVersion
minSdk = 23
targetSdk = flutter.targetSdkVersion
versionCode = flutterVersionCode.toInteger()
versionName = flutterVersionName
Expand Down
19 changes: 19 additions & 0 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@
"other_platform_oauth_client": []
}
}
},
{
"client_info": {
"mobilesdk_app_id": "1:204040021736:android:1fd81e71c30d844f2f4b5d",
"android_client_info": {
"package_name": "com.example.nursing_mother_medical_app"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "AIzaSyBGEOk5oGYeAeHxOpbfTdQAE3M_Uu-qQKY"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
Expand Down
3 changes: 0 additions & 3 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,4 @@
<data android:mimeType="text/plain"/>
</intent>
</queries>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
</manifest>
2 changes: 1 addition & 1 deletion firebase.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"flutter":{"platforms":{"android":{"default":{"projectId":"nursingmother-64709","appId":"1:204040021736:android:dd18bc886f4ee7182f4b5d","fileOutput":"android/app/google-services.json"}},"ios":{"default":{"projectId":"nursingmother-64709","appId":"1:204040021736:ios:b584f74cbbd84fd92f4b5d","uploadDebugSymbols":false,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"macos":{"default":{"projectId":"nursingmother-64709","appId":"1:204040021736:ios:b584f74cbbd84fd92f4b5d","uploadDebugSymbols":false,"fileOutput":"macos/Runner/GoogleService-Info.plist"}},"dart":{"lib/firebase_options.dart":{"projectId":"nursingmother-64709","configurations":{"android":"1:204040021736:android:dd18bc886f4ee7182f4b5d","ios":"1:204040021736:ios:b584f74cbbd84fd92f4b5d","macos":"1:204040021736:ios:b584f74cbbd84fd92f4b5d","web":"1:204040021736:web:23645d279a0c7def2f4b5d","windows":"1:204040021736:web:2fe2c5dee92f501a2f4b5d"}}}}}}
{"flutter":{"platforms":{"android":{"default":{"projectId":"nursingmother-64709","appId":"1:204040021736:android:1fd81e71c30d844f2f4b5d","fileOutput":"android/app/google-services.json"}},"ios":{"default":{"projectId":"nursingmother-64709","appId":"1:204040021736:ios:b584f74cbbd84fd92f4b5d","uploadDebugSymbols":false,"fileOutput":"ios/Runner/GoogleService-Info.plist"}},"macos":{"default":{"projectId":"nursingmother-64709","appId":"1:204040021736:ios:b584f74cbbd84fd92f4b5d","uploadDebugSymbols":false,"fileOutput":"macos/Runner/GoogleService-Info.plist"}},"dart":{"lib/firebase_options.dart":{"projectId":"nursingmother-64709","configurations":{"android":"1:204040021736:android:1fd81e71c30d844f2f4b5d","ios":"1:204040021736:ios:b584f74cbbd84fd92f4b5d","macos":"1:204040021736:ios:b584f74cbbd84fd92f4b5d","web":"1:204040021736:web:23645d279a0c7def2f4b5d","windows":"1:204040021736:web:2fe2c5dee92f501a2f4b5d"}}}}}}
1 change: 1 addition & 0 deletions lib/config/app_colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ class AppColors {
static const bgColor = Color(0xFFFAFAFA);
static const textFormOutline = Color(0x1A8C8A8A);
static const greyTextColor = Color(0xFF8C8A8A);
static const lightGreyTextColor = Color(0xFFD2D2D2);
}
6 changes: 4 additions & 2 deletions lib/features/login/forgot_pasword.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:nursing_mother_medical_app/config/app_colors.dart';
import 'package:nursing_mother_medical_app/config/app_strings.dart';
import 'package:nursing_mother_medical_app/reusables/LoadingView.dart';
import 'package:provider/provider.dart';
import '../../provider/auth_provider.dart';
import 'package:nursing_mother_medical_app/provider/providers.dart';
import '../../reusables/form/input_decoration.dart';
import '../../reusables/form/app_button.dart';

Expand Down Expand Up @@ -59,6 +59,8 @@ class _ForgotPasswordPageState extends State<ForgotPasswordPage> {

@override
Widget build(BuildContext context) {
final navigator = Provider.of<NavigationProvider>(context, listen: false);

return Scaffold(
appBar: AppBar(
title: Text(
Expand All @@ -72,7 +74,7 @@ class _ForgotPasswordPageState extends State<ForgotPasswordPage> {
leading: IconButton(
icon: const Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context); // Go back to the previous page
navigator.goBack(); // Go back to the previous page
},
),
),
Expand Down
23 changes: 9 additions & 14 deletions lib/features/login/login.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import 'package:nursing_mother_medical_app/config/app_strings.dart';
import 'package:nursing_mother_medical_app/features/login/forgot_pasword.dart';
import 'package:nursing_mother_medical_app/features/register/register.dart';
import 'package:nursing_mother_medical_app/features/supportlibrary/support_library.dart';
import 'package:nursing_mother_medical_app/navigation/routes.dart';
import 'package:nursing_mother_medical_app/reusables/form/app_button.dart';
import 'package:provider/provider.dart';

import '../../provider/navigation_provider.dart';
import '../../provider/auth_provider.dart';
import '../../reusables/LoadingView.dart';
import '../../reusables/form/input_decoration.dart';
Expand Down Expand Up @@ -54,6 +56,8 @@ class LoginFormState extends State<LoginForm> {
Widget build(BuildContext context) {
// Build a Form widget using the _formKey created above.
final authProvider = Provider.of<AuthProviders>(context);
final navigator = Provider.of<NavigationProvider>(context, listen: false);

WidgetsBinding.instance.addPostFrameCallback((_) {
if (authProvider.status.type == StatusType.authenticateError) {
Fluttertoast.showToast(msg: authProvider.status.errorMessage ?? "");
Expand All @@ -65,6 +69,7 @@ class LoginFormState extends State<LoginForm> {
});

return SafeArea(
child: SingleChildScrollView(
child: Form(
key: _formKey,
child: Container(
Expand Down Expand Up @@ -150,13 +155,7 @@ class LoginFormState extends State<LoginForm> {
),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const HomePage(),
// const Register(userType: 'professional'),
),
);
navigator.replaceWith(AppRoutes.welcome);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
Expand All @@ -181,12 +180,7 @@ class LoginFormState extends State<LoginForm> {
),
GestureDetector(
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ForgotPasswordPage(),
),
);
navigator.navigateTo(AppRoutes.forgotPassword);
},
child: Center(
child: Text("Forgot Password",
Expand All @@ -196,6 +190,7 @@ class LoginFormState extends State<LoginForm> {
?.copyWith(color: AppColors.black))))
],
),
)));
)))
);
}
}
1 change: 0 additions & 1 deletion lib/features/messaging/channels_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ class MessagingPage extends StatefulWidget {
class _MessagingPageState extends State<MessagingPage> {
List<QueryDocumentSnapshot> _allChannels = [];
List<QueryDocumentSnapshot> _filteredChannels = [];
bool _isLoading = true;

void _filterChannels(String query) {
setState(() {
Expand Down
2 changes: 1 addition & 1 deletion lib/features/messaging/group_chat_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class _GroupChatPageState extends State<GroupChatPage> {
),
),
IconButton(
icon: Icon(Icons.send),
icon: const Icon(Icons.send),
onPressed: () {
final text = _messageController.text.trim();
if (text.isNotEmpty) {
Expand Down
8 changes: 2 additions & 6 deletions lib/features/messaging/individual_chat_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:nursing_mother_medical_app/reusables/form/input_decoration.dart';
import 'package:provider/provider.dart';
import 'package:nursing_mother_medical_app/config/app_colors.dart';
import 'package:nursing_mother_medical_app/features/messaging/report_page.dart';
Expand Down Expand Up @@ -100,12 +101,7 @@ class _PrivateChatPageState extends State<PrivateChatPage> {
Expanded(
child: TextField(
controller: _messageController,
decoration: InputDecoration(
hintText: 'Type a message',
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
),
),
decoration: buildInputDecoration(hintText: "Type a message"),
),
),
IconButton(
Expand Down
10 changes: 7 additions & 3 deletions lib/features/onboarding/onboarding_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import 'package:nursing_mother_medical_app/config/app_colors.dart';
import 'package:nursing_mother_medical_app/config/app_strings.dart';
import 'package:nursing_mother_medical_app/features/onboarding/onboarding_items.dart';
import 'package:nursing_mother_medical_app/features/onboarding/welcome.dart';
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:smooth_page_indicator/smooth_page_indicator.dart';
import '../../navigation/routes.dart';
import '../../provider/providers.dart';

class OnboardingView extends StatefulWidget {
const OnboardingView({super.key});
Expand All @@ -21,13 +24,14 @@ class _OnboardingViewState extends State<OnboardingView> {

@override
Widget build(BuildContext context) {
final navigatorProvider = Provider.of<NavigationProvider>(context, listen: false);
return Scaffold(
backgroundColor: AppColors.white,

bottomSheet: Container(
color:AppColors.white,
padding: const EdgeInsets.symmetric(horizontal: 10,vertical: 10),
child: isLastPage? getStarted() : Row(
child: isLastPage? getStarted(navigatorProvider) : Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [

Expand Down Expand Up @@ -103,7 +107,7 @@ class _OnboardingViewState extends State<OnboardingView> {

//Get started button

Widget getStarted(){
Widget getStarted(NavigationProvider navigatorProvider){
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
Expand All @@ -119,7 +123,7 @@ class _OnboardingViewState extends State<OnboardingView> {
//After we press get started button this onboarding value become true
// same key
if(!mounted)return;
Navigator.pushReplacement(context, MaterialPageRoute(builder: (context)=>WelcomePage()));
navigatorProvider.replaceWith(AppRoutes.welcome);
},
child: const Text("Get started",style: TextStyle(color: Colors.white),)),
);
Expand Down
146 changes: 74 additions & 72 deletions lib/features/onboarding/welcome.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:nursing_mother_medical_app/features/login/login.dart';
import 'package:nursing_mother_medical_app/features/register/register.dart';
import 'package:nursing_mother_medical_app/provider/providers.dart';
import 'package:nursing_mother_medical_app/navigation/routes.dart';
import 'package:provider/provider.dart';

import '../../config/app_colors.dart';
import '../../config/app_strings.dart';
Expand All @@ -11,82 +12,83 @@ class WelcomePage extends StatelessWidget {

@override
Widget build(BuildContext context) {
// Access the NavigatorService
final navigator = Provider.of<NavigationProvider>(context, listen: false);

return Scaffold(
backgroundColor: AppColors.bgColor,
body: Container(
padding: const EdgeInsets.symmetric(vertical: 100),
margin: const EdgeInsets.all(20),child: Column(children: [
Text(
AppStrings.welcome,
style: Theme.of(context)
.textTheme
.titleLarge
?.copyWith(color: AppColors.black),textAlign: TextAlign.center,
),

const SizedBox(height: 30),

Text(
AppStrings.signUpInstruction,
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(color: AppColors.black),textAlign: TextAlign.center,
),

const SizedBox(height: 60),

AppElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Register(userType: 'parent')
),
);
},
buttonText: AppStrings.parents,
width: 183,
),

const SizedBox(height: 60),

AppElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Register(userType: 'professional')
margin: const EdgeInsets.all(20),
child: Column(
children: [
Text(
AppStrings.welcome,
style: Theme.of(context)
.textTheme
.titleLarge
?.copyWith(color: AppColors.black),
textAlign: TextAlign.center,
),
const SizedBox(height: 30),
Text(
AppStrings.signUpInstruction,
style: Theme.of(context)
.textTheme
.bodySmall
?.copyWith(color: AppColors.black),
textAlign: TextAlign.center,
),
const SizedBox(height: 60),
AppElevatedButton(
onPressed: () {
navigator.navigateTo(
AppRoutes.register,
arguments: {'userType': 'parent'},
);
},
buttonText: AppStrings.parents,
width: 183,
),
const SizedBox(height: 60),
AppElevatedButton(
onPressed: () {
navigator.navigateTo(
AppRoutes.register,
arguments: {'userType': 'professional'},
);
},
buttonText: AppStrings.professional,
width: 183,
height: 50,
),
const SizedBox(height: 60),
GestureDetector(
onTap: () {
navigator.replaceWith(AppRoutes.login);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Already have an account?",
style: Theme.of(context)
.textTheme
.labelSmall
?.copyWith(color: AppColors.black)),
const SizedBox(
width: 5,
),
Text("Login",
style: Theme.of(context)
.textTheme
.labelSmall
?.copyWith(color: AppColors.primary))
],
),
);
},
buttonText: AppStrings.professional,
width: 183,
height: 50,
),

const SizedBox(height: 60),

GestureDetector(onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Login(),
),
);
},
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("Already have an account?",
style:Theme.of(context).textTheme.labelSmall?.copyWith(color: AppColors.black)),
const SizedBox(
width: 5,
),
Text("Login",
style:Theme.of(context).textTheme.labelSmall?.copyWith(color: AppColors.primary))
],)),
],))
],
),
),
);
}
}
Loading

0 comments on commit fba85c1

Please sign in to comment.