Skip to content

Commit

Permalink
Merge pull request #20 from ieeeuoft/reorganize-structure
Browse files Browse the repository at this point in the history
Reorganize structure
  • Loading branch information
thomaslin2020 authored Nov 17, 2023
2 parents 575316b + 4b51dc2 commit 30f13d2
Show file tree
Hide file tree
Showing 7 changed files with 289 additions and 108 deletions.
4 changes: 2 additions & 2 deletions app/lib/account/widgets/get_started_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class _GetStartedButtonState extends State<GetStartedButton> {
borderRadius: BorderRadius.circular(10),
color: const Color.fromARGB(255, 224, 227, 231),
),
child: const Row(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
children: const [
Text(
"Get Started",
style: TextStyle(
Expand Down
2 changes: 1 addition & 1 deletion app/lib/features/authentication/sign_in_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SignInPageState extends State<SignInPage> {
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
const Row(),
Row(),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
Expand Down
77 changes: 13 additions & 64 deletions app/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import 'package:app/page_viewer.dart';
import 'package:app/app/app_routes.dart';
import 'package:app/features/home/home_page.dart';
import 'package:app/features/profile/profile_page.dart';
import 'package:app/features/blog/blog_page_test.dart';
import 'package:app/features/team/team_page.dart';
import 'package:flutter/material.dart';
import 'package:firebase_core/firebase_core.dart';
import 'firebase_options.dart';
Expand All @@ -22,73 +19,25 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: const MainScaffold(),
home: const PageViewer(),
routes: AppRoutes.routes,
);
}
}
enum AppTab { Home, Blog, Team, Profile }

class MainScaffold extends StatefulWidget {
const MainScaffold({super.key});

@override
_MainScaffoldState createState() => _MainScaffoldState();
}

class _MainScaffoldState extends State<MainScaffold> {
AppTab _selectedTab = AppTab.Home;
// class MainScaffold extends StatefulWidget {
// @override
// _MainScaffoldState createState() => _MainScaffoldState();
// }

void _onTabTapped(int index) {
setState(() {
_selectedTab = AppTab.values[index];
});
}
// class _MainScaffoldState extends State<MainScaffold> {
// AppTab _selectedTab = AppTab.Home;

@override
Widget build(BuildContext context) {
return Scaffold(
bottomNavigationBar: BottomNavigationBar(
items: const <BottomNavigationBarItem>[
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(Icons.notifications),
label: 'Blog',
),
BottomNavigationBarItem(
icon: Icon(Icons.group),
label: 'Team',
),
BottomNavigationBarItem(
icon: Icon(Icons.person),
label: 'Profile',
),
],
currentIndex: _selectedTab.index,
onTap: _onTabTapped,
),
body: _buildBody(),
);
}

Widget _buildBody() {
switch (_selectedTab) {
case AppTab.Home:
return const HomePage();
case AppTab.Blog:
return const BlogPage();
case AppTab.Team:
return const TeamPage();
case AppTab.Profile:
return const ProfilePage();
default:
return Container();
}
}
}
// void _onTabTapped(int index) {
// setState(() {
// _selectedTab = AppTab.values[index];
// });
// }

// class AuthService {
// final FirebaseAuth _auth = FirebaseAuth.instance;
Expand Down
46 changes: 46 additions & 0 deletions app/lib/page_viewer.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import 'package:app/features/blog/blog_page.dart';
import 'package:app/features/home/home_page.dart';
import 'package:app/features/profile/profile_page.dart';
import 'package:app/features/team/team_page.dart';
import 'package:flutter/material.dart';

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

@override
Widget build(BuildContext context) {
return const DefaultTabController(
length: 4, // make sure that this matches the amount of pages
child: Scaffold(
body: TabBarView(
children:[
HomePage(),
BlogPage(),
TeamPage(),
ProfilePage(),
]
),
bottomNavigationBar: TabBar(
tabs: [
Tab(
icon: Icon(Icons.home)
),
Tab(
icon: Icon(Icons.book)
),
Tab(
icon: Icon(Icons.group)
),
Tab(
icon: Icon(Icons.person)
),
],
labelColor: Color(0xff2B7BBC),
unselectedLabelColor: Color(0xff141D1D),
indicatorColor: Color(0xff2B7BBC),
),
backgroundColor: Color(0xffEFEFEF),
),
);
}
}
2 changes: 2 additions & 0 deletions app/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ import Foundation
import cloud_firestore
import firebase_auth
import firebase_core
import wakelock_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
WakelockMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockMacosPlugin"))
}
Loading

0 comments on commit 30f13d2

Please sign in to comment.