Skip to content

Commit

Permalink
Refactor/rework burger menu (#264)
Browse files Browse the repository at this point in the history
* refactor: rework burger menu

* chore: update podfile

* chore: update lockfile

* chore: also do pub upgrade here

---------

Co-authored-by: Julian König <[email protected]>
  • Loading branch information
nicole-eb and jkoenig134 authored Sep 6, 2024
1 parent 86d908e commit b7b1870
Show file tree
Hide file tree
Showing 18 changed files with 527 additions and 194 deletions.
39 changes: 39 additions & 0 deletions apps/enmeshed/assets/svg/notifications.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions apps/enmeshed/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,11 @@ end
post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
target.build_configurations.each do |config|
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [
'$(inherited)',
'PERMISSION_NOTIFICATIONS=1',
]
end
end
end
6 changes: 3 additions & 3 deletions apps/enmeshed/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ PODS:
- GTMSessionFetcher/Core (< 4.0, >= 3.3.2)
- MLImage (= 1.0.0-beta5)
- MLKitCommon (~> 11.0)
- mobile_scanner (5.2.1):
- mobile_scanner (5.2.2):
- Flutter
- GoogleMLKit/BarcodeScanning (~> 6.0.0)
- nanopb (2.30910.0):
Expand Down Expand Up @@ -231,7 +231,7 @@ SPEC CHECKSUMS:
MLKitBarcodeScanning: 10ca0845a6d15f2f6e911f682a1998b68b973e8b
MLKitCommon: afec63980417d29ffbb4790529a1b0a2291699e1
MLKitVision: e858c5f125ecc288e4a31127928301eaba9ae0c1
mobile_scanner: 131a34df36b024cc53457809fb991700f16f72d7
mobile_scanner: 83ad7d6c1c04303f3277387ab9f71840070d0e9a
nanopb: 438bc412db1928dac798aa6fd75726007be04262
open_file_ios: 461db5853723763573e140de3193656f91990d9e
OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c
Expand All @@ -245,6 +245,6 @@ SPEC CHECKSUMS:
SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe

PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011
PODFILE CHECKSUM: 02b36fb8bf2e06ab431fe95ec543944712ab3522

COCOAPODS: 1.15.2
1 change: 0 additions & 1 deletion apps/enmeshed/lib/account/account.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
export 'account_screen.dart';
export 'app_drawer.dart';
export 'contacts/contacts.dart';
export 'home/home.dart';
export 'mailbox/mailbox.dart';
Expand Down
20 changes: 2 additions & 18 deletions apps/enmeshed/lib/account/account_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import 'package:go_router/go_router.dart';

import '/core/core.dart';
import 'account_tab_controller.dart';
import 'app_drawer.dart';
import 'app_drawer/app_drawer.dart';
import 'mailbox/mailbox_filter_controller.dart';

class AccountScreen extends StatefulWidget {
Expand Down Expand Up @@ -80,7 +80,7 @@ class _AccountScreenState extends State<AccountScreen> with SingleTickerProvider
@override
Widget build(BuildContext context) {
return Scaffold(
drawer: AppDrawer(accountId: widget.accountId, accountName: _account?.name ?? '', activateHints: _activateHints),
drawer: AppDrawer(accountId: widget.accountId),
appBar: AppBar(
title: Text(
switch (_selectedIndex) {
Expand Down Expand Up @@ -261,20 +261,4 @@ class _AccountScreenState extends State<AccountScreen> with SingleTickerProvider

setState(() => _unreadMessagesCount = messages.length);
}

Future<void> _activateHints() async {
final addContactResult = await createHintsSetting(accountId: widget.accountId, key: 'hints.${InstructionsType.addContact}', value: true);
final loadProfileResult = await createHintsSetting(accountId: widget.accountId, key: 'hints.${InstructionsType.loadProfile}', value: true);

if (!mounted) return;

context.pop();

if (addContactResult.isError || loadProfileResult.isError) {
showErrorSnackbar(context: context, text: context.l10n.errorDialog_description);
return;
}

showSuccessSnackbar(context: context, text: context.l10n.instructions_activated);
}
}
144 changes: 0 additions & 144 deletions apps/enmeshed/lib/account/app_drawer.dart

This file was deleted.

50 changes: 50 additions & 0 deletions apps/enmeshed/lib/account/app_drawer/app_drawer.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import 'package:flutter/material.dart';

import 'drawer_hints_page.dart';
import 'drawer_main_page.dart';
import 'drawer_notifications_page.dart';

class AppDrawer extends StatefulWidget {
final String accountId;

const AppDrawer({required this.accountId, super.key});

@override
State<AppDrawer> createState() => _AppDrawerState();
}

class _AppDrawerState extends State<AppDrawer> {
late Widget _currentPage = DrawerMainPage(goToNotifications: _goToNotifications, goToHints: _goToHints);

@override
Widget build(BuildContext context) {
final maxWidth = MediaQuery.of(context).size.width * 0.85;

return SafeArea(
child: Drawer(
backgroundColor: Theme.of(context).colorScheme.surfaceContainerLow,
width: maxWidth,
child: Padding(
padding: const EdgeInsets.only(top: 8, right: 8, left: 8),
child: AnimatedSwitcher(
duration: const Duration(milliseconds: 300),
transitionBuilder: (child, animation) => SlideTransition(
position: animation.drive(
Tween(
begin: child is DrawerMainPage ? const Offset(-1, 0) : const Offset(1, 0),
end: Offset.zero,
).chain(CurveTween(curve: Curves.easeInOut)),
),
child: child,
),
child: _currentPage,
),
),
),
);
}

void _goHome() => setState(() => _currentPage = DrawerMainPage(goToNotifications: _goToNotifications, goToHints: _goToHints));
void _goToNotifications() => setState(() => _currentPage = DrawerNotificationsPage(goBack: _goHome));
void _goToHints() => setState(() => _currentPage = DrawerHintsPage(goBack: _goHome, accountId: widget.accountId));
}
Loading

0 comments on commit b7b1870

Please sign in to comment.