瀏覽代碼

feat: testing overlay notification

Sean Riley Hawkins 2 年之前
父節點
當前提交
41f2ad09dd

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

@@ -3,6 +3,7 @@ import 'dart:io';
 import 'package:app_flowy/startup/startup.dart';
 import 'package:app_flowy/workspace/application/doc/share_service.dart';
 import 'package:app_flowy/workspace/application/markdown/delta_markdown.dart';
+import 'package:app_flowy/workspace/presentation/widgets/dialogs.dart';
 import 'package:flowy_sdk/protobuf/flowy-text-block/entities.pb.dart';
 import 'package:flowy_sdk/protobuf/flowy-folder-data-model/view.pb.dart';
 import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
@@ -34,6 +35,8 @@ class DocShareBloc extends Bloc<DocShareEvent, DocShareState> {
     });
   }
 
+  bool checkFile = false;
+
   ExportData _convertDeltaToMarkdown(ExportData value) {
     final result = deltaToMarkdown(value.data);
     value.data = result;
@@ -61,11 +64,16 @@ 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);
   }
 }

+ 25 - 0
frontend/app_flowy/lib/workspace/presentation/widgets/dialogs.dart

@@ -14,6 +14,7 @@ import 'package:flowy_infra_ui/widget/dialog/styled_dialogs.dart';
 import 'package:textstyle_extensions/textstyle_extensions.dart';
 export 'package:flowy_infra_ui/widget/dialog/styled_dialogs.dart';
 import 'package:app_flowy/generated/locale_keys.g.dart';
+import 'package:overlay_support/overlay_support.dart';
 
 class TextFieldDialog extends StatefulWidget {
   final String value;
@@ -219,3 +220,27 @@ class OkCancelButton extends StatelessWidget {
     );
   }
 }
+
+class BubbleNotification extends StatelessWidget {
+  final String msgTitle;
+  final String msgBody;
+
+  const BubbleNotification({Key? key, required this.msgTitle, required this.msgBody}) : super(key: key);
+
+  @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')
+        ));
+  }
+}