From 46e9814686e46b3701e29a9e31b5a020ac754486 Mon Sep 17 00:00:00 2001 From: yashovardhan99 Date: Fri, 7 Jun 2019 18:41:59 +0530 Subject: [PATCH 1/3] Fixed some import issue with intro scene --- lib/pages/intro_screen.dart | 19 ++++++++++--------- pubspec.lock | 2 +- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/pages/intro_screen.dart b/lib/pages/intro_screen.dart index 94926ff..bee4e86 100644 --- a/lib/pages/intro_screen.dart +++ b/lib/pages/intro_screen.dart @@ -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); @@ -25,7 +26,7 @@ class IntroScreenState extends State { 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, @@ -43,7 +44,7 @@ class IntroScreenState extends State { 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, @@ -61,7 +62,7 @@ class IntroScreenState extends State { 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, @@ -122,11 +123,11 @@ class IntroScreenState extends State { children: [ 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, diff --git a/pubspec.lock b/pubspec.lock index 41de0c2..44d69fa 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -150,7 +150,7 @@ packages: name: intro_slider url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.2.0" matcher: dependency: transitive description: From b76680e484c962db50dadf07bc8a09195ba55cd0 Mon Sep 17 00:00:00 2001 From: yashovardhan99 Date: Fri, 7 Jun 2019 18:42:25 +0530 Subject: [PATCH 2/3] Added mic button functionality back --- lib/pages/home_page.dart | 70 +++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index c3e5185..bf92f0a 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -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 @@ -77,7 +78,7 @@ class _HomePageState extends State icons[index], ), backgroundColor: Colors.deepPurpleAccent, - onPressed: () { + onPressed: () async { if(index==0) { // Redirect to Gihub Repo/Organization } else if(index == 1) { @@ -85,9 +86,30 @@ class _HomePageState extends State 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"); + } + } } }, ), @@ -103,10 +125,12 @@ class _HomePageState extends State 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,), ); }, ), @@ -122,34 +146,6 @@ class _HomePageState extends State ), ), ), -// 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( From 1a7ed18998d75a96e6d78ce6b4ed337e97680718 Mon Sep 17 00:00:00 2001 From: yashovardhan99 Date: Fri, 7 Jun 2019 19:10:17 +0530 Subject: [PATCH 3/3] Temp fix for corner icon buttons - moved out of bottomAppBar --- lib/pages/home_page.dart | 79 +++++++++++++++++++++------------------- 1 file changed, 41 insertions(+), 38 deletions(-) diff --git a/lib/pages/home_page.dart b/lib/pages/home_page.dart index bf92f0a..358f709 100644 --- a/lib/pages/home_page.dart +++ b/lib/pages/home_page.dart @@ -51,7 +51,39 @@ class _HomePageState extends State ), ), ), - ) + ), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + 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", + ), + ) + ],), ], ), ), @@ -146,43 +178,14 @@ class _HomePageState extends State ), ), ), - bottomNavigationBar: BottomAppBar( - shape: CircularNotchedRectangle(), - child: Row( - mainAxisSize: MainAxisSize.max, - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - 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", - ), - ) - ], - ), - ), +// bottomNavigationBar: BottomAppBar( +// shape: CircularNotchedRectangle(), +// child: Row( +// mainAxisSize: MainAxisSize.max, +// mainAxisAlignment: MainAxisAlignment.spaceBetween, +// +// ), +// ), ); } }