Commit 15c30659 authored by Wijegunarathna K. P. S. G. G.'s avatar Wijegunarathna K. P. S. G. G.

Merge branch 'IT20244170' into 'master'

Merge with IT20244170 branch with Main branch.

See merge request !4
parents a26d560f 40c54640
This diff is collapsed.
import 'package:Autism/widgets/Button.dart';
import 'package:Autism/widgets/Header.dart';
import 'package:flutter/material.dart';
import 'package:Autism/MyStyles.dart' as MyStyles;
class Comp1Intro extends StatefulWidget {
const Comp1Intro({super.key});
@override
State<Comp1Intro> createState() => _Comp1IntroState();
}
class _Comp1IntroState extends State<Comp1Intro> {
@override
Widget build(BuildContext context) {
void nextPage(String route) {
Navigator.pushNamedAndRemoveUntil(context, route,(r) => false, arguments: {});
}
return Column(
children: [
SizedBox(height: 20,),
Header(title: 'කැමති ක්‍රියාකාරකම තෝරන්න'),
SizedBox(height: 30,),
Button(route: '/Comp1Step1First', title: 'පින්තුරයක් බලා කතන්දර කියවීම', bg: MyStyles.cbtnPrimary),
SizedBox(height: 30,),
Button(route: '/Comp1Step2', title: 'කැමති කතාවක් කීම', bg: MyStyles.cbtnPrimary),
SizedBox(width: 180,child:
Image.asset('assets/images/Component 1 - img 02.png')
),
],
);
}
}
import 'package:Autism/widgets/ButtonXl.dart';
import 'package:flutter/material.dart';
import 'package:Autism/MyStyles.dart' as MyStyles;
class Comp1Welcome extends StatefulWidget {
const Comp1Welcome({super.key});
@override
State<Comp1Welcome> createState() => _Comp1WelcomeState();
}
class _Comp1WelcomeState extends State<Comp1Welcome> {
@override
Widget build(BuildContext context) {
void nextPage(String route) {
Navigator.pushNamedAndRemoveUntil(context, route,(r) => false, arguments: {});
}
return Column(
children: [
SizedBox(width: 180,child:
Image.asset('assets/images/Component 1 - img 01.png')
),
SizedBox(height: 30,),
ButtonXL(route: '/Comp1Intro', title: 'ආරම්භ කරන්න', bg: MyStyles.cbtnPrimary),
],
);
}
}
import 'package:Autism/widgets/Header.dart';
import 'package:Autism/widgets/ImageCard.dart';
import 'package:flutter/material.dart';
class Comp1Step1First extends StatefulWidget {
const Comp1Step1First({super.key});
@override
State<Comp1Step1First> createState() => _Comp1Step1FirstState();
}
class _Comp1Step1FirstState extends State<Comp1Step1First> {
void nextPage(String route,String image) {
Navigator.pushNamed(context, route, arguments: {
'image':image
});
}
@override
Widget build(BuildContext context) {
return Column(
children: [
SizedBox(height: 20,),
Header(title: 'කැමති ක්‍රියාකාරකම තෝරන්න'),
SizedBox(height: 30,),
InkWell(
onTap: ()=>nextPage('/Comp1Step1Second','assets/images/Component 1 - img 03.png'),
child: ImageCard(image: 'assets/images/Component 1 - img 03.png')
),
SizedBox(height: 30,),
InkWell(
onTap: ()=>nextPage('/Comp1Step1Second','assets/images/Component 1 - img 04.png'),
child: ImageCard(image: 'assets/images/Component 1 - img 04.png')
),
],
);
}
}
import 'package:Autism/widgets/ButtonXl.dart';
import 'package:Autism/widgets/Instructions.dart';
import 'package:flutter/material.dart';
import 'package:Autism/MyStyles.dart' as MyStyles;
class Comp1Step1Second extends StatefulWidget {
const Comp1Step1Second({super.key});
@override
State<Comp1Step1Second> createState() => _Comp1Step1SecondState();
}
class _Comp1Step1SecondState extends State<Comp1Step1Second> {
String image = '';
void nextPage(String route) {
Navigator.pushNamed(context, route, arguments: {
'image':image
});
}
@override
Widget build(BuildContext context) {
final arg = ModalRoute.of(context)!.settings.arguments as Map;
image = arg['image'];
return Column(
children: [
SizedBox(height: 20,),
Instructions(title: 'උපදෙස්',body: 'මීළඟ පියවරෙන් පසු, දරුවාට විනාඩි දෙකක් කතා කිරීමට සලස්වන්න',),
SizedBox(height: 50,),
ButtonXL(route: '/Comp1Step1Third',arguments:{'image':image}, title: 'ඊළඟ පියවර', bg: MyStyles.cbtnPrimary),
],
);
}
}
import 'dart:io';
import 'package:Autism/widgets/AudioInput.dart';
import 'package:Autism/widgets/ButtonIcon.dart';
import 'package:Autism/widgets/ImageCard.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 Comp1Step1Third extends StatefulWidget {
const Comp1Step1Third({super.key});
@override
State<Comp1Step1Third> createState() => _Comp1Step1ThirdState();
}
class _Comp1Step1ThirdState extends State<Comp1Step1Third> {
String image = '';
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) {
final arg = ModalRoute.of(context)!.settings.arguments as Map;
image = arg['image'];
return Column(
children: [
ImageCard(image: image),
SizedBox(
height: 10,
),
Instructions(
title: 'උපදෙස්',
body: 'පින්තූරය විස්තර කිරීමට දරුවාට කියන්න',
),
SizedBox(
height: 10,
),
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(),
],
)
],
);
}
}
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(),
],
)
],
);
}
}
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