fix: improve look of share button dropdown menu (#1224)

This commit is contained in:
Richard Shiue 2022-10-06 19:33:02 +08:00 committed by GitHub
parent 8a2c57014c
commit 5a5f5eceb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 9 deletions

View File

@ -15,6 +15,7 @@ import 'package:clipboard/clipboard.dart';
import 'package:dartz/dartz.dart' as dartz; import 'package:dartz/dartz.dart' as dartz;
import 'package:easy_localization/easy_localization.dart'; import 'package:easy_localization/easy_localization.dart';
import 'package:flowy_infra/size.dart'; import 'package:flowy_infra/size.dart';
import 'package:flowy_infra/theme.dart';
import 'package:flowy_infra_ui/flowy_infra_ui.dart'; import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flowy_infra_ui/widget/rounded_button.dart'; import 'package:flowy_infra_ui/widget/rounded_button.dart';
import 'package:flowy_sdk/log.dart'; import 'package:flowy_sdk/log.dart';
@ -112,7 +113,6 @@ class DocumentShareButton extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
double buttonWidth = 60;
return BlocProvider( return BlocProvider(
create: (context) => getIt<DocShareBloc>(param1: view), create: (context) => getIt<DocShareBloc>(param1: view),
child: BlocListener<DocShareBloc, DocShareState>( child: BlocListener<DocShareBloc, DocShareState>(
@ -130,6 +130,7 @@ class DocumentShareButton extends StatelessWidget {
}, },
child: BlocBuilder<DocShareBloc, DocShareState>( child: BlocBuilder<DocShareBloc, DocShareState>(
builder: (context, state) { builder: (context, state) {
final theme = context.watch<AppTheme>();
return ChangeNotifierProvider.value( return ChangeNotifierProvider.value(
value: Provider.of<AppearanceSetting>(context, listen: true), value: Provider.of<AppearanceSetting>(context, listen: true),
child: Selector<AppearanceSetting, Locale>( child: Selector<AppearanceSetting, Locale>(
@ -137,16 +138,15 @@ class DocumentShareButton extends StatelessWidget {
builder: (ctx, _, child) => ConstrainedBox( builder: (ctx, _, child) => ConstrainedBox(
constraints: const BoxConstraints.expand( constraints: const BoxConstraints.expand(
height: 30, height: 30,
// minWidth: buttonWidth,
width: 100, width: 100,
), ),
child: RoundedTextButton( child: RoundedTextButton(
title: LocaleKeys.shareAction_buttonText.tr(), title: LocaleKeys.shareAction_buttonText.tr(),
fontSize: 12, fontSize: 12,
borderRadius: Corners.s6Border, borderRadius: Corners.s6Border,
color: Colors.lightBlue, color: theme.main1,
onPressed: () => _showActionList( onPressed: () =>
context, Offset(-(buttonWidth / 2), 10)), _showActionList(context, const Offset(0, 10)),
), ),
), ),
), ),
@ -193,7 +193,7 @@ class DocumentShareButton extends StatelessWidget {
}); });
actionList.show( actionList.show(
context, context,
anchorDirection: AnchorDirection.bottomWithCenterAligned, anchorDirection: AnchorDirection.bottomWithRightAligned,
anchorOffset: offset, anchorOffset: offset,
); );
} }

View File

@ -97,10 +97,8 @@ class ActionCell<T extends ActionItem> extends StatelessWidget {
child: SizedBox( child: SizedBox(
height: itemHeight, height: itemHeight,
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
if (icon != null) icon, if (icon != null) ...[icon, HSpace(ActionListSizes.itemHPadding)],
HSpace(ActionListSizes.itemHPadding),
FlowyText.medium(action.name, fontSize: 12), FlowyText.medium(action.name, fontSize: 12),
], ],
), ),