Browse Source

feat: in app notification bubble

Sean Riley Hawkins 2 years ago
parent
commit
be103e02fa

+ 0 - 7
frontend/app_flowy/lib/workspace/application/doc/share_bloc.dart

@@ -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);
   }
 }

+ 4 - 0
frontend/app_flowy/lib/workspace/presentation/plugins/doc/document.dart

@@ -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);

+ 29 - 14
frontend/app_flowy/lib/workspace/presentation/widgets/dialogs.dart

@@ -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),
+              ),
+            )));
   }
 }