Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature:added a drawer #32

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.0'
classpath 'com.android.tools.build:gradle:7.0.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
3 changes: 3 additions & 0 deletions lib/config/theme_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ class MyThemes {
color: kRoyalBlueDark,
),
),
// drawerTheme: DrawerThemeData(
// backgroundColor: darkThemeNavBarColor,
// ),
inputDecorationTheme: const InputDecorationTheme(
labelStyle: TextStyle(
fontSize: 14,
Expand Down
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class MyApp extends StatelessWidget {
routes: {
AddTask.routeName: (ctx) => AddTask(),
SettingsScreen.routeName: (ctx) => SettingsScreen(),
HomeScreen.routeName: (ctx)=>HomeScreen(),
},
);
}),
Expand Down
10 changes: 8 additions & 2 deletions lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ import 'package:flutter/material.dart';

// Third Party Packages
import 'package:card_swiper/card_swiper.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:routinger/widgets/app_drawer/app_drawer.dart';
import 'package:url_launcher/url_launcher_string.dart';

// Screen Imports
import '../screens/add_task.dart';
import '../screens/settings_screen.dart';

// Widgets Imports
import '../widgets/home/stats/stats_chart.dart';
Expand All @@ -18,9 +17,12 @@ import '../widgets/home/taskslist/taskslist.dart';
import '../widgets/home/sleep_cycle_column.dart';
import '../widgets/home/initialiser.dart';

import '.././constants/palette.dart';

class HomeScreen extends StatefulWidget {
@override
State<HomeScreen> createState() => _HomeScreenState();
static final routeName = '/homeScreen';
}

class _HomeScreenState extends State<HomeScreen> {
Expand All @@ -31,6 +33,7 @@ class _HomeScreenState extends State<HomeScreen> {
"Tie your Habit to a sweet reward and make your habit more attractive",
"Don't spend time in an environment where you have to practice self restraint.",
];


// Handling the bottom navigation bar
int _selectedIndexOfBottomNavBar = 0;
Expand Down Expand Up @@ -79,6 +82,7 @@ class _HomeScreenState extends State<HomeScreen> {
Navigator.of(context).pushNamed(AddTask.routeName);
},
child: Icon(Icons.add),
backgroundColor: kBlueGreen,
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
bottomNavigationBar: BottomNavigationBar(
Expand All @@ -94,6 +98,7 @@ class _HomeScreenState extends State<HomeScreen> {
],
currentIndex: _selectedIndexOfBottomNavBar,
onTap: _navigatingBottomNavBar,
selectedItemColor: kBlueGreen,
),
appBar: AppBar(
title: Text(
Expand Down Expand Up @@ -127,6 +132,7 @@ class _HomeScreenState extends State<HomeScreen> {
// ),
],
),
drawer: AppDrawer(),
body: SingleChildScrollView(
child: Column(
children: [
Expand Down
2 changes: 2 additions & 0 deletions lib/screens/settings_screen.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
//Flutter Packages
import 'package:flutter/material.dart';
import 'package:routinger/widgets/app_drawer/app_drawer.dart';

//Widget Imports
import '../widgets/settings/settings_screen_body.dart';
Expand All @@ -18,6 +19,7 @@ class SettingsScreen extends StatelessWidget {
),
),
),
drawer: AppDrawer(),
body: SettingsScreenBody(),
);
}
Expand Down
43 changes: 43 additions & 0 deletions lib/widgets/app_drawer/app_drawer.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//Flutter Packages
import 'package:flutter/material.dart';
import 'package:routinger/constants/palette.dart';
//Screen Imports
import 'package:routinger/screens/home_screen.dart';
import 'package:routinger/screens/settings_screen.dart';

class AppDrawer extends StatelessWidget {
const AppDrawer({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Drawer(
child: Column(
children: [
AppBar(
title: Text('Hello User!'),
automaticallyImplyLeading: false,
),
//const Divider(),
ListTile(
leading: const Icon(Icons.home),
title: Text('Home',style: TextStyle(color: kRoyalBlueDark),),
onTap: () {
Navigator.of(context)
.pushReplacementNamed(HomeScreen.routeName);
},
),
const Divider(),
ListTile(
leading: const Icon(Icons.settings),
title: Text('Settings',style: TextStyle(color: kRoyalBlueDark),),
onTap: () {
Navigator.of(context)
.pushReplacementNamed(SettingsScreen.routeName);
},
),
const Divider(),
],
),
);
}
}