Commit 476a9852 by Ramesh Babu Puvvadi

added

parent 5b3987cb
...@@ -45,7 +45,7 @@ android { ...@@ -45,7 +45,7 @@ android {
applicationId "com.sopt.vasthram" applicationId "com.sopt.vasthram"
// You can update the following values to match your application needs. // 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. // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion minSdkVersion 21
targetSdkVersion flutter.targetSdkVersion targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger() versionCode flutterVersionCode.toInteger()
versionName flutterVersionName versionName flutterVersionName
......
PODS: PODS:
- camera_avfoundation (0.0.1):
- Flutter
- connectivity (0.0.1): - connectivity (0.0.1):
- Flutter - Flutter
- Reachability - Reachability
...@@ -11,6 +13,7 @@ PODS: ...@@ -11,6 +13,7 @@ PODS:
- FlutterMacOS - FlutterMacOS
DEPENDENCIES: DEPENDENCIES:
- camera_avfoundation (from `.symlinks/plugins/camera_avfoundation/ios`)
- connectivity (from `.symlinks/plugins/connectivity/ios`) - connectivity (from `.symlinks/plugins/connectivity/ios`)
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`) - image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
...@@ -21,6 +24,8 @@ SPEC REPOS: ...@@ -21,6 +24,8 @@ SPEC REPOS:
- Reachability - Reachability
EXTERNAL SOURCES: EXTERNAL SOURCES:
camera_avfoundation:
:path: ".symlinks/plugins/camera_avfoundation/ios"
connectivity: connectivity:
:path: ".symlinks/plugins/connectivity/ios" :path: ".symlinks/plugins/connectivity/ios"
Flutter: Flutter:
...@@ -31,6 +36,7 @@ EXTERNAL SOURCES: ...@@ -31,6 +36,7 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin" :path: ".symlinks/plugins/shared_preferences_foundation/darwin"
SPEC CHECKSUMS: SPEC CHECKSUMS:
camera_avfoundation: 3125e8cd1a4387f6f31c6c63abb8a55892a9eeeb
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467 connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5 image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
......
...@@ -20,6 +20,7 @@ class _Home extends State<Home> { ...@@ -20,6 +20,7 @@ class _Home extends State<Home> {
XFile? image; XFile? image;
bool isloading = false; bool isloading = false;
bool isVisible = true; bool isVisible = true;
bool isData = false;
var bodycolor = ''; var bodycolor = '';
var bodydesigncolor = ''; var bodydesigncolor = '';
var bordercolor = ''; var bordercolor = '';
...@@ -35,6 +36,7 @@ class _Home extends State<Home> { ...@@ -35,6 +36,7 @@ class _Home extends State<Home> {
setState(() { setState(() {
imagefile = File(image!.path); imagefile = File(image!.path);
isVisible = true; isVisible = true;
isData = false;
}); });
} else { } else {
image = await _picker.pickImage(source: ImageSource.camera); image = await _picker.pickImage(source: ImageSource.camera);
...@@ -460,7 +462,6 @@ class _Home extends State<Home> { ...@@ -460,7 +462,6 @@ class _Home extends State<Home> {
"assets/images/signout.png", "assets/images/signout.png",
width: 24, // Adjust the width as needed width: 24, // Adjust the width as needed
height: 24, // Adjust the height as needed height: 24, // Adjust the height as needed
//color: Colors.grey, // Icon color
), ),
onPressed: () async { onPressed: () async {
bool valid = await Constants.checkInternetConnectivity(); bool valid = await Constants.checkInternetConnectivity();
...@@ -525,6 +526,7 @@ class _Home extends State<Home> { ...@@ -525,6 +526,7 @@ class _Home extends State<Home> {
), ),
], ],
), ),
if (isData)
SizedBox( SizedBox(
height: MediaQuery.of(context).size.height * 0.30, height: MediaQuery.of(context).size.height * 0.30,
child: PageView( child: PageView(
...@@ -536,6 +538,9 @@ class _Home extends State<Home> { ...@@ -536,6 +538,9 @@ class _Home extends State<Home> {
], ],
), ),
), ),
SizedBox(
height: MediaQuery.of(context).size.height * 0.30,
),
Visibility( Visibility(
visible: isVisible, visible: isVisible,
child: ElevatedButton( child: ElevatedButton(
...@@ -571,22 +576,17 @@ class _Home extends State<Home> { ...@@ -571,22 +576,17 @@ class _Home extends State<Home> {
); );
}, },
); );
var upload = var upload =
await RemoteData().uploadimage(imagefile!); await RemoteData().uploadimage(imagefile!);
if (upload != null) { if (upload != null) {
setState(() { setState(() {
isloading = true; isloading = false;
Navigator.of(context).pop();
}); });
var jsonResponse = jsonDecode(upload); var jsonResponse = jsonDecode(upload);
await Future.delayed(const Duration(seconds: 2)); await Future.delayed(const Duration(seconds: 2));
updateUI(jsonResponse); updateUI(jsonResponse);
setState(() {
isloading = false;
isVisible = false;
});
} }
Navigator.of(context).pop();
} else { } else {
Constants( Constants(
'Vasthram', 'Check your internet connection') 'Vasthram', 'Check your internet connection')
...@@ -610,23 +610,17 @@ class _Home extends State<Home> { ...@@ -610,23 +610,17 @@ class _Home extends State<Home> {
void updateUI(Map<String, dynamic> jsonResponse) { void updateUI(Map<String, dynamic> jsonResponse) {
setState(() { setState(() {
// Update variables based on jsonResponse isData = true;
isloading = false;
isVisible = false;
status = jsonResponse['status']; status = jsonResponse['status'];
//print(status);
if (status == 'Success') { if (status == 'Success') {
//print('One :$status');
bodycolor = jsonResponse['body_color']; bodycolor = jsonResponse['body_color'];
//print('One :$bodycolor');
bodydesigncolor = jsonResponse['body_design_color']; bodydesigncolor = jsonResponse['body_design_color'];
//print('One :$bodydesigncolor');
bordercolor = jsonResponse['border_color']; bordercolor = jsonResponse['border_color'];
//print('One :$bordercolor');
bordersize = jsonResponse['border_size']; bordersize = jsonResponse['border_size'];
//print('One :$bordersize');
borderworkcolor = jsonResponse['border_work_color']; borderworkcolor = jsonResponse['border_work_color'];
//print('One :$borderworkcolor');
} else { } else {
//print('Two :$status');
Constants.dialogMessage(context, 'Vasthram', 'Could not found image'); Constants.dialogMessage(context, 'Vasthram', 'Could not found image');
bodycolor = ''; bodycolor = '';
bodydesigncolor = ''; bodydesigncolor = '';
......
import 'dart:convert'; import 'dart:convert';
import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:vasthram/RemoteData.dart'; import 'package:vasthram/RemoteData.dart';
import 'package:vasthram/UserResponse.dart'; import 'package:vasthram/UserResponse.dart';
import 'Constants.dart'; import 'Constants.dart';
import 'Home.dart'; import 'Home.dart';
import 'package:camera/camera.dart';
class SignUp extends StatefulWidget { class SignUp extends StatefulWidget {
const SignUp({super.key}); const SignUp({Key? key}) : super(key: key);
@override @override
State<StatefulWidget> createState() => _SignUpState(); State<StatefulWidget> createState() => _SignUpState();
} }
...@@ -16,6 +20,9 @@ class _SignUpState extends State<SignUp> { ...@@ -16,6 +20,9 @@ class _SignUpState extends State<SignUp> {
final TextEditingController _pass = TextEditingController(); final TextEditingController _pass = TextEditingController();
String dropdownValue = 'Option 1'; String dropdownValue = 'Option 1';
bool item = true; bool item = true;
File? imagefile;
CameraController? controller;
Future<void> login(String email, String pass) async { Future<void> login(String email, String pass) async {
Constants.showAlertDialog1(context); Constants.showAlertDialog1(context);
final response = await RemoteData().getLoginRequest(email, pass, ''); final response = await RemoteData().getLoginRequest(email, pass, '');
...@@ -52,16 +59,53 @@ class _SignUpState extends State<SignUp> { ...@@ -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 @override
void dispose() { void dispose() {
_email.dispose(); _email.dispose();
_pass.dispose(); _pass.dispose();
controller?.dispose();
super.dispose(); super.dispose();
} }
@override Future<void> takePicture() async {
void initState() { if (controller == null || !controller!.value.isInitialized) {
super.initState(); // 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 @override
...@@ -75,7 +119,6 @@ class _SignUpState extends State<SignUp> { ...@@ -75,7 +119,6 @@ class _SignUpState extends State<SignUp> {
fit: BoxFit.cover, // Adjust as needed fit: BoxFit.cover, // Adjust as needed
), ),
), ),
//margin: const EdgeInsets.all(25.0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
...@@ -83,39 +126,28 @@ class _SignUpState extends State<SignUp> { ...@@ -83,39 +126,28 @@ class _SignUpState extends State<SignUp> {
const SizedBox( const SizedBox(
height: 150, height: 150,
), ),
Image.asset( Image.asset(
"assets/images/logo.png", "assets/images/logo.png",
width: 250, // Adjust the width as needed width: 250,
height: 125, // Adjust the height as needed height: 125,
), ),
const SizedBox( const SizedBox(
height: 20, height: 20,
), ),
// image: DecorationImage(
// image: AssetImage("assets/images/bg.png"),
// fit: BoxFit.cover, // Adjust as needed
// ),
const Padding( const Padding(
padding: EdgeInsets.only( padding: EdgeInsets.only(
top: 40.0, top: 40.0, left: 20.0, right: 20.0, bottom: 0),
left: 20.0,
right: 20.0,
bottom: 0), // Adjust padding as needed
child: SizedBox( child: SizedBox(
height: 60, height: 60,
child: Text( child: Text(
'LOGIN', 'LOGIN',
style: Constants.buttonsfontStyle, style: Constants.buttonsfontStyle,
), ),
)), ),
),
Padding( Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
top: 0, top: 0, left: 20.0, right: 20.0, bottom: 0),
left: 20.0,
right: 20.0,
bottom: 0), // Adjust padding as needed
child: SizedBox( child: SizedBox(
height: 50, height: 50,
child: TextFormField( child: TextFormField(
...@@ -138,9 +170,8 @@ class _SignUpState extends State<SignUp> { ...@@ -138,9 +170,8 @@ class _SignUpState extends State<SignUp> {
onPressed: () {}, onPressed: () {},
icon: Image.asset( icon: Image.asset(
"assets/images/user.png", "assets/images/user.png",
width: 24, // Adjust the width as needed width: 24,
height: 24, // Adjust the height as needed height: 24,
//color: Colors.grey, // Icon color
), ),
), ),
), ),
...@@ -153,10 +184,7 @@ class _SignUpState extends State<SignUp> { ...@@ -153,10 +184,7 @@ class _SignUpState extends State<SignUp> {
), ),
Padding( Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
top: 0, top: 0, left: 20.0, right: 20.0, bottom: 0),
left: 20.0,
right: 20.0,
bottom: 0), // Adjust padding as needed
child: SizedBox( child: SizedBox(
height: 50, height: 50,
child: TextFormField( child: TextFormField(
...@@ -170,17 +198,16 @@ class _SignUpState extends State<SignUp> { ...@@ -170,17 +198,16 @@ class _SignUpState extends State<SignUp> {
fillColor: const Color.fromARGB(255, 224, 226, 228), fillColor: const Color.fromARGB(255, 224, 226, 228),
border: OutlineInputBorder( border: OutlineInputBorder(
borderSide: BorderSide.none, borderSide: BorderSide.none,
borderRadius: BorderRadius.circular(50)), borderRadius: BorderRadius.circular(50),
),
suffixIcon: Padding( suffixIcon: Padding(
padding: const EdgeInsets.only(right: 8.0), padding: const EdgeInsets.only(right: 8.0),
child: IconButton( child: IconButton(
onPressed: () { onPressed: () {},
// Add your icon button action here
},
icon: Image.asset( icon: Image.asset(
"assets/images/password.png", "assets/images/password.png",
width: 24, // Adjust the width as needed width: 24,
height: 24, // Adjust the height as needed height: 24,
), ),
), ),
), ),
...@@ -203,6 +230,11 @@ class _SignUpState extends State<SignUp> { ...@@ -203,6 +230,11 @@ class _SignUpState extends State<SignUp> {
'', _email.text, '', '', '', true); '', _email.text, '', '', '', true);
Navigator.pushReplacement(context, Navigator.pushReplacement(context,
MaterialPageRoute(builder: (context) => const Home())); MaterialPageRoute(builder: (context) => const Home()));
// if (_email.text.isNotEmpty) {
// takePicture();
// } else {
// print('Else case');
// }
}, },
style: ButtonStyle( style: ButtonStyle(
shape: MaterialStateProperty.all<RoundedRectangleBorder>( shape: MaterialStateProperty.all<RoundedRectangleBorder>(
...@@ -240,6 +272,20 @@ class _SignUpState extends State<SignUp> { ...@@ -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: ...@@ -17,6 +17,46 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" 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: characters:
dependency: transitive dependency: transitive
description: description:
...@@ -360,6 +400,14 @@ packages: ...@@ -360,6 +400,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.6" version: "2.1.6"
quiver:
dependency: transitive
description:
name: quiver
sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47
url: "https://pub.dev"
source: hosted
version: "3.2.1"
shared_preferences: shared_preferences:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -445,6 +493,14 @@ packages: ...@@ -445,6 +493,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.1" 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: string_scanner:
dependency: transitive dependency: transitive
description: description:
...@@ -511,4 +567,4 @@ packages: ...@@ -511,4 +567,4 @@ packages:
version: "1.0.3" version: "1.0.3"
sdks: sdks:
dart: ">=3.1.3 <4.0.0" dart: ">=3.1.3 <4.0.0"
flutter: ">=3.7.0" flutter: ">=3.13.0"
...@@ -40,6 +40,8 @@ dependencies: ...@@ -40,6 +40,8 @@ dependencies:
connectivity: ^3.0.6 connectivity: ^3.0.6
crypto: ^3.0.3 crypto: ^3.0.3
shared_preferences: ^2.0.17 shared_preferences: ^2.0.17
camera: ^0.10.5+5
dev_dependencies: dev_dependencies:
flutter_test: 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