fix: update settings menu color (#6039)

* chore: replace settings popup menu backgroundcolor

* fix: invite toast blocked by keyboard
This commit is contained in:
Lucas.Xu 2024-08-26 09:51:57 +08:00 committed by GitHub
parent 62f0307289
commit 2ef74c229c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 2 deletions

View File

@ -28,9 +28,9 @@ class HomePageSettingsPopupMenu extends StatelessWidget {
Radius.circular(12.0), Radius.circular(12.0),
), ),
), ),
// todo: replace it with shadows
shadowColor: const Color(0x68000000), shadowColor: const Color(0x68000000),
elevation: 10, elevation: 10,
color: Theme.of(context).colorScheme.surface,
child: const Padding( child: const Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: FlowySvg( child: FlowySvg(

View File

@ -34,6 +34,7 @@ class InviteMembersScreen extends StatelessWidget {
titleText: LocaleKeys.settings_appearance_members_label.tr(), titleText: LocaleKeys.settings_appearance_members_label.tr(),
), ),
body: const _InviteMemberPage(), body: const _InviteMemberPage(),
resizeToAvoidBottomInset: false,
); );
} }
} }
@ -193,6 +194,9 @@ class _InviteMemberPageState extends State<_InviteMemberPage> {
final actionType = actionResult.actionType; final actionType = actionResult.actionType;
final result = actionResult.result; final result = actionResult.result;
// get keyboard height
final keyboardHeight = MediaQuery.of(context).viewInsets.bottom;
// only show the result dialog when the action is WorkspaceMemberActionType.add // only show the result dialog when the action is WorkspaceMemberActionType.add
if (actionType == WorkspaceMemberActionType.add) { if (actionType == WorkspaceMemberActionType.add) {
result.fold( result.fold(
@ -201,6 +205,7 @@ class _InviteMemberPageState extends State<_InviteMemberPage> {
context, context,
message: message:
LocaleKeys.settings_appearance_members_addMemberSuccess.tr(), LocaleKeys.settings_appearance_members_addMemberSuccess.tr(),
bottomPadding: keyboardHeight,
); );
}, },
(f) { (f) {
@ -216,6 +221,7 @@ class _InviteMemberPageState extends State<_InviteMemberPage> {
showToastNotification( showToastNotification(
context, context,
type: ToastificationType.error, type: ToastificationType.error,
bottomPadding: keyboardHeight,
message: message, message: message,
); );
}, },
@ -227,6 +233,7 @@ class _InviteMemberPageState extends State<_InviteMemberPage> {
context, context,
message: message:
LocaleKeys.settings_appearance_members_inviteMemberSuccess.tr(), LocaleKeys.settings_appearance_members_inviteMemberSuccess.tr(),
bottomPadding: keyboardHeight,
); );
}, },
(f) { (f) {
@ -244,6 +251,7 @@ class _InviteMemberPageState extends State<_InviteMemberPage> {
context, context,
type: ToastificationType.error, type: ToastificationType.error,
message: message, message: message,
bottomPadding: keyboardHeight,
); );
}, },
); );
@ -255,6 +263,7 @@ class _InviteMemberPageState extends State<_InviteMemberPage> {
message: LocaleKeys message: LocaleKeys
.settings_appearance_members_removeFromWorkspaceSuccess .settings_appearance_members_removeFromWorkspaceSuccess
.tr(), .tr(),
bottomPadding: keyboardHeight,
); );
}, },
(f) { (f) {
@ -264,6 +273,7 @@ class _InviteMemberPageState extends State<_InviteMemberPage> {
message: LocaleKeys message: LocaleKeys
.settings_appearance_members_removeFromWorkspaceFailed .settings_appearance_members_removeFromWorkspaceFailed
.tr(), .tr(),
bottomPadding: keyboardHeight,
); );
}, },
); );

View File

@ -303,6 +303,7 @@ void showToastNotification(
required String message, required String message,
String? description, String? description,
ToastificationType type = ToastificationType.success, ToastificationType type = ToastificationType.success,
double bottomPadding = 100,
}) { }) {
if (PlatformExtension.isMobile) { if (PlatformExtension.isMobile) {
toastification.showCustom( toastification.showCustom(
@ -311,6 +312,7 @@ void showToastNotification(
builder: (_, __) => _MToast( builder: (_, __) => _MToast(
message: message, message: message,
type: type, type: type,
bottomPadding: bottomPadding,
), ),
); );
return; return;
@ -346,10 +348,12 @@ class _MToast extends StatelessWidget {
const _MToast({ const _MToast({
required this.message, required this.message,
this.type = ToastificationType.success, this.type = ToastificationType.success,
this.bottomPadding = 100,
}); });
final String message; final String message;
final ToastificationType type; final ToastificationType type;
final double bottomPadding;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -362,7 +366,7 @@ class _MToast extends StatelessWidget {
); );
return Container( return Container(
alignment: Alignment.bottomCenter, alignment: Alignment.bottomCenter,
padding: const EdgeInsets.only(bottom: 100, left: 16, right: 16), padding: EdgeInsets.only(bottom: bottomPadding, left: 16, right: 16),
child: Container( child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 13.0), padding: const EdgeInsets.symmetric(horizontal: 12.0, vertical: 13.0),
decoration: BoxDecoration( decoration: BoxDecoration(