Skip to content

Commit

Permalink
Merge pull request #1885 from ardriveapp/PE-6898-share-drive
Browse files Browse the repository at this point in the history
PE-6898: update share drive style
  • Loading branch information
thiagocarvalhodev authored Oct 29, 2024
2 parents 586eb72 + 66a507b commit ab916fa
Show file tree
Hide file tree
Showing 2 changed files with 85 additions and 74 deletions.
7 changes: 4 additions & 3 deletions lib/components/details_panel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1249,21 +1249,22 @@ class _CopyButtonState extends State<CopyButton> {
OverlayEntry _createOverlayEntry(BuildContext parentContext) {
final RenderBox button = context.findRenderObject() as RenderBox;
final Offset buttonPosition = button.localToGlobal(Offset.zero);
final typography = ArDriveTypographyNew.of(context);
final colorTokens = ArDriveTheme.of(context).themeData.colorTokens;

return OverlayEntry(
builder: (context) => Positioned(
left: buttonPosition.dx - widget.positionX,
top: buttonPosition.dy - widget.positionY,
child: Material(
color: widget.copyMessageColor ??
ArDriveTheme.of(context).themeData.backgroundColor,
color: widget.copyMessageColor ?? colorTokens.containerL1,
borderRadius: BorderRadius.circular(20),
child: Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 4),
child: Center(
child: Text(
'Copied!',
style: ArDriveTypography.body.smallRegular(),
style: typography.paragraphNormal(),
),
),
),
Expand Down
152 changes: 81 additions & 71 deletions lib/components/drive_share_dialog.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,83 +46,93 @@ class DriveShareDialogState extends State<DriveShareDialog> {
@override
Widget build(BuildContext context) =>
BlocBuilder<DriveShareCubit, DriveShareState>(
builder: (context, state) => ArDriveStandardModal(
width: kLargeDialogWidth,
title: appLocalizationsOf(context).shareDriveWithOthers,
description: state is DriveShareLoadSuccess ? state.drive.name : null,
content: SizedBox(
builder: (context, state) {
final typography = ArDriveTypographyNew.of(context);

return ArDriveStandardModalNew(
width: kLargeDialogWidth,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (state is DriveShareLoadInProgress)
const Center(child: CircularProgressIndicator())
else if (state is DriveShareLoadSuccess) ...{
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Expanded(
child: ArDriveTextField(
initialValue: state.driveShareLink.toString(),
isEnabled: false,
),
),
const SizedBox(width: 16),
CopyButton(
positionX: 4,
positionY: 40,
copyMessageColor: ArDriveTheme.of(context)
.themeData
.tableTheme
.selectedItemColor,
showCopyText: true,
text: state.driveShareLink.toString(),
child: Text(
appLocalizationsOf(context).copyLink,
style: ArDriveTypography.body
.buttonLargeRegular(
title: appLocalizationsOf(context).shareDriveWithOthers,
description:
state is DriveShareLoadSuccess ? state.drive.name : null,
content: SizedBox(
width: kLargeDialogWidth,
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
if (state is DriveShareLoadInProgress)
const Center(child: CircularProgressIndicator())
else if (state is DriveShareLoadSuccess) ...{
Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Flexible(
child: Container(
padding: const EdgeInsets.fromLTRB(20, 14, 20, 14),
decoration: BoxDecoration(
color: ArDriveTheme.of(context)
.themeData
.colorTokens
.inputDisabled,
borderRadius: BorderRadius.circular(6),
border: Border.all(
color: ArDriveTheme.of(context)
.themeData
.colors
.themeFgDefault,
)
.copyWith(
decoration: TextDecoration.underline,
.colorTokens
.strokeMid,
),
),
child: Row(
children: [
Expanded(
child: Text(
state.driveShareLink.toString(),
style: typography.paragraphNormal(
color: ArDriveTheme.of(context)
.themeData
.colorTokens
.textXLow,
fontWeight: ArFontWeight.semiBold,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
),
const SizedBox(width: 8),
CopyButton(
text: state.driveShareLink.toString(),
),
],
),
),
),
),
],
),
const SizedBox(height: 16),
Text(
state.drive.isPublic
? appLocalizationsOf(context)
.anyoneCanAccessThisDrivePublic
: appLocalizationsOf(context)
.anyoneCanAccessThisDrivePrivate,
style: ArDriveTypography.body.buttonLargeRegular(
color: ArDriveTheme.of(context)
.themeData
.colors
.themeFgDefault,
],
),
),
} else if (state is DriveShareLoadFail)
Text(state.message)
],
const SizedBox(height: 16),
Text(
state.drive.isPublic
? appLocalizationsOf(context)
.anyoneCanAccessThisDrivePublic
: appLocalizationsOf(context)
.anyoneCanAccessThisDrivePrivate,
style: typography.paragraphLarge(),
),
} else if (state is DriveShareLoadFail)
Text(state.message)
],
),
),
),
actions: [
if (state is DriveShareLoadSuccess)
ModalAction(
action: () {
Navigator.pop(context);
context.read<FeedbackSurveyCubit>().openRemindMe();
},
title: appLocalizationsOf(context).doneEmphasized,
)
],
),
actions: [
if (state is DriveShareLoadSuccess)
ModalAction(
action: () {
Navigator.pop(context);
context.read<FeedbackSurveyCubit>().openRemindMe();
},
title: appLocalizationsOf(context).doneEmphasized,
)
],
);
},
);
}

0 comments on commit ab916fa

Please sign in to comment.