mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: in app notification bubble
This commit is contained in:
parent
3c27108ec7
commit
be103e02fa
@ -35,8 +35,6 @@ class DocShareBloc extends Bloc<DocShareEvent, DocShareState> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool checkFile = false;
|
|
||||||
|
|
||||||
ExportData _convertDeltaToMarkdown(ExportData value) {
|
ExportData _convertDeltaToMarkdown(ExportData value) {
|
||||||
final result = deltaToMarkdown(value.data);
|
final result = deltaToMarkdown(value.data);
|
||||||
value.data = result;
|
value.data = result;
|
||||||
@ -64,16 +62,11 @@ class DocShareBloc extends Bloc<DocShareEvent, DocShareState> {
|
|||||||
|
|
||||||
Future<File> get _localFile async {
|
Future<File> get _localFile async {
|
||||||
final path = await _localPath;
|
final path = await _localPath;
|
||||||
checkFile = true;
|
|
||||||
return File('$path/${view.name}.md');
|
return File('$path/${view.name}.md');
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<File> writeFile(String md) async {
|
Future<File> writeFile(String md) async {
|
||||||
final file = await _localFile;
|
final file = await _localFile;
|
||||||
if (checkFile)
|
|
||||||
BubbleNotification(msgTitle: 'Export To Markdown', msgBody: 'File saved to $file');
|
|
||||||
else
|
|
||||||
BubbleNotification(msgTitle: 'Failed to write to file', msgBody: '$file');
|
|
||||||
return file.writeAsString(md);
|
return file.writeAsString(md);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,6 +179,10 @@ class DocumentShareButton extends StatelessWidget {
|
|||||||
switch (action) {
|
switch (action) {
|
||||||
case ShareAction.markdown:
|
case ShareAction.markdown:
|
||||||
context.read<DocShareBloc>().add(const DocShareEvent.shareMarkdown());
|
context.read<DocShareBloc>().add(const DocShareEvent.shareMarkdown());
|
||||||
|
BubbleNotification(
|
||||||
|
msgTitle: 'Exported Complete ^_^',
|
||||||
|
msgBody: "Check in the flowy folder inside your documents directory")
|
||||||
|
.show(context);
|
||||||
break;
|
break;
|
||||||
case ShareAction.copyLink:
|
case ShareAction.copyLink:
|
||||||
FlowyAlertDialog(title: LocaleKeys.shareAction_workInProgress.tr()).show(context);
|
FlowyAlertDialog(title: LocaleKeys.shareAction_workInProgress.tr()).show(context);
|
||||||
|
@ -221,26 +221,41 @@ class OkCancelButton extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class BubbleNotification extends StatelessWidget {
|
class BubbleNotification extends StatefulWidget {
|
||||||
final String msgTitle;
|
final String msgTitle;
|
||||||
final String msgBody;
|
final String msgBody;
|
||||||
|
|
||||||
const BubbleNotification({Key? key, required this.msgTitle, required this.msgBody}) : super(key: key);
|
const BubbleNotification({Key? key, required this.msgTitle, required this.msgBody}) : super(key: key);
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<BubbleNotification> createState() => _BubbleNotification();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _BubbleNotification extends State<BubbleNotification> {
|
||||||
|
@override
|
||||||
|
void initState() {
|
||||||
|
super.initState();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Card(
|
return StyledDialog(
|
||||||
|
// maxWidth: 800,
|
||||||
|
maxHeight: 200,
|
||||||
|
shrinkWrap: true,
|
||||||
|
child: Card(
|
||||||
margin: const EdgeInsets.symmetric(horizontal: 4),
|
margin: const EdgeInsets.symmetric(horizontal: 4),
|
||||||
child: SafeArea(
|
child: SafeArea(
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
leading: SizedBox.fromSize(
|
leading: SizedBox.fromSize(
|
||||||
size: const Size(40, 40),
|
size: const Size(40, 40),
|
||||||
// child: ClipOval(child: )
|
child: ClipOval(
|
||||||
|
child: Icon(Icons.file_copy),
|
||||||
),
|
),
|
||||||
title: Text(msgTitle),
|
|
||||||
subtitle: Text(msgBody),
|
|
||||||
),
|
),
|
||||||
// title: Text('Action')
|
title: Text(widget.msgTitle),
|
||||||
));
|
subtitle: Text(widget.msgBody),
|
||||||
|
),
|
||||||
|
)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user