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) {
|
||||
final result = deltaToMarkdown(value.data);
|
||||
value.data = result;
|
||||
@ -64,16 +62,11 @@ class DocShareBloc extends Bloc<DocShareEvent, DocShareState> {
|
||||
|
||||
Future<File> get _localFile async {
|
||||
final path = await _localPath;
|
||||
checkFile = true;
|
||||
return File('$path/${view.name}.md');
|
||||
}
|
||||
|
||||
Future<File> writeFile(String md) async {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -179,6 +179,10 @@ class DocumentShareButton extends StatelessWidget {
|
||||
switch (action) {
|
||||
case ShareAction.markdown:
|
||||
context.read<DocShareBloc>().add(const DocShareEvent.shareMarkdown());
|
||||
BubbleNotification(
|
||||
msgTitle: 'Exported Complete ^_^',
|
||||
msgBody: "Check in the flowy folder inside your documents directory")
|
||||
.show(context);
|
||||
break;
|
||||
case ShareAction.copyLink:
|
||||
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 msgBody;
|
||||
|
||||
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
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: SafeArea(
|
||||
child: ListTile(
|
||||
leading: SizedBox.fromSize(
|
||||
size: const Size(40, 40),
|
||||
// child: ClipOval(child: )
|
||||
),
|
||||
title: Text(msgTitle),
|
||||
subtitle: Text(msgBody),
|
||||
),
|
||||
// title: Text('Action')
|
||||
));
|
||||
return StyledDialog(
|
||||
// maxWidth: 800,
|
||||
maxHeight: 200,
|
||||
shrinkWrap: true,
|
||||
child: Card(
|
||||
margin: const EdgeInsets.symmetric(horizontal: 4),
|
||||
child: SafeArea(
|
||||
child: ListTile(
|
||||
leading: SizedBox.fromSize(
|
||||
size: const Size(40, 40),
|
||||
child: ClipOval(
|
||||
child: Icon(Icons.file_copy),
|
||||
),
|
||||
),
|
||||
title: Text(widget.msgTitle),
|
||||
subtitle: Text(widget.msgBody),
|
||||
),
|
||||
)));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user