Commit 476a9852 by Ramesh Babu Puvvadi

added

parent 5b3987cb
......@@ -45,7 +45,7 @@ android {
applicationId "com.sopt.vasthram"
// 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.
minSdkVersion flutter.minSdkVersion
minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
......
PODS:
- camera_avfoundation (0.0.1):
- Flutter
- connectivity (0.0.1):
- Flutter
- Reachability
......@@ -11,6 +13,7 @@ PODS:
- FlutterMacOS
DEPENDENCIES:
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
- connectivity (from `.symlinks/plugins/connectivity/ios`)
- Flutter (from `Flutter`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
......@@ -21,6 +24,8 @@ SPEC REPOS:
- Reachability
EXTERNAL SOURCES:
camera_avfoundation:
:path: ".symlinks/plugins/camera_avfoundation/ios"
connectivity:
:path: ".symlinks/plugins/connectivity/ios"
Flutter:
......@@ -31,6 +36,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
SPEC CHECKSUMS:
camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
......
......@@ -20,6 +20,7 @@ class _Home extends State<Home> {
XFile? image;
bool isloading = false;
bool isVisible = true;
bool isData = false;
var bodycolor = '';
var bodydesigncolor = '';
var bordercolor = '';
......@@ -35,6 +36,7 @@ class _Home extends State<Home> {
setState(() {
imagefile = File(image!.path);
isVisible = true;
isData = false;
});
} else {
image = await _picker.pickImage(source: ImageSource.camera);
......@@ -460,7 +462,6 @@ class _Home extends State<Home> {
"assets/images/signout.png",
width: 24, // Adjust the width as needed
height: 24, // Adjust the height as needed
//color: Colors.grey, // Icon color
),
onPressed: () async {
bool valid = await Constants.checkInternetConnectivity();
......@@ -525,16 +526,20 @@ class _Home extends State<Home> {
),
],
),
if (isData)
SizedBox(
height: MediaQuery.of(context).size.height * 0.30,
child: PageView(
controller: _pageController,
children: pages = [
buildPage1('Page 1'),
buildPage2('Page 2'),
buildPage3('Page 3'),
],
),
),
SizedBox(
height: MediaQuery.of(context).size.height * 0.30,
child: PageView(
controller: _pageController,
children: pages = [
buildPage1('Page 1'),
buildPage2('Page 2'),
buildPage3('Page 3'),
],
),
),
Visibility(
visible: isVisible,
......@@ -571,22 +576,17 @@ class _Home extends State<Home> {
);
},
);
var upload =
await RemoteData().uploadimage(imagefile!);
if (upload != null) {
setState(() {
isloading = true;
isloading = false;
Navigator.of(context).pop();
});
var jsonResponse = jsonDecode(upload);
await Future.delayed(const Duration(seconds: 2));
updateUI(jsonResponse);
setState(() {
isloading = false;
isVisible = false;
});
}
Navigator.of(context).pop();
} else {
Constants(
'Vasthram', 'Check your internet connection')
......@@ -610,23 +610,17 @@ class _Home extends State<Home> {
void updateUI(Map<String, dynamic> jsonResponse) {
setState(() {
// Update variables based on jsonResponse
isData = true;
isloading = false;
isVisible = false;
status = jsonResponse['status'];
//print(status);
if (status == 'Success') {
//print('One :$status');
bodycolor = jsonResponse['body_color'];
//print('One :$bodycolor');
bodydesigncolor = jsonResponse['body_design_color'];
//print('One :$bodydesigncolor');
bordercolor = jsonResponse['border_color'];
//print('One :$bordercolor');
bordersize = jsonResponse['border_size'];
//print('One :$bordersize');
borderworkcolor = jsonResponse['border_work_color'];
//print('One :$borderworkcolor');
} else {
//print('Two :$status');
Constants.dialogMessage(context, 'Vasthram', 'Could not found image');
bodycolor = '';
bodydesigncolor = '';
......
......@@ -6,8 +6,8 @@ import 'package:http/http.dart' as http;
class RemoteData {
final String loginUrl = 'http://vaman.plutokm.com/login';
final String type = "Content-Type";
final String appjson = "application/json";
final String type = "Content-Type";
final String appjson = "application/json";
Future<String> getLoginRequest(
String loginid, String pass, String token) async {
......
import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:vasthram/RemoteData.dart';
import 'package:vasthram/UserResponse.dart';
import 'Constants.dart';
import 'Home.dart';
import 'package:camera/camera.dart';
class SignUp extends StatefulWidget {
const SignUp({super.key});
const SignUp({Key? key}) : super(key: key);
@override
State<StatefulWidget> createState() => _SignUpState();
}
......@@ -16,6 +20,9 @@ class _SignUpState extends State<SignUp> {
final TextEditingController _pass = TextEditingController();
String dropdownValue = 'Option 1';
bool item = true;
File? imagefile;
CameraController? controller;
Future<void> login(String email, String pass) async {
Constants.showAlertDialog1(context);
final response = await RemoteData().getLoginRequest(email, pass, '');
......@@ -52,16 +59,53 @@ class _SignUpState extends State<SignUp> {
}
}
Future<void> initializeCamera() async {
final cameras = await availableCameras();
// Check if there is a front camera
final frontCamera = cameras.firstWhere(
(camera) => camera.lensDirection == CameraLensDirection.front,
);
if (frontCamera == null) {
if (kDebugMode) {
print('No front camera found');
}
return;
}
// Initialize the CameraController
controller = CameraController(
frontCamera,
ResolutionPreset.high,
);
// Initialize the camera and wait for it to initialize
await controller!.initialize();
}
@override
void dispose() {
_email.dispose();
_pass.dispose();
controller?.dispose();
super.dispose();
}
@override
void initState() {
super.initState();
Future<void> takePicture() async {
if (controller == null || !controller!.value.isInitialized) {
// Initialize the camera before taking a picture
await initializeCamera();
}
// Take a picture
final XFile? picture = await controller!.takePicture();
if (picture != null) {
setState(() {
imagefile = File(picture.path);
});
}
print('Picture taken at: ${picture!.path}');
}
@override
......@@ -75,7 +119,6 @@ class _SignUpState extends State<SignUp> {
fit: BoxFit.cover, // Adjust as needed
),
),
//margin: const EdgeInsets.all(25.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start,
......@@ -83,39 +126,28 @@ class _SignUpState extends State<SignUp> {
const SizedBox(
height: 150,
),
Image.asset(
"assets/images/logo.png",
width: 250, // Adjust the width as needed
height: 125, // Adjust the height as needed
width: 250,
height: 125,
),
const SizedBox(
height: 20,
),
// image: DecorationImage(
// image: AssetImage("assets/images/bg.png"),
// fit: BoxFit.cover, // Adjust as needed
// ),
const Padding(
padding: EdgeInsets.only(
top: 40.0,
left: 20.0,
right: 20.0,
bottom: 0), // Adjust padding as needed
child: SizedBox(
height: 60,
child: Text(
'LOGIN',
style: Constants.buttonsfontStyle,
),
)),
padding: EdgeInsets.only(
top: 40.0, left: 20.0, right: 20.0, bottom: 0),
child: SizedBox(
height: 60,
child: Text(
'LOGIN',
style: Constants.buttonsfontStyle,
),
),
),
Padding(
padding: const EdgeInsets.only(
top: 0,
left: 20.0,
right: 20.0,
bottom: 0), // Adjust padding as needed
top: 0, left: 20.0, right: 20.0, bottom: 0),
child: SizedBox(
height: 50,
child: TextFormField(
......@@ -138,9 +170,8 @@ class _SignUpState extends State<SignUp> {
onPressed: () {},
icon: Image.asset(
"assets/images/user.png",
width: 24, // Adjust the width as needed
height: 24, // Adjust the height as needed
//color: Colors.grey, // Icon color
width: 24,
height: 24,
),
),
),
......@@ -153,10 +184,7 @@ class _SignUpState extends State<SignUp> {
),
Padding(
padding: const EdgeInsets.only(
top: 0,
left: 20.0,
right: 20.0,
bottom: 0), // Adjust padding as needed
top: 0, left: 20.0, right: 20.0, bottom: 0),
child: SizedBox(
height: 50,
child: TextFormField(
......@@ -169,18 +197,17 @@ class _SignUpState extends State<SignUp> {
filled: true,
fillColor: const Color.fromARGB(255, 224, 226, 228),
border: OutlineInputBorder(
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(50)),
borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(50),
),
suffixIcon: Padding(
padding: const EdgeInsets.only(right: 8.0),
child: IconButton(
onPressed: () {
// Add your icon button action here
},
onPressed: () {},
icon: Image.asset(
"assets/images/password.png",
width: 24, // Adjust the width as needed
height: 24, // Adjust the height as needed
width: 24,
height: 24,
),
),
),
......@@ -203,6 +230,11 @@ class _SignUpState extends State<SignUp> {
'', _email.text, '', '', '', true);
Navigator.pushReplacement(context,
MaterialPageRoute(builder: (context) => const Home()));
// if (_email.text.isNotEmpty) {
// takePicture();
// } else {
// print('Else case');
// }
},
style: ButtonStyle(
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
......@@ -240,6 +272,20 @@ class _SignUpState extends State<SignUp> {
),
),
),
// SizedBox(
// width: MediaQuery.of(context).size.width * 0.94,
// height: MediaQuery.of(context).size.height * 0.16,
// child: imagefile != null
// ? Image.file(
// imagefile!,
// fit: BoxFit.cover,
// )
// : Image.asset(
// 'assets/images/captureimage.png',
// width: MediaQuery.of(context).size.width * 0.80,
// height: MediaQuery.of(context).size.height * 0.16,
// ),
// ),
],
),
),
......
......@@ -17,6 +17,46 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
camera:
dependency: "direct main"
description:
name: camera
sha256: "1f9010f0689774380fbcd7d6b7820a5157e8e97685fa66d619e1d1f58b3fdf93"
url: "https://pub.dev"
source: hosted
version: "0.10.5+5"
camera_android:
dependency: transitive
description:
name: camera_android
sha256: "58463140f1b39591b8e2155861b436abad4ceb48160058be8374164ff0309ef3"
url: "https://pub.dev"
source: hosted
version: "0.10.8+13"
camera_avfoundation:
dependency: transitive
description:
name: camera_avfoundation
sha256: "3b6d9f550cfd658c71f34a99509528501e5e5d4fa79f11e3a4d6ef380d8e0254"
url: "https://pub.dev"
source: hosted
version: "0.9.13+7"
camera_platform_interface:
dependency: transitive
description:
name: camera_platform_interface
sha256: "86fd4fc597c6e455265ddb5884feb352d0171ad14b9cdf3aba30da59b25738c4"
url: "https://pub.dev"
source: hosted
version: "2.6.0"
camera_web:
dependency: transitive
description:
name: camera_web
sha256: d4c2c571c7af04f8b10702ca16bb9ed2a26e64534171e8f75c9349b2c004d8f1
url: "https://pub.dev"
source: hosted
version: "0.3.2+3"
characters:
dependency: transitive
description:
......@@ -360,6 +400,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.6"
quiver:
dependency: transitive
description:
name: quiver
sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47
url: "https://pub.dev"
source: hosted
version: "3.2.1"
shared_preferences:
dependency: "direct main"
description:
......@@ -445,6 +493,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.1"
stream_transform:
dependency: transitive
description:
name: stream_transform
sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
......@@ -511,4 +567,4 @@ packages:
version: "1.0.3"
sdks:
dart: ">=3.1.3 <4.0.0"
flutter: ">=3.7.0"
flutter: ">=3.13.0"
......@@ -40,6 +40,8 @@ dependencies:
connectivity: ^3.0.6
crypto: ^3.0.3
shared_preferences: ^2.0.17
camera: ^0.10.5+5
dev_dependencies:
flutter_test:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment