From 4f3f440ef46483396850a85c18422e24df3ff273 Mon Sep 17 00:00:00 2001 From: Aryan Date: Thu, 13 Jun 2024 15:22:24 +0530 Subject: [PATCH 1/2] Redesigned the drawer. --- .../screens/main_screen/main_screen.dart | 458 +++++++++++------- 1 file changed, 275 insertions(+), 183 deletions(-) diff --git a/lib/new_ui/screens/main_screen/main_screen.dart b/lib/new_ui/screens/main_screen/main_screen.dart index edba6b55..56b851ba 100644 --- a/lib/new_ui/screens/main_screen/main_screen.dart +++ b/lib/new_ui/screens/main_screen/main_screen.dart @@ -1,5 +1,7 @@ import 'dart:typed_data'; +import 'dart:ui'; +import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:go_router/go_router.dart'; @@ -248,217 +250,307 @@ class _MainScreenState extends ConsumerState { ) : null, drawer: !concessionOpen - ? Drawer( - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.only( - topRight: Radius.circular(20), - bottomRight: Radius.circular(20)), - ), - backgroundColor: Colors.black, - child: Padding( - padding: const EdgeInsets.all(18.0), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - profilePic != null - ? CircleAvatar( + ? BackdropFilter( + filter: ImageFilter.blur(sigmaX: 10, sigmaY: 10), + child: Drawer( + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.only( + topRight: Radius.circular(20), + bottomRight: Radius.circular(20)), + ), + backgroundColor: Colors.black, + child: Padding( + padding: const EdgeInsets.all(18.0), + child: Column( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + SizedBox(height: 20,), + Row( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + profilePic != null + ? CircleAvatar( radius: 35, backgroundImage: MemoryImage(profilePic), // backgroundImage: MemoryImage(_image!), ) - : const CircleAvatar( + : const CircleAvatar( radius: 35, backgroundImage: - AssetImage("assets/images/pfpholder.jpg"), + AssetImage("assets/images/pfpholder.jpg"), ), - const SizedBox( - height: 15, - ), - Text( - userDetails != null - ? (userDetails.isStudent - ? userDetails.studentModel!.name - : userDetails.facultyModel!.name) - : "Tsecite", - style: Theme.of(context) - .textTheme - .headlineLarge! - .copyWith(fontSize: 30), - ), - const SizedBox( - height: 30, - ), - ListTile( - contentPadding: EdgeInsets.zero, - title: Text( - 'Home', - style: Theme.of(context) - .textTheme - .headlineMedium! - .copyWith( - fontSize: 22, - color: currentPage == 0 - ? Theme.of(context).colorScheme.onBackground - : Colors.white, - ), + SizedBox(width: 10,), + Expanded(child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + userDetails != null + ? (userDetails.isStudent + ? userDetails.studentModel!.name + : userDetails.facultyModel!.name) + : "Tsecite", + style: Theme.of(context) + .textTheme + .headlineLarge! + .copyWith(fontSize: 20), + ), + SizedBox(height: 5,), + Text( + userDetails != null ? (userDetails.isStudent ? '${userDetails.studentModel!.branch} ${userDetails.studentModel!.gradyear}' : '') : '', + style: Theme.of(context).textTheme.headlineLarge!.copyWith(fontSize: 12), + ) + ], + )) + ], ), - onTap: () { - setState(() { - currentPage = 0; - }); - Navigator.pop(context); - }, - ), - ListTile( - contentPadding: EdgeInsets.zero, - title: Text( - 'TPC', - style: Theme.of(context) - .textTheme - .headlineSmall! - .copyWith( - fontSize: 22, - color: currentPage == 5 - ? Theme.of(context).colorScheme.onBackground - : Colors.white, - ), + + const SizedBox( + height: 30, ), - onTap: () { - ref.read(titleProvider.notifier).state = 'TPC'; - Navigator.pop(context); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => TPCScreen(), + ListTile( + contentPadding: EdgeInsets.zero, + title: Text( + 'Home', + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith( + fontSize: 13, + color: currentPage == 0 + ? Theme.of(context).colorScheme.onBackground + : Colors.white, + ), + ), + onTap: () { + setState(() { + currentPage = 0; + }); + Navigator.pop(context); + }, + ), + ListTile( + contentPadding: EdgeInsets.zero, + title: Text( + 'Railway Concession', + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith( + fontSize: 13, + color: Colors.white, ), - ); - }, - ), - ListTile( - contentPadding: EdgeInsets.zero, - title: Text( - 'Committees and Events', - style: Theme.of(context) - .textTheme - .headlineSmall! - .copyWith( - fontSize: 22, - color: currentPage == 6 - ? Theme.of(context).colorScheme.onBackground - : Colors.white, + ), + onTap: () { //TODO: Make this navigate to railway page + }, + ), + ListTile( + contentPadding: EdgeInsets.zero, + title: Text( + 'Departments', + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith( + fontSize: 13, + color: currentPage == 7 + ? Theme.of(context).colorScheme.onBackground + : Colors.white, + ), + ), + onTap: () { + ref.read(titleProvider.notifier).state = 'Departments'; + Navigator.pop(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => DepartmentListScreen(), ), + ); + }, ), - onTap: () { - ref.read(titleProvider.notifier).state = 'Committees and Events'; - /*setState(() { - currentPage = 6; - });*/ - Navigator.pop(context); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => CommitteesScreen(), - ), - ); - }, - ), - ListTile( - contentPadding: EdgeInsets.zero, - title: Text( - 'Departments', - style: Theme.of(context) - .textTheme - .headlineMedium! - .copyWith( - fontSize: 22, - color: currentPage == 7 - ? Theme.of(context).colorScheme.onBackground - : Colors.white, + ListTile( + contentPadding: EdgeInsets.zero, + title: Text( + 'Committees', + style: Theme.of(context) + .textTheme + .headlineSmall! + .copyWith( + fontSize: 13, + color: currentPage == 6 + ? Theme.of(context).colorScheme.onBackground + : Colors.white, + ), + ), + onTap: () { + ref.read(titleProvider.notifier).state = 'Committees'; + /*setState(() { + currentPage = 6; + });*/ + Navigator.pop(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => CommitteesScreen(), ), + ); + }, ), - onTap: () { - ref.read(titleProvider.notifier).state = 'Departments'; - Navigator.pop(context); - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => DepartmentListScreen(), - ), - ); - }, - ), - Link( - uri: Uri.parse("mailto:devsclubtsec@gmail.com"), - builder: (context, followLink) => ListTile( + ListTile( contentPadding: EdgeInsets.zero, title: Text( - 'Contact Us', + 'Training and Placement Cell', style: Theme.of(context) .textTheme - .headlineMedium! + .headlineSmall! .copyWith( - fontSize: 22, - color: currentPage == 4 - ? Theme.of(context) - .colorScheme - .onBackground + fontSize: 13, + color: currentPage == 5 + ? Theme.of(context).colorScheme.onBackground : Colors.white, ), ), - onTap: () => followLink?.call(), + onTap: () { + ref.read(titleProvider.notifier).state = 'Training and Placement Cell'; + Navigator.pop(context); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => TPCScreen(), + ), + ); + }, ), - ), - // ListTile( - // contentPadding: EdgeInsets.zero, - // title: Text( - // 'Profile', - // style: Theme.of(context).textTheme.headlineMedium!.copyWith( - // fontSize: 22, - // color: currentPage == 5 - // ? Theme.of(context).colorScheme.onBackground - // : Colors.white, - // ), - // ), - // onTap: () { - // setState(() { - // currentPage = 5; - // }); - // Navigator.pop(context); - // }, - // ), - Expanded( - child: Align( - alignment: Alignment.bottomCenter, - child: ListTile( - contentPadding: EdgeInsets.zero, - title: Text( - data != null ? 'Logout' : 'Login', - style: Theme.of(context) - .textTheme - .headlineMedium! - .copyWith( - fontSize: 22, - color: Theme.of(context).colorScheme.error, + // ListTile( + // contentPadding: EdgeInsets.zero, + // title: Text( + // 'Profile', + // style: Theme.of(context).textTheme.headlineMedium!.copyWith( + // fontSize: 22, + // color: currentPage == 5 + // ? Theme.of(context).colorScheme.onBackground + // : Colors.white, + // ), + // ), + // onTap: () { + // setState(() { + // currentPage = 5; + // }); + // Navigator.pop(context); + // }, + // ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.end, + children: [ + ListTile( + contentPadding: EdgeInsets.zero, + title: Text( + 'Manage Account', + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith( + fontSize: 13, + color: Colors.white, ), - ), - onTap: () { - if (data != null) { - ref.watch(authProvider.notifier).signout(); - GoRouter.of(context).go('/login'); - // Navigator.pop(context); - } else { - GoRouter.of(context).go('/login'); - } - }, + ), + onTap: () { }, // TODO: Make this navigate to profile edit + ), + ListTile( + contentPadding: EdgeInsets.zero, + title: Text( + 'About', + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith( + fontSize: 13, + color: Colors.white, + ), + ), + onTap: () { }, // TODO: Make this navigate to the About screen + ), + Link( + uri: Uri.parse("mailto:devsclubtsec@gmail.com"), + builder: (context, followLink) => ListTile( + contentPadding: EdgeInsets.zero, + title: Text( + 'Contact Us', + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith( + fontSize: 13, + color: currentPage == 4 + ? Theme.of(context) + .colorScheme + .onBackground + : Colors.white, + ), + ), + onTap: () => followLink?.call(), + ), + ), + Container( + padding: EdgeInsets.all(8), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(50)), + color: Color(0xff383838), + ), + child: ListTile( + contentPadding: EdgeInsets.zero, + title: Center( + child: Text( + data != null ? 'Logout' : 'Login', + style: Theme.of(context) + .textTheme + .headlineMedium! + .copyWith( + fontSize: 22, + color: Theme.of(context).colorScheme.error, + ), + ), + ), + onTap: () { + if (data != null) { + ref.watch(authProvider.notifier).signout(); + GoRouter.of(context).go('/login'); + // Navigator.pop(context); + } else { + GoRouter.of(context).go('/login'); + } + }, + ), + ), + const SizedBox(height: 10,), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text.rich( + TextSpan( + text: 'Made with ♥️ TSEC', + style: TextStyle(fontSize: 10, color: Colors.white), + children: [ + TextSpan( + text: 'Devs Club', + style: TextStyle(fontSize: 10, color: Colors.blue) + ) + ] + ), + ) + ], + ) + ], ), - ), - ) - ], + ) + ], + ), ), ), - ) + ) : null, bottomNavigationBar: MainBottomNavBar( onTileTap: _getIndex, From a83941dc8cbd1e2687baea84a6104c5fcfc6d03d Mon Sep 17 00:00:00 2001 From: Aryan Date: Thu, 13 Jun 2024 15:28:01 +0530 Subject: [PATCH 2/2] The railway concession button in the drawer works now. --- lib/new_ui/screens/main_screen/main_screen.dart | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/new_ui/screens/main_screen/main_screen.dart b/lib/new_ui/screens/main_screen/main_screen.dart index 56b851ba..a102c3a7 100644 --- a/lib/new_ui/screens/main_screen/main_screen.dart +++ b/lib/new_ui/screens/main_screen/main_screen.dart @@ -338,10 +338,15 @@ class _MainScreenState extends ConsumerState { .headlineMedium! .copyWith( fontSize: 13, - color: Colors.white, + color: currentPage == 3 ? Theme.of(context).colorScheme.onBackground : Colors.white, ), ), - onTap: () { //TODO: Make this navigate to railway page + onTap: () { + //page 3 + setState(() { + currentPage = 3; + Navigator.pop(context); + }); }, ), ListTile( @@ -457,7 +462,13 @@ class _MainScreenState extends ConsumerState { color: Colors.white, ), ), - onTap: () { }, // TODO: Make this navigate to profile edit + onTap: () { + //page 4 + // setState(() { + // currentPage = 4; + // Navigator.pop(context); + // }); + }, // TODO: Make this navigate to profile edit ), ListTile( contentPadding: EdgeInsets.zero,