From 85aba663d71425209d492e24242be698ace60038 Mon Sep 17 00:00:00 2001 From: "Lucas.Xu" Date: Fri, 30 Aug 2024 22:24:58 +0800 Subject: [PATCH] fix: android toast style --- .../presentation/home/mobile_home_page.dart | 6 +-- .../setting/workspace/member_list.dart | 37 ++++++++++++++++--- .../popup_menu/appflowy_popup_menu.dart | 2 +- .../menu/sidebar/space/shared_widget.dart | 5 ++- .../lib/style_widget/button.dart | 35 +++++++++++++----- 5 files changed, 64 insertions(+), 21 deletions(-) diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page.dart b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page.dart index 1078d12b1f..f2d866533d 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/home/mobile_home_page.dart @@ -1,5 +1,3 @@ -import 'dart:io'; - import 'package:appflowy/generated/locale_keys.g.dart'; import 'package:appflowy/mobile/presentation/home/mobile_home_page_header.dart'; import 'package:appflowy/mobile/presentation/home/tab/mobile_space_tab.dart'; @@ -197,10 +195,10 @@ class _HomePageState extends State<_HomePage> { children: [ // Header Padding( - padding: EdgeInsets.only( + padding: const EdgeInsets.only( left: HomeSpaceViewSizes.mHorizontalPadding, right: 8.0, - top: Platform.isAndroid ? 8.0 : 0.0, + ), child: MobileHomePageHeader( userProfile: widget.userProfile, diff --git a/frontend/appflowy_flutter/lib/mobile/presentation/setting/workspace/member_list.dart b/frontend/appflowy_flutter/lib/mobile/presentation/setting/workspace/member_list.dart index 1d9f250d3a..7c653209ab 100644 --- a/frontend/appflowy_flutter/lib/mobile/presentation/setting/workspace/member_list.dart +++ b/frontend/appflowy_flutter/lib/mobile/presentation/setting/workspace/member_list.dart @@ -5,6 +5,7 @@ import 'package:appflowy/mobile/presentation/widgets/widgets.dart'; import 'package:appflowy/shared/af_role_pb_extension.dart'; import 'package:appflowy/workspace/presentation/settings/widgets/members/workspace_member_bloc.dart'; import 'package:appflowy_backend/protobuf/flowy-user/protobuf.dart'; +import 'package:appflowy_editor/appflowy_editor.dart' show PlatformExtension; import 'package:easy_localization/easy_localization.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flutter/material.dart'; @@ -72,10 +73,10 @@ class _MemberItem extends StatelessWidget { final canDelete = myRole.canDelete && member.email != userProfile.email; final textColor = member.role.isOwner ? Theme.of(context).hintColor : null; - Widget child = Container( - height: 48, - padding: const EdgeInsets.symmetric(horizontal: 16.0), - child: Row( + Widget child; + + if (PlatformExtension.isDesktop) { + child = Row( children: [ Expanded( child: FlowyText.medium( @@ -93,7 +94,33 @@ class _MemberItem extends StatelessWidget { ), ), ], - ), + ); + } else { + child = Row( + children: [ + Expanded( + child: FlowyText.medium( + member.name, + color: textColor, + fontSize: 15.0, + overflow: TextOverflow.ellipsis, + ), + ), + const HSpace(36.0), + FlowyText.medium( + member.role.description, + color: textColor, + fontSize: 15.0, + textAlign: TextAlign.end, + ), + ], + ); + } + + child = Container( + height: 48, + padding: const EdgeInsets.symmetric(horizontal: 16.0), + child: child, ); if (canDelete) { diff --git a/frontend/appflowy_flutter/lib/shared/popup_menu/appflowy_popup_menu.dart b/frontend/appflowy_flutter/lib/shared/popup_menu/appflowy_popup_menu.dart index 0c3d759744..0de43a84e8 100644 --- a/frontend/appflowy_flutter/lib/shared/popup_menu/appflowy_popup_menu.dart +++ b/frontend/appflowy_flutter/lib/shared/popup_menu/appflowy_popup_menu.dart @@ -1506,7 +1506,7 @@ class PopupMenuButtonState extends State> { if (items.isNotEmpty) { var popUpAnimationStyle = widget.popUpAnimationStyle; if (popUpAnimationStyle == null && - Theme.of(context).platform == TargetPlatform.iOS) { + defaultTargetPlatform == TargetPlatform.iOS) { popUpAnimationStyle = AnimationStyle( curve: Curves.easeInOut, duration: const Duration(milliseconds: 300), diff --git a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/shared_widget.dart b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/shared_widget.dart index bfe836ba46..0f3bebc7e8 100644 --- a/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/shared_widget.dart +++ b/frontend/appflowy_flutter/lib/workspace/presentation/home/menu/sidebar/space/shared_widget.dart @@ -321,11 +321,14 @@ class _ConfirmPopupState extends State { Navigator.of(context).pop(); } }, - child: Padding( + child: Container( padding: const EdgeInsets.symmetric( vertical: 20.0, horizontal: 20.0, ), + color: PlatformExtension.isDesktop + ? null + : Theme.of(context).colorScheme.surface, child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/button.dart b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/button.dart index 742fb9baff..1db56b8267 100644 --- a/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/button.dart +++ b/frontend/appflowy_flutter/packages/flowy_infra_ui/lib/style_widget/button.dart @@ -258,17 +258,32 @@ class FlowyButton extends StatelessWidget { child = IntrinsicWidth(child: child); } - final decoration = this.decoration ?? + var decoration = this.decoration; + + if (decoration == null && (showDefaultBoxDecorationOnMobile && - (Platform.isIOS || Platform.isAndroid) - ? BoxDecoration( - border: Border.all( - color: borderColor ?? Theme.of(context).colorScheme.outline, - width: 1.0, - ), - borderRadius: radius, - ) - : null); + (Platform.isIOS || Platform.isAndroid))) { + decoration = BoxDecoration( + color: backgroundColor ?? Theme.of(context).colorScheme.surface, + ); + } + + if (decoration == null && (Platform.isIOS || Platform.isAndroid)) { + if (showDefaultBoxDecorationOnMobile) { + decoration = BoxDecoration( + border: Border.all( + color: borderColor ?? Theme.of(context).colorScheme.outline, + width: 1.0, + ), + borderRadius: radius, + ); + } else if (backgroundColor != null) { + decoration = BoxDecoration( + color: backgroundColor, + borderRadius: radius, + ); + } + } return Container( decoration: decoration,