From ab97568d6a8d367f0e855041bd3c129ef293028f Mon Sep 17 00:00:00 2001 From: Erik Burgess Date: Mon, 7 Apr 2025 15:23:12 -0700 Subject: [PATCH 1/2] added settings page with logout button --- lib/api.dart | 2 -- lib/main.dart | 3 ++- lib/settings.dart | 23 +++++++++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 lib/settings.dart diff --git a/lib/api.dart b/lib/api.dart index 200c0a9..24693c2 100644 --- a/lib/api.dart +++ b/lib/api.dart @@ -19,6 +19,4 @@ Future init() async { log.i("User signed in"); } }); - - await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform); } diff --git a/lib/main.dart b/lib/main.dart index 31e5ce8..780dd8e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -5,6 +5,7 @@ import 'profile.dart'; import 'matches.dart'; import 'login.dart'; import 'api.dart'; +import 'settings.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); @@ -36,7 +37,7 @@ class App extends StatefulWidget { class AppState extends State { int pageIdx = 2; List pageBuilders = [ - () => Center(child: Text("Settings Placeholder")), + () => SettingsScreen(), () => MyProfileView( Profile("My Profile", DateTime.now(), "My Bio", ["My1", "My2", "My3"])), //() => ProfileView(Profile("Example Profile", DateTime.now(), "Example Bio", ["Ex1", "Ex2", "Ex3", "Ex4"])), diff --git a/lib/settings.dart b/lib/settings.dart new file mode 100644 index 0000000..cfc969d --- /dev/null +++ b/lib/settings.dart @@ -0,0 +1,23 @@ +import 'package:flutter/material.dart'; +import 'auth_service.dart'; +import 'login.dart'; + +class SettingsScreen extends StatelessWidget { + final AuthService authService = AuthService(); + + @override + Widget build(BuildContext context) { + return Center( + child: ElevatedButton.icon( + icon: Icon(Icons.logout), + label: Text("Logout"), + onPressed: () async { + await authService.signOut(); + Navigator.of(context).pushReplacement( + MaterialPageRoute(builder: (_) => LoginPage()), + ); + }, + ), + ); + } +} From 52f4e98cbf55dfa5e4ed32d8d334ed260f8ce8c2 Mon Sep 17 00:00:00 2001 From: Erik Burgess Date: Wed, 16 Apr 2025 13:00:04 -0700 Subject: [PATCH 2/2] fixed more conflicts --- lib/pages/settings.dart | 22 ++++++++++++++-------- lib/settings.dart | 23 ----------------------- 2 files changed, 14 insertions(+), 31 deletions(-) delete mode 100644 lib/settings.dart diff --git a/lib/pages/settings.dart b/lib/pages/settings.dart index fa1abcb..3b9248e 100644 --- a/lib/pages/settings.dart +++ b/lib/pages/settings.dart @@ -1,12 +1,18 @@ - import 'package:flutter/material.dart'; - +import '../auth.dart'; +import 'login.dart'; class SettingsPage extends StatelessWidget { - SettingsPage({ super.key }); - @override Widget build(BuildContext context) { - return Center(child: Text("Settings Placeholder")); - } + @override + Widget build(BuildContext context) { + return Center( + child: ElevatedButton.icon( + icon: Icon(Icons.logout), + label: Text("Logout"), + onPressed: () async { + await signOut(); + }, + ), + ); + } } - - diff --git a/lib/settings.dart b/lib/settings.dart deleted file mode 100644 index cfc969d..0000000 --- a/lib/settings.dart +++ /dev/null @@ -1,23 +0,0 @@ -import 'package:flutter/material.dart'; -import 'auth_service.dart'; -import 'login.dart'; - -class SettingsScreen extends StatelessWidget { - final AuthService authService = AuthService(); - - @override - Widget build(BuildContext context) { - return Center( - child: ElevatedButton.icon( - icon: Icon(Icons.logout), - label: Text("Logout"), - onPressed: () async { - await authService.signOut(); - Navigator.of(context).pushReplacement( - MaterialPageRoute(builder: (_) => LoginPage()), - ); - }, - ), - ); - } -}