mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
fix: settings dialog files path copy snackbar (#2114)
This commit is contained in:
parent
9dc8e9d934
commit
5ef91a8157
@ -198,7 +198,8 @@
|
||||
"browser": "Browse",
|
||||
"create": "Create",
|
||||
"folderPath": "Path to store your folder",
|
||||
"locationCannotBeEmpty": "Path cannot be empty"
|
||||
"locationCannotBeEmpty": "Path cannot be empty",
|
||||
"pathCopiedSnackbar": "File storage path copied to clipboard!"
|
||||
},
|
||||
"user": {
|
||||
"name": "Name",
|
||||
|
@ -12,6 +12,9 @@ import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
|
||||
const _dialogHorizontalPadding = EdgeInsets.symmetric(horizontal: 12);
|
||||
const _contentInsetPadding = EdgeInsets.fromLTRB(0.0, 12.0, 0.0, 16.0);
|
||||
|
||||
class SettingsDialog extends StatelessWidget {
|
||||
final UserProfilePB user;
|
||||
SettingsDialog(this.user, {Key? key}) : super(key: ValueKey(user.id));
|
||||
@ -23,34 +26,46 @@ class SettingsDialog extends StatelessWidget {
|
||||
..add(const SettingsDialogEvent.initial()),
|
||||
child: BlocBuilder<SettingsDialogBloc, SettingsDialogState>(
|
||||
builder: (context, state) => FlowyDialog(
|
||||
title: FlowyText(
|
||||
LocaleKeys.settings_title.tr(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
title: Padding(
|
||||
padding: _dialogHorizontalPadding + _contentInsetPadding,
|
||||
child: FlowyText(
|
||||
LocaleKeys.settings_title.tr(),
|
||||
fontSize: 20,
|
||||
fontWeight: FontWeight.w700,
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 200,
|
||||
child: SettingsMenu(
|
||||
changeSelectedPage: (index) {
|
||||
context
|
||||
.read<SettingsDialogBloc>()
|
||||
.add(SettingsDialogEvent.setSelectedPage(index));
|
||||
},
|
||||
currentPage: context.read<SettingsDialogBloc>().state.page,
|
||||
child: ScaffoldMessenger(
|
||||
child: Scaffold(
|
||||
backgroundColor: Colors.transparent,
|
||||
body: Padding(
|
||||
padding: _dialogHorizontalPadding,
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 200,
|
||||
child: SettingsMenu(
|
||||
changeSelectedPage: (index) {
|
||||
context
|
||||
.read<SettingsDialogBloc>()
|
||||
.add(SettingsDialogEvent.setSelectedPage(index));
|
||||
},
|
||||
currentPage:
|
||||
context.read<SettingsDialogBloc>().state.page,
|
||||
),
|
||||
),
|
||||
const VerticalDivider(),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: getSettingsView(
|
||||
context.read<SettingsDialogBloc>().state.page,
|
||||
context.read<SettingsDialogBloc>().state.userProfile,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
const VerticalDivider(),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: getSettingsView(
|
||||
context.read<SettingsDialogBloc>().state.page,
|
||||
context.read<SettingsDialogBloc>().state.userProfile,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
@ -46,7 +46,17 @@ class SettingsFileLocationCustomzierState
|
||||
onDoubleTap: () {
|
||||
Clipboard.setData(ClipboardData(
|
||||
text: state.path,
|
||||
));
|
||||
)).then((_) {
|
||||
if (mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: FlowyText(
|
||||
LocaleKeys.settings_files_pathCopiedSnackbar.tr(),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
child: FlowyText.regular(
|
||||
state.path ?? '',
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'dart:math';
|
||||
|
||||
const _overlayContainerPadding = EdgeInsets.all(12);
|
||||
const _overlayContainerPadding = EdgeInsets.symmetric(vertical: 12);
|
||||
const overlayContainerMaxWidth = 760.0;
|
||||
const overlayContainerMinWidth = 320.0;
|
||||
|
||||
@ -25,6 +25,7 @@ class FlowyDialog extends StatelessWidget {
|
||||
final windowSize = MediaQuery.of(context).size;
|
||||
final size = windowSize * 0.7;
|
||||
return SimpleDialog(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: title,
|
||||
shape: shape ??
|
||||
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
@ -32,7 +33,6 @@ class FlowyDialog extends StatelessWidget {
|
||||
Material(
|
||||
type: MaterialType.transparency,
|
||||
child: Container(
|
||||
padding: padding,
|
||||
height: size.height,
|
||||
width: max(min(size.width, overlayContainerMaxWidth),
|
||||
overlayContainerMinWidth),
|
||||
|
Loading…
Reference in New Issue
Block a user