Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
Vasthram
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ramesh Babu Puvvadi
Vasthram
Commits
59f975ac
Commit
59f975ac
authored
Jul 05, 2024
by
Ramesh Babu Puvvadi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added Stock, Sale and View List
parent
25d9c72d
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
190 additions
and
88 deletions
+190
-88
Constants.dart
lib/Constants.dart
+34
-7
Home.dart
lib/Home.dart
+10
-11
Identifyproduct.dart
lib/Identifyproduct.dart
+0
-0
Identifystylecode.dart
lib/Identifystylecode.dart
+0
-0
RemoteData.dart
lib/RemoteData.dart
+116
-22
Searchbybarcode.dart
lib/Searchbybarcode.dart
+11
-18
SplashScreen.dart
lib/SplashScreen.dart
+4
-14
Uploadstylecode.dart
lib/Uploadstylecode.dart
+15
-16
No files found.
lib/Constants.dart
View file @
59f975ac
...
...
@@ -153,11 +153,10 @@ class Constants {
static
showLoader
(
BuildContext
ctx
)
{
showDialog
(
context:
ctx
,
builder:
(
context
)
{
return
const
Center
(
child:
CircularProgressIndicator
());
}
);
context:
ctx
,
builder:
(
context
)
{
return
const
Center
(
child:
CircularProgressIndicator
());
});
}
static
Future
<
void
>
dismissAlertDialog1
(
BuildContext
context
)
async
{
...
...
@@ -232,8 +231,7 @@ class Constants {
child:
const
Text
(
"Cancel"
),
onPressed:
()
{
Navigator
.
of
(
context
).
pop
();
}
);
});
AlertDialog
alert
=
AlertDialog
(
title:
Text
(
title
),
content:
Text
(
message
),
...
...
@@ -255,6 +253,35 @@ class Constants {
return
dropdownItemHeight
;
}
static
Showindicator
(
BuildContext
context
,
String
loadertext
)
{
showDialog
(
context:
context
,
barrierDismissible:
false
,
builder:
(
context
)
{
return
Center
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
[
const
CircularProgressIndicator
(
color:
Color
.
fromARGB
(
255
,
69
,
66
,
121
),
),
const
SizedBox
(
height:
16
),
// Add some spacing
Text
(
'
$loadertext
...'
,
// Use the dynamic text here
style:
const
TextStyle
(
fontSize:
16
,
decoration:
TextDecoration
.
none
,
color:
Colors
.
white
,
// Set the text color to your preference
),
),
const
SizedBox
(
height:
16
),
],
),
);
});
}
showAlertDialog
(
BuildContext
context
,
bool
val
)
{
Widget
okButton
=
TextButton
(
child:
const
Text
(
"Cancel"
),
...
...
lib/Home.dart
View file @
59f975ac
...
...
@@ -166,6 +166,7 @@ class _Home extends State<Home> {
),
const
Padding
(
padding:
EdgeInsets
.
only
(
left:
10
,
bottom:
10
)),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
...
...
@@ -236,6 +237,7 @@ class _Home extends State<Home> {
),
const
Padding
(
padding:
EdgeInsets
.
only
(
left:
10
,
bottom:
10
)),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
start
,
children:
[
...
...
@@ -324,8 +326,7 @@ class _Home extends State<Home> {
),
padding:
const
EdgeInsets
.
all
(
12
),
child:
const
Column
(
mainAxisAlignment:
MainAxisAlignment
.
end
,
// Align content at the bottom
mainAxisAlignment:
MainAxisAlignment
.
end
,
// Align content at the bottom
crossAxisAlignment:
CrossAxisAlignment
.
end
,
children:
[
Text
(
...
...
@@ -869,16 +870,14 @@ class _Home extends State<Home> {
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.90
,
child:
GestureDetector
(
onTap:
()
{
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) =>
// const Identifyproduct()),
// );
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
const
Identifyproduct
()),
);
},
child:
Container
(
margin:
const
EdgeInsets
.
only
(
left:
20
,
top:
0
,
right:
2
,
bottom:
0
),
margin:
const
EdgeInsets
.
only
(
left:
20
,
top:
0
,
right:
2
,
bottom:
0
),
width:
MediaQuery
.
of
(
context
).
size
.
width
*
0.100
,
height:
MediaQuery
.
of
(
context
).
size
.
width
*
0.22
,
padding:
const
EdgeInsets
.
all
(
5
),
...
...
@@ -902,7 +901,7 @@ class _Home extends State<Home> {
height:
42
,
),
// replace with your image
const
Text
(
'
\t\t\t\t\t\t
IDENTIFY PRODUCT
'
,
'
\t\t\t\t\t\t
DETECT ATTRIBUTES
'
,
style:
Constants
.
buttonsfontStyle
,
)
],
...
...
lib/Identifyproduct.dart
View file @
59f975ac
This diff is collapsed.
Click to expand it.
lib/Identifystylecode.dart
View file @
59f975ac
This diff is collapsed.
Click to expand it.
lib/RemoteData.dart
View file @
59f975ac
...
...
@@ -6,13 +6,17 @@ import 'package:http/http.dart' as http;
class
RemoteData
{
final
String
loginUrl
=
'http://vaman.plutokm.com/login'
;
final
String
Uploadimage
=
'http://vaman.plutokm.com/vasthram_mobile'
;
final
String
I
dentifystylecode
=
'https://vaman.plutokm.com/get_vasthram_style_code'
;
final
String
imageupload
=
'http://vaman.plutokm.com/vasthram_mobile'
;
final
String
i
dentifystylecode
=
'https://vaman.plutokm.com/get_vasthram_style_code'
;
final
String
registerstylecode
=
'https://vaman.plutokm.com/register_style_code'
;
final
String
detectattributes
=
'https://vaman.plutokm.com/detect_attributes'
;
final
String
sale
=
'https://vaman.plutokm.com/stylecode_sales_data'
;
final
String
stock
=
'https://vaman.plutokm.com/stylecode_stock_data'
;
final
String
type
=
'Content-Type'
;
final
String
appjson
=
'application/json'
;
Future
<
String
>
getLoginRequest
(
String
loginid
,
String
pass
,
String
token
)
async
{
Future
<
String
>
getLoginRequest
(
String
loginid
,
String
pass
,
String
token
)
async
{
Map
<
String
,
dynamic
>
body
=
{
'login_id'
:
loginid
,
'password'
:
pass
,
...
...
@@ -36,16 +40,19 @@ class RemoteData {
}
}
Future
<
String
?>
uploadimage
(
File
imagepath
,
String
embedding
)
async
{
Future
<
String
>
stockData
(
String
stylecode
)
async
{
print
(
stylecode
);
try
{
final
request
=
http
.
MultipartRequest
(
'POST'
,
Uri
.
parse
(
'http://vaman.plutokm.com/detect_saree'
));
request
.
files
.
add
(
await
http
.
MultipartFile
.
fromPath
(
'image'
,
imagepath
.
path
));
final
request
=
http
.
MultipartRequest
(
'POST'
,
Uri
.
parse
(
stock
));
request
.
files
.
add
(
http
.
MultipartFile
.
fromString
(
'stylecode'
,
stylecode
));
//request.files.add(await http.MultipartFile.fromPath('embedding', embedding));
var
response
=
await
request
.
send
();
var
response
=
await
request
.
send
();
var
responseString
=
await
response
.
stream
.
bytesToString
();
if
(
kDebugMode
)
{
print
(
'Response :
$responseString
'
);
}
print
(
response
.
statusCode
);
if
(
response
.
statusCode
==
200
)
{
return
responseString
;
}
else
{
...
...
@@ -59,18 +66,18 @@ class RemoteData {
return
''
;
}
Future
<
String
?>
IdentifyStyleCode
(
File
imagepath
,
String
bodyimagepath
)
async
{
print
(
'Identify Stylecode
$bodyimagepath
'
);
Future
<
String
>
saleData
(
String
stylecode
)
async
{
print
(
stylecode
);
try
{
final
request
=
http
.
MultipartRequest
(
'POST'
,
Uri
.
parse
(
Identifystylecode
));
request
.
files
.
add
(
await
http
.
MultipartFile
.
fromPath
(
'image'
,
imagepath
.
path
));
request
.
files
.
add
(
await
http
.
MultipartFile
.
fromString
(
'body_image_path'
,
bodyimagepath
));
final
request
=
http
.
MultipartRequest
(
'POST'
,
Uri
.
parse
(
sale
));
request
.
files
.
add
(
http
.
MultipartFile
.
fromString
(
'stylecode'
,
stylecode
));
//request.files.add(await http.MultipartFile.fromPath('embedding', embedding));
var
response
=
await
request
.
send
();
var
response
=
await
request
.
send
();
var
responseString
=
await
response
.
stream
.
bytesToString
();
if
(
kDebugMode
)
{
print
(
'Response :
$responseString
'
);
}
print
(
response
.
statusCode
);
if
(
response
.
statusCode
==
200
)
{
return
responseString
;
}
else
{
...
...
@@ -84,16 +91,102 @@ class RemoteData {
return
''
;
}
Future
<
String
?>
registerStyleCode
(
File
imagepath
,
var
embedding
,
String
stylecode
)
async
{
print
(
'Register Style Code :
$stylecode
'
);
Future
<
String
?>
uploadimage
(
File
imagepath
,
String
embedding
)
async
{
try
{
final
request
=
http
.
MultipartRequest
(
'POST'
,
Uri
.
parse
(
registerstylecode
));
request
.
files
.
add
(
await
http
.
MultipartFile
.
fromPath
(
'image'
,
imagepath
.
path
));
request
.
files
.
add
(
http
.
MultipartFile
.
fromString
(
'body_image_path'
,
embedding
));
//request.fields('style_code', stylecode);
request
.
fields
[
'style_code'
]
=
stylecode
;
final
request
=
http
.
MultipartRequest
(
'POST'
,
Uri
.
parse
(
'http://vaman.plutokm.com/detect_saree'
));
request
.
files
.
add
(
await
http
.
MultipartFile
.
fromPath
(
'image'
,
imagepath
.
path
));
var
response
=
await
request
.
send
();
var
responseString
=
await
response
.
stream
.
bytesToString
();
if
(
kDebugMode
)
{
print
(
'Response :
$responseString
'
);
}
if
(
response
.
statusCode
==
200
)
{
return
responseString
;
}
else
{
return
responseString
;
}
}
catch
(
e
)
{
if
(
kDebugMode
)
{
print
(
e
);
}
}
return
''
;
}
Future
<
String
?>
IdentifyStyleCode
(
File
imagepath
,
String
bodyimagepath
)
async
{
if
(
kDebugMode
)
{
print
(
'Identify Stylecode
$bodyimagepath
'
);
}
try
{
final
request
=
http
.
MultipartRequest
(
'POST'
,
Uri
.
parse
(
identifystylecode
));
request
.
files
.
add
(
await
http
.
MultipartFile
.
fromPath
(
'image'
,
imagepath
.
path
));
request
.
files
.
add
(
http
.
MultipartFile
.
fromString
(
'body_image_path'
,
bodyimagepath
));
//request.files.add(await http.MultipartFile.fromPath('embedding', embedding));
var
response
=
await
request
.
send
();
var
response
=
await
request
.
send
();
var
responseString
=
await
response
.
stream
.
bytesToString
();
if
(
kDebugMode
)
{
print
(
'Response :
$responseString
'
);
}
if
(
response
.
statusCode
==
200
)
{
return
responseString
;
}
else
{
return
responseString
;
}
}
catch
(
e
)
{
if
(
kDebugMode
)
{
print
(
e
);
}
}
return
''
;
}
Future
<
String
?>
detectAttributes
(
File
imagepath
,
String
image
)
async
{
try
{
final
request
=
http
.
MultipartRequest
(
'POST'
,
Uri
.
parse
(
detectattributes
));
request
.
files
.
add
(
await
http
.
MultipartFile
.
fromPath
(
'image'
,
imagepath
.
path
));
request
.
files
.
add
(
http
.
MultipartFile
.
fromString
(
'body_image_path'
,
image
));
//request.fields['style_code'] = stylecode;
var
response
=
await
request
.
send
();
var
responseString
=
await
response
.
stream
.
bytesToString
();
if
(
kDebugMode
)
{
print
(
'Response :
$responseString
'
);
}
if
(
response
.
statusCode
==
200
)
{
return
responseString
;
}
else
{
return
responseString
;
}
}
catch
(
e
)
{
if
(
kDebugMode
)
{
print
(
e
);
}
}
return
''
;
}
Future
<
String
?>
registerStyleCode
(
File
imagepath
,
var
embedding
,
String
stylecode
)
async
{
if
(
kDebugMode
)
{
print
(
'Register Style Code :
$stylecode
'
);
}
try
{
final
request
=
http
.
MultipartRequest
(
'POST'
,
Uri
.
parse
(
registerstylecode
));
request
.
files
.
add
(
await
http
.
MultipartFile
.
fromPath
(
'image'
,
imagepath
.
path
));
request
.
files
.
add
(
http
.
MultipartFile
.
fromString
(
'body_image_path'
,
embedding
));
request
.
fields
[
'style_code'
]
=
stylecode
;
var
response
=
await
request
.
send
();
var
responseString
=
await
response
.
stream
.
bytesToString
();
if
(
kDebugMode
)
{
print
(
'Response :
$responseString
'
);
...
...
@@ -113,7 +206,8 @@ class RemoteData {
Future
<
String
?>
searchbybarcode
(
String
barcode
)
async
{
var
client
=
http
.
Client
();
var
res
=
await
client
.
get
(
Uri
.
parse
(
'https://vaman.plutokm.com/get_vas_barcode_image/
$barcode
'
));
var
res
=
await
client
.
get
(
Uri
.
parse
(
'https://vaman.plutokm.com/get_vas_barcode_image/
$barcode
'
));
if
(
kDebugMode
)
{
print
(
res
.
body
);
}
...
...
lib/Searchbybarcode.dart
View file @
59f975ac
...
...
@@ -108,18 +108,9 @@ class _Searchbybarcode extends State<Searchbybarcode> {
bool
isInternetConnected
=
await
Constants
.
checkInternetConnectivity
();
if
(
isInternetConnected
)
{
showDialog
(
context:
context
,
barrierDismissible:
false
,
builder:
(
context
)
{
return
const
Center
(
child:
CircularProgressIndicator
(
color:
Color
.
fromARGB
(
255
,
69
,
66
,
121
),
),
);
}
);
var
upload
=
await
RemoteData
().
searchbybarcode
(
_barcode
.
text
.
trim
().
toUpperCase
());
Constants
.
Showindicator
(
context
,
'Search Barcode'
);
var
upload
=
await
RemoteData
().
searchbybarcode
(
_barcode
.
text
.
trim
().
toUpperCase
());
if
(
upload
!=
null
)
{
var
jsonResponse
=
jsonDecode
(
upload
);
await
Future
.
delayed
(
const
Duration
(
seconds:
1
));
...
...
@@ -129,7 +120,7 @@ class _Searchbybarcode extends State<Searchbybarcode> {
if
(
kDebugMode
)
{
print
(
'Testing =========>'
);
}
Navigator
.
of
(
context
).
pop
();
//
Navigator.of(context).pop();
}
}
else
{
setDialog
(
'Check your internet connection'
);
...
...
@@ -148,7 +139,6 @@ class _Searchbybarcode extends State<Searchbybarcode> {
end:
Alignment
.
bottomRight
,
colors:
[
Color
.
fromARGB
(
255
,
227
,
144
,
214
),
//Color(0xFFC2185B),
Color
.
fromARGB
(
255
,
125
,
174
,
251
),
],
),
...
...
@@ -157,7 +147,6 @@ class _Searchbybarcode extends State<Searchbybarcode> {
child:
const
Row
(
children:
[
Text
(
'
\t\t
'
),
// replace with your image
Expanded
(
child:
Center
(
child:
Text
(
...
...
@@ -211,15 +200,19 @@ class _Searchbybarcode extends State<Searchbybarcode> {
}
void
updateUI
(
Map
<
String
,
dynamic
>
jsonResponse
)
{
setState
(()
{
var
newImageUrl
=
jsonResponse
[
'image_url'
];
Navigator
.
of
(
context
).
pop
();
var
newImageUrl
=
jsonResponse
[
'image_url'
];
var
status
=
jsonResponse
[
'status'
];
if
(
status
==
'NotFound'
)
{
setDialog
(
jsonResponse
[
'status'
]);
}
else
{
setState
(()
{
imageUrl
=
newImageUrl
;
var
str
=
_barcode
.
text
;
value
=
'BARCODE :
$str
'
;
_barcode
.
clear
();
});
}
);
}
}
void
setDialog
(
String
text
)
{
...
...
lib/SplashScreen.dart
View file @
59f975ac
...
...
@@ -8,6 +8,7 @@ import 'package:vasthram/SignUp.dart';
class
UserPreferences
{
static
const
String
isLoggedInKey
=
'isLoggedIn'
;
static
Future
<
SharedPreferences
>
getSharedPreferences
()
async
{
return
await
SharedPreferences
.
getInstance
();
}
...
...
@@ -27,6 +28,7 @@ class SplashScreen extends StatefulWidget {
class
SplashScreenState
extends
State
<
SplashScreen
>
{
bool
?
isLoggedIn
=
false
;
void
timeToShowSplashScreenOnScreen
()
async
{
Timer
(
const
Duration
(
seconds:
5
),
()
async
{
if
(!
mounted
)
return
;
...
...
@@ -39,7 +41,8 @@ class SplashScreenState extends State<SplashScreen> {
if
(
kDebugMode
)
{
print
(
'if condition :
$isLoggedIn
'
);
}
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
const
Home
()));
Navigator
.
push
(
context
,
MaterialPageRoute
(
builder:
(
context
)
=>
const
Home
()));
}
else
{
Navigator
.
pushAndRemoveUntil
(
context
,
...
...
@@ -67,19 +70,6 @@ class SplashScreenState extends State<SplashScreen> {
width:
MediaQuery
.
of
(
context
).
size
.
width
,
frameRate:
30
,
//default is 15 FPS
),
// decoration: const BoxDecoration(
// //loadingText: Text("Loading"),
// GifView.asset(
// 'assets/images/login.gif',
// height: 350,
// width: 350,
// frameRate: 30, //default is 15 FPS
// ),
// image: DecorationImage(
// image: AssetImage("assets/images/splash.gif"),
// fit: BoxFit.cover,
// ),
// ),
),
);
}
...
...
lib/Uploadstylecode.dart
View file @
59f975ac
...
...
@@ -117,16 +117,7 @@ class _Uploadstylecode extends State<Uploadstylecode> {
});
bool
isInternetConnected
=
await
Constants
.
checkInternetConnectivity
();
if
(
isInternetConnected
)
{
showDialog
(
context:
context
,
barrierDismissible:
false
,
builder:
(
context
)
{
return
const
Center
(
child:
CircularProgressIndicator
(
color:
Color
.
fromARGB
(
255
,
69
,
66
,
121
),
),
);
});
Constants
.
Showindicator
(
context
,
'Detecting Saree'
);
var
upload
=
await
RemoteData
().
uploadimage
(
imagefile
!,
''
);
print
(
_stylecode
.
text
);
if
(
upload
!=
null
)
{
...
...
@@ -686,12 +677,16 @@ class _Uploadstylecode extends State<Uploadstylecode> {
setState
(()
{
_base64Image
=
annotated_image
;
});
Constants
.
Showindicator
(
context
,
'Register Stylecode'
);
var
upload
=
await
RemoteData
()
.
registerStyleCode
(
imagefile
!,
bodyimage
,
_stylecode
.
text
);
var
json
=
jsonDecode
(
upload
!);
await
Future
.
delayed
(
const
Duration
(
seconds:
1
));
getupdate
(
json
);
print
(
upload
);
if
(
upload
!=
null
)
{
var
json
=
jsonDecode
(
upload
);
await
Future
.
delayed
(
const
Duration
(
seconds:
1
));
getupdate
(
json
);
print
(
upload
);
}
return
;
}
else
{
showDialog
(
...
...
@@ -721,6 +716,10 @@ class _Uploadstylecode extends State<Uploadstylecode> {
void
getupdate
(
Map
<
String
,
dynamic
>
jsonResponse
)
{
setState
(()
{
Navigator
.
of
(
context
).
pop
();
setState
(()
{
isloading
=
false
;
});
isVisible
=
false
;
//{"error_message":"","reg_status":"Success"}
status
=
jsonResponse
[
'reg_status'
];
...
...
@@ -736,10 +735,10 @@ class _Uploadstylecode extends State<Uploadstylecode> {
}
else
{
print
(
'Else Printing ===============>'
);
setDialog
(
jsonResponse
[
'
error_message
'
]);
setDialog
(
jsonResponse
[
'
reg_status
'
]);
//bytes!.clear();
//bytes1!.clear();
embedding
!.
clear
();
//
embedding!.clear();
//Navigator.of(context).pop();
}
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment