Skip to content

Commit

Permalink
Merge pull request #122 from SayedZeeshanHyder/main
Browse files Browse the repository at this point in the history
Improved the Railway Screen Container
  • Loading branch information
SayedZeeshanHyder authored Jun 13, 2024
2 parents f15dfa5 + 60e1cff commit 0360e33
Show file tree
Hide file tree
Showing 11 changed files with 493 additions and 523 deletions.
Binary file added assets/icons/notes.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/notes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/profileIcon.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/icons/profileIcon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions lib/new_ui/screens/home_screen/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class _HomeScreenState extends ConsumerState<HomeScreen> {
if (user != null && user.isStudent) {
widgetMap = {
"home": HomeWidget(
changeCurrentPage: (page) {
changeCurrentPage: (page,index) {
setState(() {
widget.changeCurrentBottomNavPage(page);
});
Expand All @@ -55,7 +55,7 @@ class _HomeScreenState extends ConsumerState<HomeScreen> {
} else {
widgetMap = {
"home": HomeWidget(
changeCurrentPage: (page) {
changeCurrentPage: (page,index) {
setState(() {
widget.changeCurrentBottomNavPage(page);
});
Expand Down
4 changes: 2 additions & 2 deletions lib/new_ui/screens/home_screen/widgets/home_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'package:tsec_app/provider/event_provider.dart';
import 'package:url_launcher/url_launcher_string.dart';

class HomeWidget extends ConsumerStatefulWidget {
Function(String page) changeCurrentPage;
Function(String page,int index) changeCurrentPage;
HomeWidget({Key? key, required this.changeCurrentPage}) : super(key: key);

@override
Expand Down Expand Up @@ -97,7 +97,7 @@ class _HomeWidgetState extends ConsumerState<HomeWidget> {
text: "Railway",
icon: Icons.directions_railway_outlined,
onPressed: () {
widget.changeCurrentPage("concession");
widget.changeCurrentPage("concession",3);
},
),
ContainerIconWithName(
Expand Down
223 changes: 114 additions & 109 deletions lib/new_ui/screens/main_screen/main_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class MainScreen extends ConsumerStatefulWidget {
const MainScreen({
Key? key,
}) : super(key: key);

@override
ConsumerState<MainScreen> createState() => _MainScreenState();
}
Expand All @@ -38,7 +39,7 @@ class _MainScreenState extends ConsumerState<MainScreen> {
int currentPage = 0;
int currentDrawerPage = 0;

void _getIndex(int index){
void _getIndex(int index) {
setState(() {
print(index.toString());
currentPage = index;
Expand All @@ -47,14 +48,16 @@ class _MainScreenState extends ConsumerState<MainScreen> {

late List<Widget> pages;
late Map<String, Widget> widgetMap;

@override
void initState() {
UserModel? user = ref.read(userModelProvider);
if (user != null && user.isStudent) {
widgetMap = {
"home": HomeWidget(
changeCurrentPage: (page) {
changeCurrentPage: (page,index) {
setState(() {
currentPage = index;
currentBottomNavPage = page;
});
},
Expand All @@ -69,8 +72,9 @@ class _MainScreenState extends ConsumerState<MainScreen> {
} else {
widgetMap = {
"home": HomeWidget(
changeCurrentPage: (page) {
changeCurrentPage: (page,index) {
setState(() {
currentPage = index;
currentBottomNavPage = page;
});
},
Expand All @@ -88,8 +92,9 @@ class _MainScreenState extends ConsumerState<MainScreen> {
Widget build(BuildContext context) {
pages = [
HomeWidget(
changeCurrentPage: (page) {
changeCurrentPage: (page,index) {
setState(() {
currentPage = index;
currentBottomNavPage = page;
});
},
Expand Down Expand Up @@ -129,116 +134,101 @@ class _MainScreenState extends ConsumerState<MainScreen> {
? Colors.transparent
: Theme.of(context).colorScheme.primary,
toolbarHeight: 80,
leadingWidth: MediaQuery.of(context).size.width * 0.7,
//leadingWidth: MediaQuery.of(context).size.width * 0.7,
title: Text(
currentPage < 5
? (currentBottomNavPage == "home"
? "Home"
: currentBottomNavPage == "attendance"
? "ERP"
: currentBottomNavPage == "timetable"
? "Schedule"
: currentBottomNavPage == "concession"
? "Railway Concession"
: "")
: currentPage == 5
? "TPC"
: currentPage == 6
? "Committees"
: "Departments",
style: Theme.of(context)
.textTheme
.headlineLarge!
.copyWith(fontSize: 15, color: Colors.white),
maxLines: 1,
overflow: TextOverflow.fade,
),
centerTitle: true,
leading: currentBottomNavPage != "profile"
? Row(
children: [
const SizedBox(
width: 8,
),
profilePic != null
? GestureDetector(
onTap: () {
_scaffoldKey.currentState?.openDrawer();
},
child: CircleAvatar(
radius: 35,
backgroundImage: MemoryImage(profilePic),
// backgroundImage: MemoryImage(_image!),
),
)
: GestureDetector(
onTap: () {
_scaffoldKey.currentState?.openDrawer();
},
child: const CircleAvatar(
radius: 35,
backgroundImage: AssetImage(
"assets/images/pfpholder.jpg"),
),
),
Container(
padding: EdgeInsets.only(left: 10),
child: Text(
currentPage <5
? (currentBottomNavPage == "home"
? "Home"
: currentBottomNavPage == "attendance"
? "ERP"
: currentBottomNavPage == "timetable"
? "Schedule"
: currentBottomNavPage ==
"concession"
? "Railway Concession"
: "")
: currentPage == 5
? "TPC"
: currentPage == 6
? "Committees"
: "Departments",
style: Theme.of(context)
.textTheme
.headlineLarge!
.copyWith(fontSize: 15, color: Colors.white),
maxLines: 1,
overflow: TextOverflow.fade,
? profilePic != null
? GestureDetector(
onTap: () {
_scaffoldKey.currentState?.openDrawer();
},
child: CircleAvatar(
radius: 35,
backgroundImage: MemoryImage(profilePic),
// backgroundImage: MemoryImage(_image!),
),
)
// SingleChildScrollView(
// scrollDirection: Axis.horizontal,
// child: Container(
// padding: EdgeInsets.only(left: 10),
// width: MediaQuery.of(context).size.width * .8,
// child: Text(
// currentPage == 0
// ? (currentBottomNavPage == "home"
// ? "Home"
// : currentBottomNavPage == "attendance"
// ? "ERP"
// : currentBottomNavPage ==
// "timetable"
// ? "Schedule"
// : currentBottomNavPage ==
// "concession"
// ? "Railway Concession"
// : "")
// : currentPage == 1
// ? "TPC"
// : currentPage == 2
// ? "Committees"
// : "Departments",
// style: Theme.of(context)
// .textTheme
// .headlineLarge!
// .copyWith(fontSize: 30),
// maxLines: 1,
// overflow: TextOverflow.fade,
// ),
// ),
// )
],
)
: GestureDetector(
onTap: () {
_scaffoldKey.currentState?.openDrawer();
},
child: SizedBox(
height: 30,
width: 30,
child:
Image.asset("assets/icons/profileIcon.png"),
),
)

// SingleChildScrollView(
// scrollDirection: Axis.horizontal,
// child: Container(
// padding: EdgeInsets.only(left: 10),
// width: MediaQuery.of(context).size.width * .8,
// child: Text(
// currentPage == 0
// ? (currentBottomNavPage == "home"
// ? "Home"
// : currentBottomNavPage == "attendance"
// ? "ERP"
// : currentBottomNavPage ==
// "timetable"
// ? "Schedule"
// : currentBottomNavPage ==
// "concession"
// ? "Railway Concession"
// : "")
// : currentPage == 1
// ? "TPC"
// : currentPage == 2
// ? "Committees"
// : "Departments",
// style: Theme.of(context)
// .textTheme
// .headlineLarge!
// .copyWith(fontSize: 30),
// maxLines: 1,
// overflow: TextOverflow.fade,
// ),
// ),
// )
: Container(),
// title: Text("Yyay"),
actions: userDetails != null
? [
Padding(
padding: const EdgeInsets.all(8.0),
child: Ink(
decoration: const ShapeDecoration(
color: Colors.white, // White background color
shape: CircleBorder(), // Circular shape
),
child: IconButton(
icon: const Icon(
Icons.note,
color: Colors.black, // Black icon color
InkWell(
child: Image.asset(
"assets/icons/notes.png" // Black icon color
),
onPressed: () {
GoRouter.of(context).push('/notes');
},
),
),
onTap: () {
GoRouter.of(context).push('/notes');
},
),
SizedBox(
width: 15,
),
// Padding(
// padding: const EdgeInsets.all(8.0),
Expand Down Expand Up @@ -341,7 +331,12 @@ class _MainScreenState extends ConsumerState<MainScreen> {
),
onTap: () {
Navigator.pop(context);
Navigator.push(context, MaterialPageRoute(builder: (context) => TPCScreen(),),);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TPCScreen(),
),
);
},
),
ListTile(
Expand All @@ -363,7 +358,12 @@ class _MainScreenState extends ConsumerState<MainScreen> {
currentPage = 6;
});*/
Navigator.pop(context);
Navigator.push(context, MaterialPageRoute(builder: (context)=> CommitteesScreen(),),);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => CommitteesScreen(),
),
);
},
),
ListTile(
Expand All @@ -382,7 +382,12 @@ class _MainScreenState extends ConsumerState<MainScreen> {
),
onTap: () {
Navigator.pop(context);
Navigator.push(context,MaterialPageRoute(builder: (context)=> DepartmentListScreen(),),);
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => DepartmentListScreen(),
),
);
},
),
Link(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class _HomeScreenState extends ConsumerState<MainBottomNavBar> {
if (user != null && user.isStudent) {
widgetMap = {
"home": HomeWidget(
changeCurrentPage: (page) {
changeCurrentPage: (page,index) {
setState(() {
widget.changeCurrentBottomNavPage(page);
});
Expand All @@ -58,7 +58,7 @@ class _HomeScreenState extends ConsumerState<MainBottomNavBar> {
} else {
widgetMap = {
"home": HomeWidget(
changeCurrentPage: (page) {
changeCurrentPage: (page,index) {
setState(() {
widget.changeCurrentBottomNavPage(page);
});
Expand Down
Loading

0 comments on commit 0360e33

Please sign in to comment.