Skip to content

Commit

Permalink
fix: android toast style (AppFlowy-IO#6128)
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasXu0 authored Aug 31, 2024
1 parent 8139065 commit d264f3d
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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(
Expand All @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1506,7 +1506,7 @@ class PopupMenuButtonState<T> extends State<PopupMenuButton<T>> {
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),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -321,11 +321,14 @@ class _ConfirmPopupState extends State<ConfirmPopup> {
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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d264f3d

Please sign in to comment.