Skip to content

Commit

Permalink
Right Drawer added (#264)
Browse files Browse the repository at this point in the history
* Right Drawer added

* Delete pubspec.lock

---------

Co-authored-by: Rijuth Menon <[email protected]>
  • Loading branch information
SATVIKSH and MarkisDev authored Dec 26, 2023
1 parent be80d16 commit f52383c
Show file tree
Hide file tree
Showing 2 changed files with 178 additions and 10 deletions.
182 changes: 178 additions & 4 deletions lib/app/modules/home/views/home_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import 'package:flutter_expandable_fab/flutter_expandable_fab.dart';
import 'package:ultimate_alarm_clock/app/data/models/alarm_model.dart';
import 'package:ultimate_alarm_clock/app/data/providers/firestore_provider.dart';
import 'package:ultimate_alarm_clock/app/data/providers/isar_provider.dart';
import 'package:ultimate_alarm_clock/app/modules/about/controller/about_controller.dart';
import 'package:ultimate_alarm_clock/app/modules/home/views/toggle_button.dart';
import 'package:ultimate_alarm_clock/app/modules/settings/controllers/settings_controller.dart';
import 'package:ultimate_alarm_clock/app/modules/settings/controllers/theme_controller.dart';
Expand All @@ -18,11 +19,12 @@ import '../controllers/home_controller.dart';

class HomeView extends GetView<HomeController> {
HomeView({Key? key}) : super(key: key);

ThemeController themeController = Get.find<ThemeController>();
SettingsController settingsController = Get.find<SettingsController>();
@override
Widget build(BuildContext context) {
AboutController aboutController = Get.put(AboutController());
final GlobalKey<ScaffoldState> scaffoldKey = GlobalKey<ScaffoldState>();
var width = Get.width;
var height = Get.height;
return Scaffold(
Expand Down Expand Up @@ -293,6 +295,118 @@ class HomeView extends GetView<HomeController> {
),
),
),
endDrawer: Obx(
() => Drawer(
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10), bottomLeft: Radius.circular(10)),
),
backgroundColor: themeController.isLightMode.value
? kLightSecondaryBackgroundColor
: ksecondaryBackgroundColor,
child: Column(
children: [
DrawerHeader(
decoration: const BoxDecoration(color: kLightSecondaryColor),
child: Center(
child: Row(
children: [
const CircleAvatar(
radius: 30,
backgroundImage: AssetImage(
'assets/images/ic_launcher-playstore.png',
)),
const SizedBox(
width: 10,
),
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: width * 0.5,
child: Text(
'Ultimate Alarm Clock',
softWrap: true,
style: Theme.of(context)
.textTheme
.displayMedium!
.copyWith(
color: themeController.isLightMode.value
? kprimaryTextColor
: ksecondaryTextColor,
fontWeight: FontWeight.bold),
),
),
SizedBox(
width: width * 0.5,
child: Text(
'v0.5.0',
softWrap: true,
style: Theme.of(context)
.textTheme
.titleLarge!
.copyWith(
color: themeController.isLightMode.value
? kprimaryTextColor
: ksecondaryTextColor,
fontWeight: FontWeight.bold),
),
),
],
),
],
),
)),
ListTile(
onTap: () {
Utils.hapticFeedback();
Get.back();
Get.toNamed('/settings');
},
contentPadding: const EdgeInsets.only(left: 20, right: 44),
title: Text(
'Settings',
style: Theme.of(context).textTheme.titleLarge!.copyWith(
color: themeController.isLightMode.value
? kLightPrimaryTextColor.withOpacity(0.8)
: kprimaryTextColor.withOpacity(0.8),
),
),
leading: Icon(
Icons.settings,
size: 26,
color: themeController.isLightMode.value
? kLightPrimaryTextColor.withOpacity(0.8)
: kprimaryTextColor.withOpacity(0.8),
),
),
ListTile(
onTap: () {
Utils.hapticFeedback();
Get.back();
aboutController.navigateToAboutView();
},
contentPadding: const EdgeInsets.only(left: 20, right: 44),
title: Text(
'About',
style: Theme.of(context).textTheme.titleLarge!.copyWith(
color: themeController.isLightMode.value
? kLightPrimaryTextColor.withOpacity(0.8)
: kprimaryTextColor.withOpacity(0.8)),
),
leading: Icon(
Icons.info_outline,
size: 26,
color: themeController.isLightMode.value
? kLightPrimaryTextColor.withOpacity(0.8)
: kprimaryTextColor.withOpacity(0.8),
),
),
],
),
),
),
appBar: null,
body: SafeArea(
child: Obx(
() => NestedScrollView(
Expand All @@ -302,6 +416,8 @@ class HomeView extends GetView<HomeController> {
? (context, innerBoxIsScrolled) => [
// Show the normal app bar
SliverAppBar(
actions: [Container()],
automaticallyImplyLeading: false,
expandedHeight: height / 7.9,
floating: true,
pinned: true,
Expand Down Expand Up @@ -372,15 +488,18 @@ class HomeView extends GetView<HomeController> {
Obx(
() => Visibility(
visible:
controller.scalingFactor < 0.95
controller.scalingFactor < 0.9
? false
: true,
child: IconButton(
onPressed: () {
Utils.hapticFeedback();
Get.toNamed('/settings');
Scaffold.of(context)
.openEndDrawer();
},
icon: const Icon(Icons.settings),
icon: const Icon(
Icons.menu,
),
color: themeController
.isLightMode.value
? kLightPrimaryTextColor
Expand All @@ -390,6 +509,58 @@ class HomeView extends GetView<HomeController> {
iconSize: 27 *
controller.scalingFactor.value,
),

// PopupMenuButton(
// // onPressed: () {
// // Utils.hapticFeedback();
// // Get.toNamed('/settings');
// // },

// icon: const Icon(Icons.more_vert),
// color: themeController
// .isLightMode.value
// ? kLightSecondaryBackgroundColor
// : ksecondaryBackgroundColor,
// iconSize: 27 *
// controller.scalingFactor.value,
// itemBuilder: (context) {
// return [
// PopupMenuItem<String>(
// onTap: () {
// Utils.hapticFeedback();
// Get.toNamed('/settings');
// },
// child: Text(
// 'Settings',
// style: Theme.of(context)
// .textTheme
// .bodyMedium!
// .copyWith(
// color: themeController
// .isLightMode
// .value
// ? kLightPrimaryTextColor
// : kprimaryTextColor),
// ),
// ),
// PopupMenuItem<String>(
// value: 'option1',
// child: Text(
// 'About',
// style: Theme.of(context)
// .textTheme
// .bodyMedium!
// .copyWith(
// color: themeController
// .isLightMode
// .value
// ? kLightPrimaryTextColor
// : kprimaryTextColor),
// ),
// ),
// ];
// },
// ),
),
),
],
Expand All @@ -404,6 +575,8 @@ class HomeView extends GetView<HomeController> {
: (context, innerBoxIsScrolled) => [
// Else show the multiple select mode app bar
SliverAppBar(
automaticallyImplyLeading: false,
actions: [Container()],
expandedHeight: height / 7.9,
floating: true,
pinned: true,
Expand Down Expand Up @@ -576,6 +749,7 @@ class HomeView extends GetView<HomeController> {
),
),
],

body: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.end,
Expand Down
6 changes: 0 additions & 6 deletions lib/app/modules/settings/views/settings_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,6 @@ class SettingsView extends GetView<SettingsController> {
const SizedBox(
height: 20,
),
AboutSection(
aboutController: aboutController,
height: height,
width: width,
themeController: themeController,
),
],
),
),
Expand Down

0 comments on commit f52383c

Please sign in to comment.