Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions app/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def flutterVersionName = localProperties.getProperty('flutter.versionName')
if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
Expand All @@ -44,10 +44,10 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.app"
applicationId "com.agrivator.app"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion flutter.minSdkVersion
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand All @@ -67,5 +67,6 @@ flutter {
}

dependencies {
implementation platform('com.google.firebase:firebase-bom:31.1.0')
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
47 changes: 47 additions & 0 deletions app/android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"project_info": {
"project_number": "1095884333172",
"project_id": "agrivator-test",
"storage_bucket": "agrivator-test.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:1095884333172:android:b17cb06d6b2b13b0bfb121",
"android_client_info": {
"package_name": "com.agrivator.app"
}
},
"oauth_client": [
{
"client_id": "1095884333172-qs0m3qtccptnk9rdon8i5to7u0b6v1kk.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.agrivator.app",
"certificate_hash": "fd6f6e37e910e436c8f86e0cdbb94b3e6dfb8bac"
}
},
{
"client_id": "1095884333172-eabh9sc51ko98g8s58fbbd4dvsc5f1g1.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

api keys are usually stored in an env file.

{
"current_key": "AIzaSyCETi7qHyhSSDIXbltfTenZIkCfOqR7Ryc"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{
"client_id": "1095884333172-eabh9sc51ko98g8s58fbbd4dvsc5f1g1.apps.googleusercontent.com",
"client_type": 3
}
]
}
}
}
],
"configuration_version": "1"
}
3 changes: 2 additions & 1 deletion app/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="app"
android:label="agrivator"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<item android:drawable="?android:colorBackground" />

<!-- You can insert your own image assets here -->
<!-- <item>
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
android:src="@mipmap/ic_launcher" />
</item>
</layer-list>
6 changes: 3 additions & 3 deletions app/android/app/src/main/res/drawable/launch_background.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<item android:drawable="@android:color/white" />

<!-- You can insert your own image assets here -->
<!-- <item>
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
android:src="@mipmap/ic_launcher" />
</item>
</layer-list>
Binary file modified app/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions app/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ buildscript {
}

dependencies {
classpath 'com.google.gms:google-services:4.3.13'
classpath 'com.android.tools.build:gradle:7.1.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
Expand Down
Binary file added app/assets/images/img1.png
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 app/assets/images/logo.png
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 app/assets/images/profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions app/assets/images/profile.svg
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 app/assets/images/top.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/lib/constants/colors.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import 'package:flutter/material.dart';
class ConstColors{
Color backgroudColor =const Color(0xFFE3FDE4);
Color darkGreen = const Color(0xFF46C64F);
}
34 changes: 19 additions & 15 deletions app/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import './screens/splash_screen.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import './screens/login_phone.dart';
import './screens/otp_verification_screen.dart';

void main() {
runApp(const MyApp());
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
runApp(MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Agrivator v3',
theme: ThemeData(
primarySwatch: Colors.green,
),
home: const SplahScreen(),
routes: {
MyPhone.myPhoneRouteName : ((context) => const MyPhone()),
OTPScreen.otpScreenRouteName:(context) => OTPScreen()
},
));
}

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

@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
//todo: create home page
),
);
}
}
145 changes: 145 additions & 0 deletions app/lib/screens/login_phone.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
import 'package:app/constants/colors.dart';
import 'package:app/service/firebase_service.dart';
import 'package:flutter/material.dart';
import '../utils/pop.dart';
import 'otp_verification_screen.dart';

class MyPhone extends StatefulWidget {
static const String myPhoneRouteName = 'MyPhone';
final String phoneNumber = "";
const MyPhone({super.key});

@override
State<MyPhone> createState() => _MyPhoneState();
}

class _MyPhoneState extends State<MyPhone> {

final TextEditingController _countryController = TextEditingController();

var phone = '';
@override
void initState() {
_countryController.text = '+91';
super.initState();
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: ConstColors().backgroudColor,
body: Container(
alignment: Alignment.center,
margin: const EdgeInsets.only(left: 20, right: 20),
child: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'assets/images/img1.png',
width: 150,
height: 150,
),
const SizedBox(
height: 10,
),
const Text(
'Phone Verification',
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 22,
),
),
const SizedBox(
height: 10,
),
const Text(
'We need to register your phone before getting started!',
style: TextStyle(fontSize: 16),
textAlign: TextAlign.center,
),
const SizedBox(
height: 10,
),
Container(
height: 55,
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.grey, width: 1),
borderRadius: BorderRadius.circular(10)),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(
width: 10,
),
SizedBox(
width: 40,
child: TextField(
keyboardType: TextInputType.numberWithOptions(),
controller: _countryController,
decoration:
const InputDecoration(border: InputBorder.none),
),
),
const Text(
'|',
style: TextStyle(fontSize: 33, color: Colors.grey),
),
const SizedBox(
width: 10,
),
Expanded(
child: TextField(

keyboardType: TextInputType.number,
onChanged: (value) {
phone = value;
},
decoration: const InputDecoration(
border: InputBorder.none, hintText: "Phone")),
),
],
),
),
const SizedBox(
height: 20,
),
SizedBox(
height: 45,
width: double.infinity,
child: ElevatedButton(
onPressed: () {
if (_countryController.text.isEmpty) {
PopUp().popUpAlert(
context,
'Country Code missing',
'Enter a valid contrycode',
);
} else if (phone.length < 10||phone.length > 10) {
PopUp().popUpAlert(
context,
'Phone number error',
'Enter a valid phonenumber',
);
} else {
phone = _countryController.text +phone;
FirebaseServices().verifyPhoneNumber(phone);
Navigator.pushNamed(context, OTPScreen.otpScreenRouteName,arguments: phone);
}
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.green,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10)),
),
child: const Text('Send OTP'),
),
),
],
),
),
),
);
}
}
Loading