Skip to content

Commit

Permalink
Merge pull request #351 from jaivsh/master
Browse files Browse the repository at this point in the history
Added share app functionality(issue #336) and created settings section(issue #340)
  • Loading branch information
avinashkranjan authored Jul 21, 2023
2 parents e0444a4 + 1d08b32 commit 4ad7e93
Show file tree
Hide file tree
Showing 10 changed files with 352 additions and 123 deletions.
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.example.friday">
<!-- io.flutter.app.FlutterApplication is an android.app.Application that
calls FlutterMain.startInitialization(this); in its onCreate method.
Expand Down
55 changes: 55 additions & 0 deletions assets/icons/settings.svg
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/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'package:friday/screens/faqs_screen.dart';
import 'package:flutter/material.dart';
import 'package:friday/feedback.dart';
import 'package:friday/screens/theme_screen.dart';
import 'package:friday/services/phone_number_verification_db.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:friday/screens/phone_verification_screen.dart';
import 'package:friday/screens/verify_code_screen.dart';
Expand Down Expand Up @@ -150,7 +151,7 @@ class _MyAppState extends State<MyApp> {
'/theme':(context) => ThemeScreen(),
'/faqs':(context) => FAQScreen(),
'/phoneVerification': (context) => PhoneVerificationScreen(),
'/verifyCode': (context) => VerifyCodeScreen(),
'/verifyCode': (context) => VerifyCodeScreen(phoneNumber: '7267097531', phoneNumberVerificationDb: PhoneNumberVerificationDb(verificationCallback: null),),
},
),
),
Expand Down
2 changes: 1 addition & 1 deletion lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ class DataSearch extends SearchDelegate<String> {
ThemeData appBarTheme(BuildContext context) {
return Theme.of(context).copyWith(
appBarTheme: AppBarTheme(
backgroundColor: Theme.of(context).primaryColor,
backgroundColor: Colors.black,
titleTextStyle: TextStyle(color: kTextColor),
),
);
Expand Down
44 changes: 43 additions & 1 deletion lib/screens/profile_screen.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import 'dart:io';

import 'package:flutter_share/flutter_share.dart';
import 'package:friday/constants.dart';
import 'package:friday/models/users.dart';
import 'package:friday/screens/onboarding_page.dart';
import 'package:friday/screens/settings_screen.dart';
import 'package:friday/services/authentication.dart';
import 'package:friday/services/facebookAuthentication.dart';
import 'package:friday/services/googleAuthentication.dart';
Expand All @@ -12,6 +14,7 @@ import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:provider/provider.dart';
import 'package:share_plus/share_plus.dart';
import 'package:path/path.dart' as Path;
import 'package:friday/services/user_db_services.dart';

Expand Down Expand Up @@ -82,9 +85,41 @@ class _ProfileScreenState extends State<ProfileScreen> {
});
}

void shareapp() async {
await FlutterShare.share(
title: 'Friday: Your personal class assistant!',
text: 'Check out Friday: Your Personal Class Manager Assistant, It\'ll never let you miss another assignment deadline or upcoming test. Download from play store : https://play.google.com/store/apps/details?id=com.avinashkranjan.friday',
linkUrl: 'https://play.google.com/store/apps/details?id=com.avinashkranjan.friday',
chooserTitle: 'Friday!');
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(elevation: 0,backgroundColor: Theme.of(context).colorScheme.background.withOpacity(0.8),actions: [
PopupMenuButton<String>(
onSelected: (s) async {
},
itemBuilder: (BuildContext context) {
return {'Share App','Settings'}.map((String choice) {
return PopupMenuItem<String>(
value: choice,
child: Text(choice),
onTap: () {
if(choice == 'Share App') {
shareapp();
}
else {
print('pencho');
Navigator.of(this.context).push(MaterialPageRoute(builder: (context) => SettingsScreen()));
}
},
);
}).toList();
},
),
],

centerTitle: true,),
backgroundColor: Theme.of(context).colorScheme.background.withOpacity(0.8),
body: SingleChildScrollView(
physics: AlwaysScrollableScrollPhysics(parent: BouncingScrollPhysics()),
Expand All @@ -97,7 +132,14 @@ class _ProfileScreenState extends State<ProfileScreen> {
children: [
Column(
children: [
SizedBox(height: 0.15 * MediaQuery.of(context).size.height),
Text(
"Your Profile",
style: TextStyle(
color: Colors.white,
fontSize: 30.0,
fontWeight: FontWeight.bold,
),),
SizedBox(height: 0.12 * MediaQuery.of(context).size.height),
Container(
margin: EdgeInsets.fromLTRB(15, 15, 15, 60),
padding: EdgeInsets.all(30),
Expand Down
189 changes: 125 additions & 64 deletions lib/screens/settings_screen.dart
Original file line number Diff line number Diff line change
@@ -1,74 +1,135 @@
import 'package:flutter/material.dart';
import 'package:friday/screens/theme_screen.dart';
import 'package:friday/screens/faqs_screen.dart';
import 'help_screen.dart';
import 'package:friday/screens/help_screen.dart';
import 'package:open_url/open_url.dart';
import 'package:provider/provider.dart';
import 'package:external_app_launcher/external_app_launcher.dart';
import '../models/users.dart';
import '../services/user_info_services.dart';
import 'package:settings_ui/settings_ui.dart';




class SettingsScreen extends StatefulWidget {
@override
State<SettingsScreen> createState() => _SettingsScreenState();
}

class _SettingsScreenState extends State<SettingsScreen> {
get visibilityName => null;

class SettingsScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Settings'),
),
body: ListView(
children: [
ListTile(
leading: Icon(Icons.person),
title: Text('User'),
onTap: () {
// Navigate to user settings screen
},
),
ListTile(
leading: Icon(Icons.notifications),
title: Text('Notifications'),
onTap: () {
// Navigate to notification settings screen
},
),
ListTile(
leading: Icon(Icons.settings_display_sharp),
title: Text('Theme'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ThemeScreen(),
),
);
},
),
ListTile(
leading: Icon(Icons.language),
title: Text('Language'),
onTap: () {
// Navigate to language settings screen
},
),
ListTile(
leading: Icon(Icons.question_answer),
title: Text('FAQs'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => FAQScreen(),
),
);
},
),
ListTile(
leading: Icon(Icons.help),
title: Text('Help'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => HelpScreen(),
appBar: AppBar(elevation: 0,backgroundColor: Theme.of(context).colorScheme.background.withOpacity(0.8),

centerTitle: true,),
backgroundColor: Theme.of(context).colorScheme.background.withOpacity(0.8),
body: SingleChildScrollView(
physics: AlwaysScrollableScrollPhysics(parent: BouncingScrollPhysics()),
child: Consumer<UserInfoServices>(
builder: (context, userInfo, _) {
Users _user;
if (userInfo.hasData) _user = userInfo.user!;
return Stack(
alignment: Alignment.center,
children: [
Column(
children: [
Text(
"Settings",
style: TextStyle(
color: Colors.white,
fontSize: 30.0,
fontWeight: FontWeight.bold,
),),
SizedBox(height: 0.12 * MediaQuery.of(context).size.height),
Container(
margin: EdgeInsets.fromLTRB(15, 15, 15, 60),
padding: EdgeInsets.all(30),
decoration: BoxDecoration(
color: Theme.of(context).primaryColor,
borderRadius: BorderRadius.only(
topLeft: Radius.circular(40),
topRight: Radius.circular(40),
),
),
width: double.infinity,
child:

SizedBox(height: MediaQuery.of(context).size.height ,width: MediaQuery.of(context).size.width,child:SettingsList(
lightTheme: SettingsThemeData(settingsListBackground: Theme.of(context).primaryColor, titleTextColor: Theme.of(context).secondaryHeaderColor,
settingsTileTextColor: Colors.white, leadingIconsColor: Colors.white, dividerColor: Colors.white70, tileDescriptionTextColor: Theme.of(context).primaryColorDark)

,sections: [
SettingsSection(

title: Text('Common'),
tiles: <SettingsTile>[
SettingsTile.navigation(
leading: Icon(Icons.language),
onPressed: (c) {
ScaffoldMessenger.of(context).showSnackBar(SnackBar(
content: Text("Currently support is for Single language only. Stay tuned!"),
));
},
title: Text('Language'),
value: Text('English'),
),
SettingsTile.navigation(
leading: Icon(Icons.help_outline),
title: Text('Help'),
onPressed: (s) {
Navigator.of(context).push(MaterialPageRoute(builder: (context) => HelpScreen()));
},
value: Text('See our help modules for queries'),
),

SettingsTile.navigation(
leading: Icon(Icons.info_outlined),
title: Text('FAQs'),
value: Text('Basic usage guidelines!'),
onPressed: (s) {
Navigator.of(context).push(MaterialPageRoute(builder: (context) => FAQScreen()));
},
),
SettingsTile.navigation(
leading: Icon(Icons.support),
title: Text('Support Development'),
onPressed: (s) async {
//js.context.callMethod('open', ['https://github.com/avinashkranjan/Friday']);
final result = await openUrl('https://github.com/avinashkranjan/Friday');
if (result.exitCode == 0) {
print('URL opened!');
} else {
print('Something went wrong (exit code = ${result.exitCode}): '
'${result.stderr}');
}

},
value: Text('Resolve issues, report bugs, write documentations, and much more!'),
),

],
),
],
),)



),

],
),
);
},
),
],




],
);
},
),
),
);
}
Expand Down
4 changes: 4 additions & 0 deletions lib/utils/bottom_navbar_tabs.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
import 'package:flutter/foundation.dart';

List<Map<String, String>> bottomNavBarData = const [

{'svg': "assets/icons/house.svg", 'title': "Home"},
{'svg': "assets/icons/read_book.svg", 'title': "Classes"},
{'svg': "assets/icons/homework.svg", 'title': "Homework"},
{'svg': "assets/icons/test.svg", 'title': "Alerts"},
{'svg': "assets/icons/user.svg", 'title': "Profile"},
{'svg': "assets/icons/settings.svg", 'title': "Settings"},


];

class BottomNavigationBarProvider extends ChangeNotifier {
Expand Down
Loading

0 comments on commit 4ad7e93

Please sign in to comment.