Skip to content

Commit

Permalink
Merge pull request #20 from allisto/fix-buttons
Browse files Browse the repository at this point in the history
Fix buttons - I don't know why it wasn't merged for so long
  • Loading branch information
yashovardhan99 authored Jun 17, 2019
2 parents 9542fc4 + 1a7ed18 commit 921b38e
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 84 deletions.
147 changes: 73 additions & 74 deletions lib/pages/home_page.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import 'dart:math' as math;

import 'package:audio_recorder2/audio_recorder2.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart';
import 'package:simple_permissions/simple_permissions.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'dart:math' as math;
import 'package:simple_permissions/simple_permissions.dart';

class HomePage extends StatefulWidget {
@override
Expand Down Expand Up @@ -50,7 +51,39 @@ class _HomePageState extends State<HomePage>
),
),
),
)
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: IconButton(
icon: Icon(
FontAwesomeIcons.podcast,
color: Colors.deepPurpleAccent,
),
onPressed: () {
print("News List");
Navigator.of(context).pushNamed("/news_list");
},
tooltip: "Medical News",
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: IconButton(
icon: Icon(
EvaIcons.messageCircleOutline,
color: Colors.deepPurpleAccent,
),
onPressed: () {
print("Assistant");
Navigator.of(context).pushNamed("/assistant");
},
tooltip: "AI Assistant",
),
)
],),
],
),
),
Expand All @@ -77,17 +110,38 @@ class _HomePageState extends State<HomePage>
icons[index],
),
backgroundColor: Colors.deepPurpleAccent,
onPressed: () {
onPressed: () async {
if(index==0) {
// Redirect to Gihub Repo/Organization
} else if(index == 1) {
// Redirect to Team Page
Navigator.of(context).pushNamed('/team_page');
} else {
// Recording through mic
setState(() {

});
bool hasPermissions = await AudioRecorder2.hasPermissions;
if (hasPermissions) {
Navigator.of(context).pushNamed("/mic");
}
else {
bool audioPermission = await SimplePermissions
.checkPermission(
Permission.RecordAudio);
bool storagePermission = await SimplePermissions
.checkPermission(
Permission.WriteExternalStorage);
if (!audioPermission) {
await SimplePermissions.requestPermission(
Permission.RecordAudio);
}
if (!storagePermission) {
await SimplePermissions.requestPermission(
Permission.WriteExternalStorage);
}
hasPermissions = await AudioRecorder2.hasPermissions;
if (hasPermissions) {
Navigator.of(context).pushNamed("/mic");
}
}
}
},
),
Expand All @@ -103,10 +157,12 @@ class _HomePageState extends State<HomePage>
builder: (BuildContext context, Widget child) {
return Transform(
transform:
Matrix4.rotationZ(_controller.value * 0.5 * math.pi),
Matrix4.rotationZ(_controller.value * 0.5 * math.pi),
alignment: FractionalOffset.center,
child: Icon(
_controller.isDismissed ? EvaIcons.activityOutline : EvaIcons.closeCircleOutline,),
_controller.isDismissed
? EvaIcons.activityOutline
: EvaIcons.closeCircleOutline,),
);
},
),
Expand All @@ -122,71 +178,14 @@ class _HomePageState extends State<HomePage>
),
),
),
// FloatingActionButton(
// heroTag: "mic",
// onPressed: () async {
// bool hasPermissions = await AudioRecorder2.hasPermissions;
// if(hasPermissions) {
// Navigator.of(context).pushNamed("/mic");
// }
// else {
// bool audioPermission = await SimplePermissions.checkPermission(
// Permission.RecordAudio);
// bool storagePermission = await SimplePermissions.checkPermission(
// Permission.WriteExternalStorage);
// if (!audioPermission) {
// await SimplePermissions.requestPermission(Permission.RecordAudio);
// }
// if (!storagePermission) {
// await SimplePermissions.requestPermission(
// Permission.WriteExternalStorage);
// }
// hasPermissions = await AudioRecorder2.hasPermissions;
// if (hasPermissions) {
// Navigator.of(context).pushNamed("/mic");
// }
// }
// },
// backgroundColor: Colors.deepPurpleAccent,
// child: Icon(Icons.mic_none,color: Colors.white,),
// bottomNavigationBar: BottomAppBar(
// shape: CircularNotchedRectangle(),
// child: Row(
// mainAxisSize: MainAxisSize.max,
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
//
// ),
// ),
bottomNavigationBar: BottomAppBar(
shape: CircularNotchedRectangle(),
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(8.0),
child: IconButton(
icon: Icon(
FontAwesomeIcons.podcast,
color: Colors.deepPurpleAccent,
),
onPressed: () {
print("News List");
Navigator.of(context).pushNamed("/news_list");
},
tooltip: "Medical News",
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: IconButton(
icon: Icon(
EvaIcons.messageCircleOutline,
color: Colors.deepPurpleAccent,
),
onPressed: () {
print("Assistant");
Navigator.of(context).pushNamed("/assistant");
},
tooltip: "AI Assistant",
),
)
],
),
),
);
}
}
19 changes: 10 additions & 9 deletions lib/pages/intro_screen.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:flutter/material.dart';
import 'package:intro_slider/intro_slider.dart';
import 'package:eva_icons_flutter/eva_icons_flutter.dart';
import 'package:intro_slider/slide_object.dart';

class IntroScreen extends StatefulWidget {
IntroScreen({Key key}) : super(key: key);
Expand All @@ -25,7 +26,7 @@ class IntroScreenState extends State<IntroScreen> {
fontWeight: FontWeight.bold,
fontFamily: 'RobotoMono'),
description:
"Treat your infant's autism at with Allisto :)",
"Treat your infant's autism at with Allisto :)",
styleDescription: TextStyle(
color: Colors.pink,
fontSize: 20.0,
Expand All @@ -43,7 +44,7 @@ class IntroScreenState extends State<IntroScreen> {
fontWeight: FontWeight.bold,
fontFamily: 'RobotoMono'),
description:
"Early and easy diagnosis right at your home.",
"Early and easy diagnosis right at your home.",
styleDescription: TextStyle(
color: Colors.pink,
fontSize: 20.0,
Expand All @@ -61,7 +62,7 @@ class IntroScreenState extends State<IntroScreen> {
fontWeight: FontWeight.bold,
fontFamily: 'RobotoMono'),
description:
"Powered and accompnaied by a smart AI",
"Powered and accompnaied by a smart AI",
styleDescription: TextStyle(
color: Colors.pink,
fontSize: 20.0,
Expand Down Expand Up @@ -122,11 +123,11 @@ class IntroScreenState extends State<IntroScreen> {
children: <Widget>[
GestureDetector(
child: Image.asset(
currentSlide.pathImage,
width: 200.0,
height: 200.0,
fit: BoxFit.contain,
)),
currentSlide.pathImage,
width: 200.0,
height: 200.0,
fit: BoxFit.contain,
)),
Container(
child: Text(
currentSlide.title,
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ packages:
name: intro_slider
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.1"
version: "2.2.0"
matcher:
dependency: transitive
description:
Expand Down

0 comments on commit 921b38e

Please sign in to comment.