diff --git a/lib/screens/profile/components/main_menu.dart b/lib/screens/profile/components/main_menu.dart new file mode 100644 index 0000000..d315a7d --- /dev/null +++ b/lib/screens/profile/components/main_menu.dart @@ -0,0 +1,27 @@ +import 'package:flutter/material.dart'; +import 'package:unit2/theme-data.dart/colors.dart'; + +class MainMenu extends StatelessWidget { + final IconData icon; + final String title; + const MainMenu({ + required this.icon, + required this.title, + Key? key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return ListTile( + leading: Icon( + icon, + color: primary, + ), + title: Text( + title, + style: TextStyle(fontWeight: FontWeight.bold), + ), + trailing: const Icon(Icons.keyboard_arrow_right), + ); + } +} diff --git a/lib/screens/profile/components/submenu.dart b/lib/screens/profile/components/submenu.dart new file mode 100644 index 0000000..72fa2d2 --- /dev/null +++ b/lib/screens/profile/components/submenu.dart @@ -0,0 +1,19 @@ +import 'package:flutter/material.dart'; +import 'package:unit2/theme-data.dart/colors.dart'; + +ListTile subMenu(IconData icon, String title) { + return ListTile( + leading: Container( + margin: const EdgeInsets.only(left: 20), + child: Icon( + icon, + size: 20, + color: primary, + )), + title: Text( + title, + style: const TextStyle(), + ), + trailing: const Icon(Icons.keyboard_arrow_right), + ); +} diff --git a/lib/screens/profile/profile.dart b/lib/screens/profile/profile.dart new file mode 100644 index 0000000..d3ab4a3 --- /dev/null +++ b/lib/screens/profile/profile.dart @@ -0,0 +1,146 @@ +import 'package:expandable_group/expandable_group_widget.dart'; +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/src/widgets/container.dart'; +import 'package:flutter/src/widgets/framework.dart'; +import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:fluttericon/brandico_icons.dart'; +import 'package:fluttericon/elusive_icons.dart'; +import 'package:fluttericon/entypo_icons.dart'; +import 'package:fluttericon/font_awesome5_icons.dart'; +import 'package:fluttericon/font_awesome_icons.dart'; +import 'package:fluttericon/modern_pictograms_icons.dart'; +import 'package:fluttericon/typicons_icons.dart'; +import 'package:unit2/bloc/bloc/user_bloc.dart'; +import 'package:unit2/theme-data.dart/colors.dart'; + +import 'components/main_menu.dart'; +import 'components/submenu.dart'; + +class ProfileInfo extends StatefulWidget { + const ProfileInfo({super.key}); + + @override + State createState() => _ProfileInfoState(); +} + +class _ProfileInfoState extends State { + @override + Widget build(BuildContext context) { + return SafeArea( + child: Scaffold( + appBar: AppBar( + backgroundColor: primary, + centerTitle: true, + title: const Text('Profile'), + ), + body: BlocConsumer( + listener: (context, state) { + // TODO: implement listener + }, + builder: (context, state) { + if (state is UserLoggedIn) { + return Container( + padding: const EdgeInsets.symmetric( + vertical: 12, horizontal: 12), + child: ListView( + children: [ + ExpandableGroup( + collapsedIcon: + const Icon(Icons.keyboard_arrow_down), + expandedIcon: const Icon(Icons.keyboard_arrow_up), + header: const ListTile( + leading: Icon( + Elusive.address_book, + color: primary, + ), + title: Text( + "Basic Information", + style: TextStyle(fontWeight: FontWeight.bold), + ), + ), + items: [ + subMenu(Icons.person, "Primary"), + subMenu(Icons.home, "Home Addresses"), + subMenu(Icons.contact_mail, "Identifications"), + subMenu(Icons.contact_phone, "Contact Info"), + subMenu(Icons.flag, "Citizenships"), + ]), + const MainMenu( + icon: Elusive.group, + title: "Family", + ), + const MainMenu( + icon: FontAwesome5.graduation_cap, + title: "Education", + ), + const MainMenu( + icon: Icons.stars, + title: "Eligibility", + ), + const MainMenu( + icon: FontAwesome5.shopping_bag, + title: "Work History", + ), + const MainMenu( + icon: FontAwesome5.walking, + title: "Voluntary Work & Civic Services", + ), + const MainMenu( + icon: Elusive.lightbulb, + title: "Learning & Development", + ), + const MainMenu( + icon: Brandico.codepen, + title: "Personal References", + ), + ExpandableGroup( + collapsedIcon: + const Icon(Icons.keyboard_arrow_down), + expandedIcon: const Icon(Icons.keyboard_arrow_up), + header: const ListTile( + leading: Icon( + Icons.info, + color: primary, + ), + title: Text( + "Other Information", + style: TextStyle(fontWeight: FontWeight.bold), + ), + ), + items: [ + subMenu(Icons.fitness_center, "Skills & Hobbies"), + subMenu(FontAwesome5.certificate, + "Organization Memberships"), + subMenu( + Entypo.doc_text, "Non-Academic Recognitions"), + ]), + ExpandableGroup( + collapsedIcon: + const Icon(Icons.keyboard_arrow_down), + expandedIcon: const Icon(Icons.keyboard_arrow_up), + header: const ListTile( + leading: Icon( + FontAwesome5.laptop_house, + color: primary, + ), + title: Text( + "Assets", + style: TextStyle(fontWeight: FontWeight.bold), + ), + ), + items: [ + subMenu( + ModernPictograms.home, "Real Property Tax"), + ]), + ], + ), + ); + } + return const Center( + child: Text("default"), + ); + }, + ))); + } +} diff --git a/lib/screens/unit2/homepage.dart/module-screen.dart b/lib/screens/unit2/homepage.dart/module-screen.dart index 96ed319..5626247 100644 --- a/lib/screens/unit2/homepage.dart/module-screen.dart +++ b/lib/screens/unit2/homepage.dart/module-screen.dart @@ -32,6 +32,7 @@ class _MainScreenState extends State { }, child: BlocBuilder(builder: (context, state) { if (state is UserLoggedIn) { + print(state.userData!.user!.login!.token); state.userData!.user!.login!.user!.roles!.forEach((role) { Role? getRole = role; role!.modules!.forEach((module) { diff --git a/lib/utils/app_router.dart b/lib/utils/app_router.dart index 97750b2..e6bc31b 100644 --- a/lib/utils/app_router.dart +++ b/lib/utils/app_router.dart @@ -3,6 +3,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:unit2/bloc/bloc/user_bloc.dart'; import 'package:unit2/screens/unit2/login/login.dart'; import 'package:unit2/utils/global_context.dart'; +import '../screens/profile/profile.dart'; import '../screens/unit2/basic-info/basic-info.dart'; import '../screens/unit2/homepage.dart/components/drawer-screen.dart'; import '../screens/unit2/login/qr_login.dart'; @@ -18,18 +19,22 @@ class AppRouter { return const UniT2Login(); }); case '/module-screen': - // BlocProvider.of( NavigationService.navigatorKey.currentContext!).add(LoadLoggedInUser()); + // BlocProvider.of( NavigationService.navigatorKey.currentContext!).add(LoadLoggedInUser()); return MaterialPageRoute(builder: (_) { return const DrawerScreen(); }); case '/basic-info': - return MaterialPageRoute(builder: (_){ - return const BasicInfo(); - }); + return MaterialPageRoute(builder: (_) { + return const BasicInfo(); + }); case '/qr-login': - return MaterialPageRoute(builder: (_){ - return const QRLogin(); - }); + return MaterialPageRoute(builder: (_) { + return const QRLogin(); + }); + case '/profile': + return MaterialPageRoute(builder: (_) { + return const ProfileInfo(); + }); default: return MaterialPageRoute(builder: (context) { return Container(); diff --git a/pubspec.lock b/pubspec.lock index e894f88..42cf4b1 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -176,6 +176,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.5" + expandable_group: + dependency: "direct main" + description: + name: expandable_group + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.8" fake_async: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 8f5fcac..f989e51 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -66,6 +66,7 @@ dependencies: dio: ^4.0.6 cool_alert: ^1.1.0 permission_handler: ^10.2.0 + expandable_group: ^0.0.8 dev_dependencies: flutter_test: