Skip to content

Commit

Permalink
Merge pull request #41 from MahmoudJLB/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
mahmoud-joumaa authored May 19, 2024
2 parents 8c4e946 + 9ecf594 commit 2ade4cd
Show file tree
Hide file tree
Showing 59 changed files with 653 additions and 244 deletions.
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<application
android:label="franz"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
android:icon="@mipmap/launcher_icon">
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Illustrations/florid-window-with-graph.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Illustrations/jaconda-music-book.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/Illustrations/jaconda-music-flow-1.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion lib/components/audio_player.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:audioplayers/audioplayers.dart';
import 'package:flutter/material.dart';
import 'package:franz/global.dart';
import 'package:franz/services/api_service.dart';

class AudioPlayerButton extends StatefulWidget {
Expand Down Expand Up @@ -146,7 +147,7 @@ class _NewAudioPlayerButtonState extends State<NewAudioPlayerButton>
}
widget.changePlayerState(_key, path);
},
child: _fetchingFile ? const CircularProgressIndicator():
child: _fetchingFile ? const Loading(size: 25,) :
AnimatedIcon(
icon: AnimatedIcons.play_pause,
progress: _animationController,
Expand Down
3 changes: 1 addition & 2 deletions lib/components/audio_recorder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import 'package:record/record.dart';
import 'dart:io';
import 'package:path/path.dart' as p;
import 'package:path_provider/path_provider.dart';
import 'package:record/record.dart';


mixin AudioRecorderMixin {
Expand Down Expand Up @@ -101,7 +100,7 @@ class _RecorderState extends State<Recorder> with AudioRecorderMixin {
final devs = await _audioRecorder.listInputDevices();
debugPrint(devs.toString());

const config = RecordConfig(encoder: encoder, numChannels: 1);
const config = RecordConfig(encoder: encoder, numChannels: 1, bitRate: 256000);
// Record to file
// await recordFile(_audioRecorder, config);

Expand Down
126 changes: 119 additions & 7 deletions lib/global.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_spinkit/flutter_spinkit.dart';

import 'package:franz/services/authn_service.dart';

/* ================================================================================================
User Theme
================================================================================================ */
Expand Down Expand Up @@ -31,22 +33,23 @@ class Palette {
}

/* ================================================================================================
Dialog Pop Up
Dialog Pop Ups
================================================================================================ */

class Alert {
static show(context, String title, content, Color backgroundColor, String type) {

static show(context, String title, content, Color backgroundColor, String type, [User? user]) {
type = type.toLowerCase(); // For comparison checks
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) => AlertDialog(
title: Text(title),
content: Text(content),
title: Text(title, style: TextStyle(color: UserTheme.isDark ? Colors.white : Colors.black)),
content: Text(content, style: TextStyle(color: UserTheme.isDark ? Colors.white : Colors.black)),
backgroundColor: backgroundColor,
actions: [
TextButton(
child: Text(type.toUpperCase()),
child: Text(type.toUpperCase(), style: TextStyle(color: UserTheme.isDark ? Colors.white : Colors.black)),
onPressed: () async {
switch (type) {
case "exit":
Expand All @@ -59,6 +62,9 @@ class Alert {
case "logout":
Navigator.pushReplacementNamed(context, "WelcomeScreen");
break;
case "verify":
Navigator.of(context).pop();
Alert.confirmCode(context, title, backgroundColor, user!);
default:
Navigator.of(context).pop();
}
Expand All @@ -68,6 +74,112 @@ class Alert {
),
);
}

static confirmCode(context, String title, Color backgroundColor, User user) {
TextEditingController codeController = TextEditingController();
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) => AlertDialog(
title: Text(title, style: TextStyle(color: UserTheme.isDark ? Colors.white : Colors.black)),
backgroundColor: backgroundColor,
content: TextField(
controller: codeController,
autocorrect: false,
enableSuggestions: false,
obscureText: false,
),
actions: [
Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Row(
children: [
TextButton(
child: Text("Resend Code", style: TextStyle(color: UserTheme.isDark ? Colors.white : Colors.black)),
onPressed: () async {
Alert.load(context);
final result = await resendConfirmationCode(user);
Navigator.of(context).pop();
if (result["success"]) {
Alert.show(
context,
"Confirmation code successfully resent.",
result["message"],
UserTheme.isDark ? Colors.green[700]! : Colors.green[300]!,
"dismiss"
);
}
else {
Alert.show(
context,
"An error has occurred while resending the confirmation code.\nPlease try again later.",
result["message"],
UserTheme.isDark ? Colors.red[700]! : Colors.red[300]!,
"ok"
);
}
}
),
TextButton(
child: Text("Confirm Code", style: TextStyle(color: UserTheme.isDark ? Colors.white : Colors.black)),
onPressed: () async {
Alert.load(context);
final result = await confirmUser(user, codeController.text);
if (result["success"]) {
await signInUser(user);
Navigator.of(context).pop();
Alert.show(
context,
"Successfully verified ${user.authDetails.username}",
result["message"],
UserTheme.isDark ? Colors.green[700]! : Colors.green[300]!,
"login"
);
}
else {
Navigator.of(context).pop();
Alert.show(
context,
"An error has occurred while verifying ${user.authDetails.username}",
result["message"],
UserTheme.isDark ? Colors.red[700]! : Colors.red[300]!,
result["message"].contains("An account with the email already exists.") ? "try with a different email" : "dismiss"
);
}
}
),
],
),
TextButton(
child: Text("Dismiss", style: TextStyle(color: UserTheme.isDark ? Colors.white : Colors.black)),
onPressed: () {
Navigator.of(context).pop();
}
),
],
),
]
)
);
}

static load(context) {
showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) => const AlertDialog(
backgroundColor: Colors.transparent,
content: SizedBox(
height: 50.0,
width: 50.0,
child: Loading(backgroundColor: Colors.white, color: Colors.deepPurple)
),
)
);
}

}

/* ================================================================================================
Expand All @@ -87,11 +199,11 @@ class Loading extends StatelessWidget {
return Center(
child: Container(
decoration: BoxDecoration(
color: backgroundColor ?? (UserTheme.isDark ? Colors.black : const Color(Palette.orange)),
color: backgroundColor ?? Colors.transparent,
borderRadius: const BorderRadius.all(Radius.circular(5.0)),
),
child: SpinKitFadingCircle(
color: color ?? (UserTheme.isDark ? const Color(Palette.orange) : Colors.black),
color: color ?? (UserTheme.isDark ? Colors.deepPurple[200] : Colors.deepPurple[800]),
size: size ?? 50.0,
),
),
Expand Down
8 changes: 7 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:franz/global.dart';
import 'package:franz/pages/home/home.dart';
import 'package:franz/pages/welcome.dart';

void main() async {
void main() {

WidgetsFlutterBinding.ensureInitialized();

Expand All @@ -30,9 +30,15 @@ class Root extends StatelessWidget {
return MaterialApp(
title: "Franz",
theme: ThemeData(
useMaterial3: true,
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
brightness: Brightness.light,
),
darkTheme: ThemeData(
useMaterial3: true,
brightness: Brightness.dark,
),
themeMode: Provider.of<UserTheme>(context).isDarkNotify ? ThemeMode.dark : ThemeMode.light,
debugShowCheckedModeBanner: false,
initialRoute: "WelcomeScreen",
routes: {
Expand Down
47 changes: 17 additions & 30 deletions lib/pages/home/about.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,16 @@ class _AboutScreenState extends State<AboutScreen> {
final PageController _controller = PageController(); // keep track of what page the user is on
int i = 0; // current page

// FIXME: Change text and illustration images of each child
final intros = [
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text("Text", style: TextStyle(fontSize: 40.0), textAlign: TextAlign.center,),
Image.asset("../../../assets/Franz.jpg", width: 400.0, fit: BoxFit.contain,),
const Text("Text", textAlign: TextAlign.center,),
const Text("Text", textAlign: TextAlign.center,),
const Text("What is AMT?", style: TextStyle(fontSize: 40.0), textAlign: TextAlign.center,),
Image.asset("assets/Illustrations/florid-window-with-graph.gif", width: 400.0, fit: BoxFit.contain,),
const Text("AMT is short for Automatic Music Transcription", textAlign: TextAlign.center,),
const Text("It is the process of transcribing audio into sheet music", textAlign: TextAlign.center,),
]
),
),
Expand All @@ -35,10 +34,10 @@ class _AboutScreenState extends State<AboutScreen> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text("Text", style: TextStyle(fontSize: 40.0), textAlign: TextAlign.center,),
Image.asset("../../../assets/Franz.jpg", width: 400.0, fit: BoxFit.contain,),
const Text("Text", textAlign: TextAlign.center,),
const Text("Text", textAlign: TextAlign.center,),
const Text("What is Franz?", style: TextStyle(fontSize: 40.0), textAlign: TextAlign.center,),
Image.asset("assets/Illustrations/isometric-machine-learning-for-artificial-intelligence-1.gif", width: 400.0, fit: BoxFit.contain,),
const Text("Franz is your very own Automatic Music Transcriber!", textAlign: TextAlign.center,),
const Text("It uses machine learning and a cloud backend to transcribe your favorite songs and tunes", textAlign: TextAlign.center,),
]
),
),
Expand All @@ -47,10 +46,10 @@ class _AboutScreenState extends State<AboutScreen> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text("Balance your Craves", style: TextStyle(fontSize: 40.0), textAlign: TextAlign.center,),
Image.asset("../../../assets/Franz.jpg", width: 400.0, fit: BoxFit.contain,),
const Text("Balanced Craves helps you track your diet by standards YOU set!", textAlign: TextAlign.center,),
const Text("Your progress is private to you and you alone", textAlign: TextAlign.center,),
const Text("Who is Franz?", style: TextStyle(fontSize: 40.0), textAlign: TextAlign.center,),
Image.asset("assets/Illustrations/martina-man-playing-guitar-music-for-woman.gif", width: 400.0, fit: BoxFit.contain,),
const Text("\"Franz\" is inspired by Franz Liszt", textAlign: TextAlign.center,),
const Text("He was a Hungarian composer, vituoso pianist, conductor, and teacher of the Romantic period (19\u0054\u0048 century)", textAlign: TextAlign.center,),
]
),
),
Expand All @@ -59,22 +58,10 @@ class _AboutScreenState extends State<AboutScreen> {
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text("Text", style: TextStyle(fontSize: 40.0), textAlign: TextAlign.center,),
Image.asset("../../../assets/Franz.jpg", width: 400.0, fit: BoxFit.contain,),
const Text("Text", textAlign: TextAlign.center,),
const Text("Text", textAlign: TextAlign.center,),
]
),
),
Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const Text("Text", style: TextStyle(fontSize: 40.0), textAlign: TextAlign.center,),
Image.asset("../../../assets/Franz.jpg", width: 400.0, fit: BoxFit.contain,),
const Text("Text", textAlign: TextAlign.center,),
const Text("Text", textAlign: TextAlign.center,),
const Text("Who are the developers?", style: TextStyle(fontSize: 40.0), textAlign: TextAlign.center,),
Image.asset("assets/Illustrations/clip-applying-to-university-online.gif", width: 400.0, fit: BoxFit.contain,),
const Text("That's us! We are a group of 3 undergraduate students with a dream. We decided to code that dream into a reality", textAlign: TextAlign.center,),
const Text("P.S. We should be graduating soon... Wish us luck!", textAlign: TextAlign.center,),
]
),
),
Expand Down Expand Up @@ -164,7 +151,7 @@ class _AboutScreenState extends State<AboutScreen> {
const Text("Check ", style: TextStyle(color: Color(Palette.grey))),
InkWell(
child: const Text("Readme.md", style: TextStyle(color: Color(Palette.grey), decoration: TextDecoration.underline,)),
onTap: () => launchUrl(Uri.parse("https://icons8.com/")),
onTap: () => launchUrl(Uri.parse("https://github.com/MahmoudJLB/Franz/blob/main/README.md")),
),
const Text(" for detailed references", style: TextStyle(color: Color(Palette.grey))),
],
Expand Down
37 changes: 33 additions & 4 deletions lib/pages/home/contact.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// ignore_for_file: use_build_context_synchronously

import 'package:flutter/material.dart';
import 'package:franz/global.dart';
import 'package:open_mail_app/open_mail_app.dart';

class ContactScreen extends StatefulWidget {
const ContactScreen({super.key});
Expand Down Expand Up @@ -78,7 +82,7 @@ class _ContactScreenState extends State<ContactScreen> {
),
const Spacer(),
TextButton(
onPressed: submit,
onPressed: () async { await submit(context); },
child: const Text("Submit")
),
],
Expand All @@ -88,14 +92,39 @@ class _ContactScreenState extends State<ContactScreen> {
);
}

void submit() {

submit(context) async {
// Get number of stars based of rating
String ratingStars = "";
for (int i = 0; i < rating; i++) { ratingStars += '⭐'; }
// Generate email
EmailContent email = EmailContent(to: ['franz.transcriber@gmail.com'], subject: 'Franz $category', body: 'Rating: $ratingStars\n\n${messageController.text}');
// Choose email client
OpenMailAppResult result = await OpenMailApp.composeNewEmailInMailApp(nativePickerTitle: 'Select email app to compose', emailContent: email);
if (!result.didOpen && !result.canOpen) {
Alert.show(
context,
"Failed to Open Mail App",
"No installed mail apps were found",
UserTheme.isDark ? Colors.red[700]! : Colors.red[300]!,
"dismiss",
);
}
else if (!result.didOpen && result.canOpen) {
showDialog(
context: context,
builder: (_) => MailAppPickerDialog(
mailApps: result.options,
emailContent: email,
),
);
}
}

void reset() {
setState(() {
messageController.text = '';
rating = 0;
});
}
}

}
Loading

0 comments on commit 2ade4cd

Please sign in to comment.