Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
ASD_Detection
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2023-161
ASD_Detection
Commits
10283f70
Commit
10283f70
authored
Sep 09, 2023
by
Wijegunarathna K. P. S. G. G.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Develop step 02 page of component 01
parent
1c98bbef
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
101 additions
and
0 deletions
+101
-0
Frontend/lib/pages/Comp1/Step1/Step2/Comp1Step2.dart
Frontend/lib/pages/Comp1/Step1/Step2/Comp1Step2.dart
+101
-0
No files found.
Frontend/lib/pages/Comp1/Step1/Step2/Comp1Step2.dart
0 → 100644
View file @
10283f70
import
'dart:io'
;
import
'package:Autism/widgets/AudioInput.dart'
;
import
'package:Autism/widgets/ButtonIcon.dart'
;
import
'package:Autism/widgets/Instructions.dart'
;
import
'package:flutter/material.dart'
;
import
'package:Autism/MyStyles.dart'
as
MyStyles
;
import
'package:Autism/Api.dart'
as
Api
;
import
'package:dio/dio.dart'
;
class
Comp1Step2
extends
StatefulWidget
{
const
Comp1Step2
({
super
.
key
});
@override
State
<
Comp1Step2
>
createState
()
=>
_Comp1Step2State
();
}
class
_Comp1Step2State
extends
State
<
Comp1Step2
>
{
File
?
recordedFile
;
String
color
=
''
;
Future
sendRequest
()
async
{
try
{
Response
response
;
var
dio
=
Dio
();
FormData
formData
=
FormData
.
fromMap
({
'audio'
:
await
MultipartFile
.
fromFile
(
recordedFile
!.
path
,
//filename: 'image.jpg'
),
});
response
=
await
dio
.
post
(
Api
.
Comp1Api
,
data:
formData
,
// onSendProgress: (int sent, int total) {
// print((100 * sent) / total);
// },
);
if
(
response
.
statusCode
==
200
)
{
if
(
response
.
data
[
"abnomility-sentiment"
]
==
"autism"
)
{
setState
(()
{
color
=
"රතු පාට"
;
});
// var color = "Red";
}
else
{
// color = "Green";
setState
(()
{
color
=
"කොළ පාට"
;
});
}
print
(
response
.
data
);
print
(
response
.
data
[
"abnomility-sentiment"
]);
print
(
color
);
nextPage
(
'/Results'
);
}
}
catch
(
e
)
{
print
(
e
);
}
}
void
nextPage
(
String
route
)
{
Navigator
.
pushNamed
(
context
,
route
,
arguments:
{
'color'
:
color
});
}
@override
Widget
build
(
BuildContext
context
)
{
return
Column
(
children:
[
Instructions
(
title:
'උපදෙස්'
,
body:
'ඔබේ දරුවාට කතන්දරය කීම ආරම්ඹ කරන්න යැයි පවසන්න'
,
),
SizedBox
(
height:
50
,
),
Row
(
mainAxisAlignment:
MainAxisAlignment
.
spaceEvenly
,
children:
[
AudioInput
(
audio:
'audio'
,
rtn:
(
reco
)
{
setState
(()
{
recordedFile
=
reco
;
});
print
(
'recorded'
);
}),
recordedFile
!=
null
?
ButtonIcon
(
click:
()
=>
sendRequest
(),
icon:
Icons
.
arrow_forward_ios
,
bg:
MyStyles
.
cbtnPrimary
,
)
:
SizedBox
(),
],
)
],
);
}
}
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