Google sign in and hourglass improved
This commit is contained in:
67
lib/Settings/AccountSettings.dart
Normal file
67
lib/Settings/AccountSettings.dart
Normal file
@@ -0,0 +1,67 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:tasktracker/Data.dart';
|
||||
import 'package:tasktracker/googleSignIn.dart';
|
||||
import 'package:restart_app/restart_app.dart';
|
||||
|
||||
class AccountSettings extends StatefulWidget {
|
||||
const AccountSettings({Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
_AccountSettingsState createState() => _AccountSettingsState();
|
||||
}
|
||||
|
||||
class _AccountSettingsState extends State<AccountSettings> {
|
||||
|
||||
@override void initState() {
|
||||
// TODO: implement initState
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return ChangeNotifierProvider(
|
||||
create: (context)=>GoogleSignInProvider(),
|
||||
builder: (context, snapshot) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Row(
|
||||
children: [
|
||||
FaIcon(FontAwesomeIcons.user),
|
||||
SizedBox(width: 15,),
|
||||
Text("Account Settings"),
|
||||
],
|
||||
)),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
ListTile(
|
||||
leading: FaIcon(FontAwesomeIcons.signOut),
|
||||
title: Text("Log out",style:TextStyle(color: Colors.red)),
|
||||
subtitle: Row(
|
||||
children: [
|
||||
Text("Good-bye"),
|
||||
],
|
||||
),
|
||||
onTap: () async{
|
||||
final provider = Provider.of<GoogleSignInProvider>(context, listen:false);
|
||||
provider.logout();
|
||||
final prefs = await SharedPreferences.getInstance();
|
||||
await prefs.clear();
|
||||
Restart.restartApp(webOrigin: '/splash');
|
||||
},
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,11 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tasktracker/Settings/AccountSettings.dart';
|
||||
import 'package:tasktracker/Settings/AppearanceSettings.dart';
|
||||
import 'package:tasktracker/Settings/NotificationSettings.dart';
|
||||
import 'package:tasktracker/Settings/BehaviourSettings.dart';
|
||||
import 'package:tasktracker/main.dart';
|
||||
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
|
||||
|
||||
|
||||
class SettingsPage extends StatefulWidget {
|
||||
const SettingsPage({Key? key}) : super(key: key);
|
||||
@@ -15,33 +18,51 @@ class _SettingsPageState extends State<SettingsPage> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text('Settings')),
|
||||
appBar: AppBar(title: Row(
|
||||
children: [
|
||||
FaIcon(FontAwesomeIcons.cog),
|
||||
SizedBox(width: 15,),
|
||||
Text('Settings'),
|
||||
],
|
||||
)),
|
||||
body: Column(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
ListTile(
|
||||
leading: FaIcon(FontAwesomeIcons.paintbrush),
|
||||
title: Text('Appearance'),
|
||||
subtitle: Text('Just the looks and feels'),
|
||||
trailing: Icon(Icons.arrow_forward_ios),
|
||||
// trailing: Icon(Icons.arrow_forward_ios),
|
||||
onTap: (){
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context)=> const AppearanceSettings()));
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: FaIcon(FontAwesomeIcons.bell),
|
||||
title: Text('Notifications'),
|
||||
subtitle: Text("Don't worry, We won't let you forget"),
|
||||
trailing: Icon(Icons.arrow_forward_ios),
|
||||
// trailing: Icon(Icons.arrow_forward_ios),
|
||||
onTap: (){
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context)=> const NotificationSettings()));
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: FaIcon(FontAwesomeIcons.cogs),
|
||||
title:Text("General Behaviour"),
|
||||
subtitle: Text("Wanna change how the app works? Go ahead!"),
|
||||
trailing: Icon(Icons.arrow_forward_ios),
|
||||
// trailing: Icon(Icons.arrow_forward_ios),
|
||||
onTap: (){
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context)=> const BehaviourSettings()));
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: FaIcon(FontAwesomeIcons.user),
|
||||
title:Text("Account Settings"),
|
||||
subtitle: Text("Login preferences"),
|
||||
// trailing: Icon(Icons.arrow_forward_ios),
|
||||
onTap: (){
|
||||
Navigator.of(context).push(MaterialPageRoute(builder: (context)=> const AccountSettings()));
|
||||
},
|
||||
)
|
||||
// SettingItem('Appearance', ()=>Navigator.of(context).push(MaterialPageRoute(builder: (context)=> const AppearanceSettings()))),
|
||||
// Divider(),
|
||||
|
||||
Reference in New Issue
Block a user