mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: optimize settings on mobile (#6031)
* feat: optimize settings on mobile * feat: open discord link when clicking help button * fix: flutter analyze
This commit is contained in:
parent
0e844678fc
commit
104bf12ac7
@ -174,7 +174,7 @@ SPEC CHECKSUMS:
|
||||
file_picker: 09aa5ec1ab24135ccd7a1621c46c84134bfd6655
|
||||
flowy_infra_ui: 0455e1fa8c51885aa1437848e361e99419f34ebc
|
||||
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
|
||||
fluttertoast: 723e187574b149e68e63ca4d39b837586b903cfa
|
||||
fluttertoast: e9a18c7be5413da53898f660530c56f35edfba9c
|
||||
image_picker_ios: 99dfe1854b4fa34d0364e74a78448a0151025425
|
||||
integration_test: ce0a3ffa1de96d1a89ca0ac26fca7ea18a749ef4
|
||||
irondash_engine_context: 3458bf979b90d616ffb8ae03a150bafe2e860cc9
|
||||
@ -196,4 +196,4 @@ SPEC CHECKSUMS:
|
||||
|
||||
PODFILE CHECKSUM: d0d9b4ff572d8695c38eb3f9b490f55cdfc57eca
|
||||
|
||||
COCOAPODS: 1.11.3
|
||||
COCOAPODS: 1.15.2
|
||||
|
@ -1,20 +1,16 @@
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/mobile/presentation/home/section_folder/mobile_home_section_folder.dart';
|
||||
import 'package:appflowy/mobile/presentation/home/space/mobile_space.dart';
|
||||
import 'package:appflowy/mobile/presentation/presentation.dart';
|
||||
import 'package:appflowy/workspace/application/menu/sidebar_sections_bloc.dart';
|
||||
import 'package:appflowy/workspace/application/sidebar/folder/folder_bloc.dart';
|
||||
import 'package:appflowy/workspace/application/sidebar/space/space_bloc.dart';
|
||||
import 'package:appflowy/workspace/application/user/user_workspace_bloc.dart';
|
||||
import 'package:appflowy/workspace/presentation/home/home_sizes.dart';
|
||||
import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_slidable/flutter_slidable.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
// Contains Public And Private Sections
|
||||
class MobileFolders extends StatelessWidget {
|
||||
@ -73,13 +69,7 @@ class _MobileFolderState extends State<_MobileFolder> {
|
||||
child: Column(
|
||||
children: [
|
||||
..._buildSpaceOrSection(context, state),
|
||||
const VSpace(4.0),
|
||||
const Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: HomeSpaceViewSizes.mHorizontalPadding,
|
||||
),
|
||||
child: _TrashButton(),
|
||||
),
|
||||
const VSpace(80.0),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -122,28 +112,3 @@ class _MobileFolderState extends State<_MobileFolder> {
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
class _TrashButton extends StatelessWidget {
|
||||
const _TrashButton();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 52,
|
||||
child: FlowyButton(
|
||||
expand: true,
|
||||
margin: const EdgeInsets.symmetric(vertical: 8, horizontal: 2.0),
|
||||
leftIcon: const FlowySvg(
|
||||
FlowySvgs.m_delete_s,
|
||||
),
|
||||
leftIconSize: const Size.square(18),
|
||||
iconPadding: 10.0,
|
||||
text: FlowyText.regular(
|
||||
LocaleKeys.trash_text.tr(),
|
||||
fontSize: 16.0,
|
||||
),
|
||||
onTap: () => context.push(MobileHomeTrashPage.routeName),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -249,6 +249,8 @@ class _HomePageState extends State<_HomePage> {
|
||||
return;
|
||||
}
|
||||
|
||||
Log.info('workspace action result: $actionResult');
|
||||
|
||||
final actionType = actionResult.actionType;
|
||||
final result = actionResult.result;
|
||||
final isLoading = actionResult.isLoading;
|
||||
|
@ -2,7 +2,6 @@ import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/mobile/presentation/base/gesture.dart';
|
||||
import 'package:appflowy/mobile/presentation/bottom_sheet/bottom_sheet.dart';
|
||||
import 'package:appflowy/mobile/presentation/home/mobile_home_setting_page.dart';
|
||||
import 'package:appflowy/mobile/presentation/home/workspaces/workspace_menu_bottom_sheet.dart';
|
||||
import 'package:appflowy/plugins/base/emoji/emoji_picker_screen.dart';
|
||||
import 'package:appflowy/shared/icon_emoji_picker/flowy_icon_emoji_picker.dart';
|
||||
@ -18,6 +17,8 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
import 'setting/settings_popup_menu.dart';
|
||||
|
||||
class MobileHomePageHeader extends StatelessWidget {
|
||||
const MobileHomePageHeader({
|
||||
super.key,
|
||||
@ -45,15 +46,16 @@ class MobileHomePageHeader extends StatelessWidget {
|
||||
? _MobileWorkspace(userProfile: userProfile)
|
||||
: _MobileUser(userProfile: userProfile),
|
||||
),
|
||||
GestureDetector(
|
||||
onTap: () => context.push(
|
||||
MobileHomeSettingPage.routeName,
|
||||
),
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: FlowySvg(FlowySvgs.m_notification_settings_s),
|
||||
),
|
||||
),
|
||||
const HomePageSettingsPopupMenu(),
|
||||
// GestureDetector(
|
||||
// onTap: () => context.push(
|
||||
// MobileHomeSettingPage.routeName,
|
||||
// ),
|
||||
// child: const Padding(
|
||||
// padding: EdgeInsets.all(8.0),
|
||||
// child: FlowySvg(FlowySvgs.m_notification_settings_s),
|
||||
// ),
|
||||
// ),
|
||||
const HSpace(8.0),
|
||||
],
|
||||
),
|
||||
|
@ -0,0 +1,143 @@
|
||||
import 'package:appflowy/core/helpers/url_launcher.dart';
|
||||
import 'package:appflowy/generated/flowy_svgs.g.dart';
|
||||
import 'package:appflowy/generated/locale_keys.g.dart';
|
||||
import 'package:appflowy/mobile/presentation/presentation.dart';
|
||||
import 'package:appflowy/mobile/presentation/setting/workspace/invite_members_screen.dart';
|
||||
import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
|
||||
enum _MobileSettingsPopupMenuItem {
|
||||
settings,
|
||||
members,
|
||||
trash,
|
||||
help,
|
||||
}
|
||||
|
||||
class HomePageSettingsPopupMenu extends StatelessWidget {
|
||||
const HomePageSettingsPopupMenu({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return PopupMenuButton<_MobileSettingsPopupMenuItem>(
|
||||
offset: const Offset(0, 36),
|
||||
padding: EdgeInsets.zero,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(12.0),
|
||||
),
|
||||
),
|
||||
// todo: replace it with shadows
|
||||
shadowColor: const Color(0x68000000),
|
||||
elevation: 10,
|
||||
child: const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: FlowySvg(
|
||||
FlowySvgs.m_settings_more_s,
|
||||
),
|
||||
),
|
||||
itemBuilder: (BuildContext context) =>
|
||||
<PopupMenuEntry<_MobileSettingsPopupMenuItem>>[
|
||||
_buildItem(
|
||||
value: _MobileSettingsPopupMenuItem.settings,
|
||||
svg: FlowySvgs.m_notification_settings_s,
|
||||
text: LocaleKeys.settings_popupMenuItem_settings.tr(),
|
||||
),
|
||||
const PopupMenuDivider(height: 0.5),
|
||||
_buildItem(
|
||||
value: _MobileSettingsPopupMenuItem.members,
|
||||
svg: FlowySvgs.m_settings_member_s,
|
||||
text: LocaleKeys.settings_popupMenuItem_members.tr(),
|
||||
),
|
||||
const PopupMenuDivider(height: 0.5),
|
||||
_buildItem(
|
||||
value: _MobileSettingsPopupMenuItem.trash,
|
||||
svg: FlowySvgs.trash_s,
|
||||
text: LocaleKeys.settings_popupMenuItem_trash.tr(),
|
||||
),
|
||||
const PopupMenuDivider(height: 0.5),
|
||||
_buildItem(
|
||||
value: _MobileSettingsPopupMenuItem.help,
|
||||
svg: FlowySvgs.message_support_s,
|
||||
text: LocaleKeys.settings_popupMenuItem_helpAndSupport.tr(),
|
||||
),
|
||||
],
|
||||
onSelected: (_MobileSettingsPopupMenuItem value) {
|
||||
switch (value) {
|
||||
case _MobileSettingsPopupMenuItem.members:
|
||||
_openMembersPage(context);
|
||||
break;
|
||||
case _MobileSettingsPopupMenuItem.trash:
|
||||
_openTrashPage(context);
|
||||
break;
|
||||
case _MobileSettingsPopupMenuItem.settings:
|
||||
_openSettingsPage(context);
|
||||
break;
|
||||
case _MobileSettingsPopupMenuItem.help:
|
||||
_openHelpPage(context);
|
||||
break;
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
PopupMenuItem<T> _buildItem<T>({
|
||||
required T value,
|
||||
required FlowySvgData svg,
|
||||
required String text,
|
||||
}) {
|
||||
return PopupMenuItem<T>(
|
||||
value: value,
|
||||
padding: EdgeInsets.zero,
|
||||
child: _PopupButton(
|
||||
svg: svg,
|
||||
text: text,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
void _openMembersPage(BuildContext context) {
|
||||
context.push(InviteMembersScreen.routeName);
|
||||
}
|
||||
|
||||
void _openTrashPage(BuildContext context) {
|
||||
context.push(MobileHomeTrashPage.routeName);
|
||||
}
|
||||
|
||||
void _openHelpPage(BuildContext context) {
|
||||
afLaunchUrlString('https://discord.com/invite/9Q2xaN37tV');
|
||||
}
|
||||
|
||||
void _openSettingsPage(BuildContext context) {
|
||||
context.push(MobileHomeSettingPage.routeName);
|
||||
}
|
||||
}
|
||||
|
||||
class _PopupButton extends StatelessWidget {
|
||||
const _PopupButton({
|
||||
required this.svg,
|
||||
required this.text,
|
||||
});
|
||||
|
||||
final FlowySvgData svg;
|
||||
final String text;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: 44,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: Row(
|
||||
children: [
|
||||
FlowySvg(svg, size: const Size.square(20)),
|
||||
const HSpace(12),
|
||||
FlowyText.regular(
|
||||
text,
|
||||
fontSize: 16,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@ class MobileNotificationPageHeader extends StatelessWidget {
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const HSpace(16.0),
|
||||
const HSpace(18.0),
|
||||
FlowyText(
|
||||
LocaleKeys.settings_notifications_titles_notifications.tr(),
|
||||
fontSize: 20,
|
||||
|
@ -493,6 +493,11 @@ class UserWorkspaceActionResult {
|
||||
final UserWorkspaceActionType actionType;
|
||||
final bool isLoading;
|
||||
final FlowyResult<void, FlowyError>? result;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UserWorkspaceActionResult(actionType: $actionType, isLoading: $isLoading, result: $result)';
|
||||
}
|
||||
}
|
||||
|
||||
@freezed
|
||||
|
6
frontend/resources/flowy_icons/16x/m_settings_member.svg
Normal file
6
frontend/resources/flowy_icons/16x/m_settings_member.svg
Normal file
@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M10.5 13.625V12.375C10.5 11.712 10.2366 11.0761 9.76777 10.6072C9.29893 10.1384 8.66304 9.875 8 9.875H4.25C3.58696 9.875 2.95107 10.1384 2.48223 10.6072C2.01339 11.0761 1.75 11.712 1.75 12.375V13.625" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M3.625 4.875C3.625 5.53804 3.88839 6.17393 4.35723 6.64277C4.82607 7.11161 5.46196 7.375 6.125 7.375C6.78804 7.375 7.42393 7.11161 7.89277 6.64277C8.36161 6.17393 8.625 5.53804 8.625 4.875C8.625 4.21196 8.36161 3.57607 7.89277 3.10723C7.42393 2.63839 6.78804 2.375 6.125 2.375C5.46196 2.375 4.82607 2.63839 4.35723 3.10723C3.88839 3.57607 3.625 4.21196 3.625 4.875Z" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M14.25 13.625V12.375C14.2496 11.8211 14.0652 11.283 13.7259 10.8452C13.3865 10.4074 12.9113 10.0947 12.375 9.95624" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M10.5 2.45624C11.0378 2.59393 11.5144 2.90668 11.8548 3.34518C12.1952 3.78369 12.3799 4.32301 12.3799 4.87811C12.3799 5.43322 12.1952 5.97254 11.8548 6.41104C11.5144 6.84955 11.0378 7.1623 10.5 7.29999" stroke="black" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
@ -395,6 +395,12 @@
|
||||
},
|
||||
"settings": {
|
||||
"title": "Settings",
|
||||
"popupMenuItem": {
|
||||
"settings": "Settings",
|
||||
"members": "Members",
|
||||
"trash": "Trash",
|
||||
"helpAndSupport": "Help & Support"
|
||||
},
|
||||
"accountPage": {
|
||||
"menuLabel": "My account",
|
||||
"title": "My account",
|
||||
|
Loading…
Reference in New Issue
Block a user