Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions team_b/yappy/lib/audiowave_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'dart:math';
import 'services/speech_state.dart';


class AudiowaveWidget extends StatelessWidget {
final SpeechState speechState;

Expand Down
43 changes: 30 additions & 13 deletions team_b/yappy/lib/contact_page.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:yappy/tool_bar.dart';
import 'package:yappy/theme_provider.dart';

//**************************************************************** */
//**************************************************************** */
Expand All @@ -10,6 +12,7 @@ import 'package:yappy/tool_bar.dart';
//**************************************************************** */
//**************************************************************** */
//**************************************************************** */

class ContactApp extends StatelessWidget {
const ContactApp({super.key});

Expand All @@ -25,13 +28,14 @@ class ContactPage extends StatelessWidget {
final TextEditingController nameController = TextEditingController();
final TextEditingController emailController = TextEditingController();
final TextEditingController messageController = TextEditingController();
//Creates a page for the Contact Us page
//The page will contain a form for the user to input their name, email, and message

ContactPage({super.key});

@override
Widget build(BuildContext context) {
final themeProvider = Provider.of<ThemeProvider>(context);

return Scaffold(
backgroundColor: const Color.fromARGB(255, 0, 0, 0),
appBar: PreferredSize(
preferredSize: Size.fromHeight(140),
child: ToolBar(),
Expand All @@ -47,52 +51,65 @@ class ContactPage extends StatelessWidget {
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
color: Colors.white,
color: themeProvider.isDarkMode ? Colors.white : Colors.black,
),
),
SizedBox(height: 16),
TextField(
controller: nameController,
decoration: InputDecoration(
labelText: 'Name',
labelStyle: TextStyle(color: Colors.white),
labelStyle: TextStyle(
color: themeProvider.isDarkMode ? Colors.white : Colors.black,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
borderSide: BorderSide(
color: themeProvider.isDarkMode ? Colors.white : Colors.black,
),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blue),
),
),
style: TextStyle(color: Colors.white),
style: TextStyle(color: themeProvider.isDarkMode ? Colors.white : Colors.black),
),
SizedBox(height: 16),
TextField(
controller: emailController,
decoration: InputDecoration(
labelText: 'Email',
labelStyle: TextStyle(color: Colors.white),
labelStyle: TextStyle(
color: themeProvider.isDarkMode ? Colors.white : Colors.black,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
borderSide: BorderSide(
color: themeProvider.isDarkMode ? Colors.white : Colors.black,
),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blue),
),
),
style: TextStyle(color: Colors.white),
style: TextStyle(color: themeProvider.isDarkMode ? Colors.white : Colors.black),
),
SizedBox(height: 16),
TextField(
controller: messageController,
decoration: InputDecoration(
labelText: 'Message',
labelStyle: TextStyle(color: Colors.white),
labelStyle: TextStyle(
color: themeProvider.isDarkMode ? Colors.white : Colors.black,
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.white),
borderSide: BorderSide(
color: themeProvider.isDarkMode ? Colors.white : Colors.black,
),
),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.blue),
),
),
style: TextStyle(color: Colors.white),
style: TextStyle(color: themeProvider.isDarkMode ? Colors.white : Colors.black),
maxLines: 5,
),
SizedBox(height: 20),
Expand Down
24 changes: 15 additions & 9 deletions team_b/yappy/lib/help.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import 'package:flutter/material.dart';
import 'package:yappy/tool_bar.dart';
import 'package:yappy/tutorial_page.dart';

import 'package:yappy/theme_provider.dart';
import 'package:provider/provider.dart';

class HelpApp extends StatelessWidget {
const HelpApp({super.key});
Expand All @@ -20,8 +21,9 @@ class HelpPage extends StatelessWidget {

@override
Widget build(BuildContext context) {
final themeProvider = Provider.of<ThemeProvider>(context);

return Scaffold(
backgroundColor: const Color.fromARGB(255, 0, 0, 0),
appBar: PreferredSize(
preferredSize: Size.fromHeight(MediaQuery.of(context).size.height * 0.2),
child: ToolBar()
Expand All @@ -37,8 +39,9 @@ class HelpPage extends StatelessWidget {
child: Text(
'Lets Yap about Yappy',
style: TextStyle(
color: Colors.white,
color: themeProvider.isDarkMode ? Colors.white: Colors.black,
fontSize: 24,
fontWeight: FontWeight.bold,
),
),
),
Expand All @@ -52,8 +55,9 @@ class HelpPage extends StatelessWidget {
Text(
'Welcome to Yappy! If this is your first time and need help with using Yappy, please select the button below.',
style: TextStyle(
color: const Color.fromRGBO(255, 255, 255, 1),
fontSize: 12,
color: themeProvider.isDarkMode ? Colors.white: Colors.black,
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 20),
Expand All @@ -72,8 +76,9 @@ class HelpPage extends StatelessWidget {
'Reporting a Problem with Yappy\n'
'If something is not working on Yappy, please follow the instructions below to let us know.\n\n',
style: TextStyle(
color: Colors.white,
fontSize: 12,
color: themeProvider.isDarkMode ? Colors.white: Colors.black,
fontSize: 14,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 5),
Expand Down Expand Up @@ -103,8 +108,9 @@ class HelpPage extends StatelessWidget {
Text(
'\n\nFeedback from the people who use Yappy has helped us redesign our products, improve our policies and fix technical problems. We really appreciate you taking the time to share your thoughts and suggestions with us.\n',
style: TextStyle(
color: Colors.white,
fontSize: 12,
color: themeProvider.isDarkMode ? Colors.white: Colors.black,
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 5),
Expand Down
2 changes: 0 additions & 2 deletions team_b/yappy/lib/home_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color.fromARGB(255, 0, 0, 0),
appBar: PreferredSize(
preferredSize: Size.fromHeight(MediaQuery.of(context).size.height * 0.2),
child: ToolBar(showHamburger: false), // Using the ToolBar widget
Expand Down Expand Up @@ -125,7 +124,6 @@ class _HomePageState extends State<HomePage> {
);
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.grey[900],
padding: const EdgeInsets.symmetric(vertical: 15),
),
child: Text(
Expand Down
27 changes: 16 additions & 11 deletions team_b/yappy/lib/industry_menu.dart
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ class _IndustryMenuState extends State<IndustryMenu> {
// Gets the width and height of the current screen
double screenWidth = MediaQuery.of(context).size.width;
double screenHeight = MediaQuery.of(context).size.height;
final isDarkMode = Theme.of(context).brightness == Brightness.dark;


return Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0, horizontal: 16.0),
Expand All @@ -203,12 +205,12 @@ class _IndustryMenuState extends State<IndustryMenu> {
child: Column(
children: [
Center(
// Creates the text box above the icons
child: Container(
// Creates the text box above the icons
child: Container(
width: screenWidth * .75,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color.fromARGB(255, 67, 67, 67),
color: isDarkMode ? Color.fromARGB(255, 79, 79, 83): Colors.green,
),
padding: EdgeInsets.all(12),
child: Center(
Expand All @@ -232,7 +234,7 @@ class _IndustryMenuState extends State<IndustryMenu> {
color: !modelsExist
? Color.fromRGBO(128, 128, 128, 0.5)
: (widget.speechState.recordState == RecordState.stop
? Colors.grey
? isDarkMode ? Colors.grey : Colors.green
: Colors.red)),
padding: EdgeInsets.all(5),
child: Tooltip(
Expand All @@ -247,7 +249,7 @@ class _IndustryMenuState extends State<IndustryMenu> {
? Icons.mic
: Icons.stop,
color: !modelsExist
? Color.fromRGBO(255, 255, 255, 0.5)
? isDarkMode ? Colors.grey : Colors.green
: Colors.white,
size: screenHeight * .05,
),
Expand Down Expand Up @@ -343,7 +345,7 @@ class _IndustryMenuState extends State<IndustryMenu> {
// Creates a industry specific icon based on user input
Container(
decoration:
BoxDecoration(shape: BoxShape.circle, color: Colors.grey),
BoxDecoration(shape: BoxShape.circle, color: isDarkMode ? Colors.grey : Colors.green),
padding: EdgeInsets.all(5),
child: IconButton(
icon: Icon(
Expand All @@ -361,7 +363,7 @@ class _IndustryMenuState extends State<IndustryMenu> {
// Creates a transcript history button
Container(
decoration:
BoxDecoration(shape: BoxShape.circle, color: Colors.grey),
BoxDecoration(shape: BoxShape.circle, color: isDarkMode ? Colors.grey : Colors.green),
padding: EdgeInsets.all(5),
child: IconButton(
icon: Icon(
Expand All @@ -379,7 +381,7 @@ class _IndustryMenuState extends State<IndustryMenu> {

// Creates a chatbot button
Container(
decoration: BoxDecoration(shape: BoxShape.circle, color: Colors.grey),
decoration: BoxDecoration(shape: BoxShape.circle, color: isDarkMode ? Colors.grey : Colors.green),
padding: EdgeInsets.all(5),
child: IconButton(
icon: Icon(
Expand Down Expand Up @@ -483,7 +485,8 @@ class _IndustryMenuState extends State<IndustryMenu> {
void _showTranscriptsBottomSheet(BuildContext context) async {
// Fetch transcripts first
List<Map<String, dynamic>> transcripts = await _fetchTranscripts();

if (!context.mounted) return;
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
// Check if the context is still valid
if (!context.mounted) return;

Expand All @@ -494,7 +497,7 @@ class _IndustryMenuState extends State<IndustryMenu> {
padding: EdgeInsets.all(16.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color.fromARGB(255, 67, 67, 67),
color: isDarkMode ? const Color.fromARGB(255, 67, 67, 67) : Colors.green,
),
child: Center(
child: Column(
Expand Down Expand Up @@ -595,6 +598,8 @@ class _IndustryMenuState extends State<IndustryMenu> {
void _showTranscriptsHistoryBottomSheet(BuildContext context) async {
// Fetch transcripts first
List<Map<String, dynamic>> transcripts = await _fetchTranscripts();
if (!context.mounted) return;
final isDarkMode = Theme.of(context).brightness == Brightness.dark;

// Check if the context is still valid
if (!context.mounted) return;
Expand All @@ -606,7 +611,7 @@ class _IndustryMenuState extends State<IndustryMenu> {
padding: EdgeInsets.all(16.0),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
color: const Color.fromARGB(255, 67, 67, 67),
color: isDarkMode ? const Color.fromARGB(255, 67, 67, 67) : Colors.green,
),
child: Center(
child: Column(
Expand Down
26 changes: 19 additions & 7 deletions team_b/yappy/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@ import 'package:yappy/services/database_helper.dart';
import 'package:dart_openai/dart_openai.dart';
import 'package:yappy/env.dart';
import './toast_widget.dart';
import 'package:provider/provider.dart';
import 'theme_provider.dart';

// Create a global instance of DatabaseHelper
final DatabaseHelper dbHelper = DatabaseHelper();
final GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
late SharedPreferences preferences;

void main() async{
void main() async {
WidgetsFlutterBinding.ensureInitialized();
preferences = await SharedPreferences.getInstance();

// Load the theme preference from SharedPreferences
final isDarkMode = preferences.getBool('toggle_setting') ?? false;

// Env file setup for local development
String apiKey = Env.apiKey;
if (apiKey.isNotEmpty) {
Expand Down Expand Up @@ -47,27 +52,34 @@ void main() async{
}
});

runApp(const MyApp());
// Run the app and initialize ThemeProvider
runApp(
ChangeNotifierProvider(
create: (_) => ThemeProvider()..toggleTheme(isDarkMode), // Initialize with saved theme
child: const MyApp(),
),
);
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
final themeProvider = Provider.of<ThemeProvider>(context);

return MaterialApp(
navigatorKey: navigatorKey,
debugShowCheckedModeBanner: false,
title: 'Yappy',
theme: ThemeData(
primarySwatch: Colors.lightGreen,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
theme: themeProvider.themeData, // Apply theme based on provider
darkTheme: ThemeProvider.darkTheme, // Provide dark theme separately
themeMode: themeProvider.isDarkMode ? ThemeMode.dark : ThemeMode.light, // Set theme mode based on isDarkMode
home: HomePage(),
builder: (context, child) {
// Wrap every screen with ToastWidget
return ToastWidget(child: child ?? Container());
},
);
}
}
}
1 change: 0 additions & 1 deletion team_b/yappy/lib/mechanic.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class MechanicalAidPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color.fromARGB(255, 0, 0, 0),
appBar: PreferredSize(
preferredSize: Size.fromHeight(100),
child: ToolBar(),
Expand Down
1 change: 0 additions & 1 deletion team_b/yappy/lib/medical_doctor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class MedicalDoctorPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color.fromARGB(255, 0, 0, 0),
appBar: PreferredSize(
preferredSize: Size.fromHeight(100),
child: ToolBar()
Expand Down
1 change: 0 additions & 1 deletion team_b/yappy/lib/medical_patient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class MedicalPatientPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color.fromARGB(255, 0, 0, 0),
appBar: PreferredSize(
preferredSize: Size.fromHeight(100),
child: ToolBar()
Expand Down
Loading
Loading