Skip to content

Commit

Permalink
fixing sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
firgia committed Nov 1, 2021
1 parent 0bacbb6 commit 97e4702
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
part of dashboard;

class DashboardController extends GetxController {
final scaffoldKey = GlobalKey<ScaffoldState>();

void openDrawer() {
if (scaffoldKey.currentState != null) {
scaffoldKey.currentState!.openDrawer();
}
}

// Data
_Profile getProfil() {
return const _Profile(
Expand Down
27 changes: 22 additions & 5 deletions lib/app/features/dashboard/views/screens/dashboard_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ class DashboardScreen extends GetView<DashboardController> {
@override
Widget build(BuildContext context) {
return Scaffold(
key: controller.scaffoldKey,
drawer: (ResponsiveBuilder.isDesktop(context))
? null
: Drawer(child: _Sidebar(data: controller.getSelectedProject())),
body: SingleChildScrollView(
child: ResponsiveBuilder(
mobileBuilder: (context, constraints) {
Expand All @@ -62,7 +66,7 @@ class DashboardScreen extends GetView<DashboardController> {
child: Column(
children: [
const SizedBox(height: kSpacing),
_buildHeader(),
_buildHeader(onPressedMenu: () => controller.openDrawer()),
const SizedBox(height: kSpacing * 2),
_buildProgress(),
const SizedBox(height: kSpacing * 2),
Expand Down Expand Up @@ -178,10 +182,23 @@ class DashboardScreen extends GetView<DashboardController> {
);
}

Widget _buildHeader() {
return const Padding(
padding: EdgeInsets.symmetric(horizontal: kSpacing),
child: _Header(),
Widget _buildHeader({Function()? onPressedMenu}) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: kSpacing),
child: Row(
children: [
if (onPressedMenu != null)
Padding(
padding: const EdgeInsets.only(right: kSpacing),
child: IconButton(
onPressed: onPressedMenu,
icon: const Icon(EvaIcons.menu),
tooltip: "menu",
),
),
const Expanded(child: _Header()),
],
),
);
}

Expand Down

0 comments on commit 97e4702

Please sign in to comment.