|
@@ -1,3 +1,4 @@
|
|
|
|
+import 'package:app_flowy/startup/tasks/rust_sdk.dart';
|
|
import 'package:app_flowy/workspace/presentation/home/home_stack.dart';
|
|
import 'package:app_flowy/workspace/presentation/home/home_stack.dart';
|
|
import 'package:app_flowy/workspace/presentation/widgets/pop_up_action.dart';
|
|
import 'package:app_flowy/workspace/presentation/widgets/pop_up_action.dart';
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:easy_localization/easy_localization.dart';
|
|
@@ -6,7 +7,6 @@ import 'package:flowy_infra_ui/flowy_infra_ui.dart';
|
|
import 'package:flowy_infra_ui/style_widget/button.dart';
|
|
import 'package:flowy_infra_ui/style_widget/button.dart';
|
|
import 'package:flowy_infra_ui/style_widget/text.dart';
|
|
import 'package:flowy_infra_ui/style_widget/text.dart';
|
|
import 'package:flowy_infra_ui/widget/spacing.dart';
|
|
import 'package:flowy_infra_ui/widget/spacing.dart';
|
|
-import 'package:flowy_sdk/log.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:flutter/services.dart';
|
|
import 'package:provider/provider.dart';
|
|
import 'package:provider/provider.dart';
|
|
@@ -46,67 +46,7 @@ class QuestionBubble extends StatelessWidget {
|
|
_launchURL("https://discord.gg/9Q2xaN37tV");
|
|
_launchURL("https://discord.gg/9Q2xaN37tV");
|
|
break;
|
|
break;
|
|
case BubbleAction.debug:
|
|
case BubbleAction.debug:
|
|
- final deviceInfoPlugin = DeviceInfoPlugin();
|
|
|
|
- final deviceInfo = deviceInfoPlugin.deviceInfo;
|
|
|
|
-
|
|
|
|
- deviceInfo.then((info) {
|
|
|
|
- var debugText = "";
|
|
|
|
- info.toMap().forEach((key, value) {
|
|
|
|
- debugText = debugText + "$key: $value\n";
|
|
|
|
- });
|
|
|
|
-
|
|
|
|
- Clipboard.setData(ClipboardData(text: debugText));
|
|
|
|
-
|
|
|
|
- Widget toast = Container(
|
|
|
|
- padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
|
|
|
|
- decoration: BoxDecoration(
|
|
|
|
- borderRadius: BorderRadius.circular(25.0),
|
|
|
|
- color: theme.main1,
|
|
|
|
- ),
|
|
|
|
- child: Row(
|
|
|
|
- mainAxisSize: MainAxisSize.min,
|
|
|
|
- children: [
|
|
|
|
- const Icon(Icons.check),
|
|
|
|
- const SizedBox(
|
|
|
|
- width: 12.0,
|
|
|
|
- ),
|
|
|
|
- Text(LocaleKeys.questionBubble_debug_success.tr()),
|
|
|
|
- ],
|
|
|
|
- ),
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- fToast.showToast(
|
|
|
|
- child: toast,
|
|
|
|
- gravity: ToastGravity.BOTTOM,
|
|
|
|
- toastDuration: const Duration(seconds: 3),
|
|
|
|
- );
|
|
|
|
- }).catchError((error) {
|
|
|
|
- Log.info("Debug info has not yet been implemented on this platform");
|
|
|
|
-
|
|
|
|
- Widget toast = Container(
|
|
|
|
- padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
|
|
|
|
- decoration: BoxDecoration(
|
|
|
|
- borderRadius: BorderRadius.circular(25.0),
|
|
|
|
- color: Colors.red,
|
|
|
|
- ),
|
|
|
|
- child: Row(
|
|
|
|
- mainAxisSize: MainAxisSize.min,
|
|
|
|
- children: [
|
|
|
|
- const Icon(Icons.close),
|
|
|
|
- const SizedBox(
|
|
|
|
- width: 12.0,
|
|
|
|
- ),
|
|
|
|
- Text(LocaleKeys.questionBubble_debug_fail.tr()),
|
|
|
|
- ],
|
|
|
|
- ),
|
|
|
|
- );
|
|
|
|
-
|
|
|
|
- fToast.showToast(
|
|
|
|
- child: toast,
|
|
|
|
- gravity: ToastGravity.BOTTOM,
|
|
|
|
- toastDuration: const Duration(seconds: 3),
|
|
|
|
- );
|
|
|
|
- }, test: (e) => e is UnimplementedError);
|
|
|
|
|
|
+ const _DebugToast().show();
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -130,6 +70,78 @@ class QuestionBubble extends StatelessWidget {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+class _DebugToast extends StatelessWidget {
|
|
|
|
+ const _DebugToast({Key? key}) : super(key: key);
|
|
|
|
+
|
|
|
|
+ @override
|
|
|
|
+ Widget build(BuildContext context) {
|
|
|
|
+ return FutureBuilder(
|
|
|
|
+ future: Future(() async {
|
|
|
|
+ var debugInfo = "";
|
|
|
|
+ debugInfo += await _getDeviceInfo();
|
|
|
|
+ debugInfo += await _getDocumentPath();
|
|
|
|
+
|
|
|
|
+ Clipboard.setData(ClipboardData(text: debugInfo));
|
|
|
|
+ }),
|
|
|
|
+ builder: (BuildContext context, AsyncSnapshot<void> snapshot) {
|
|
|
|
+ if (snapshot.connectionState == ConnectionState.done) {
|
|
|
|
+ if (snapshot.hasError) {
|
|
|
|
+ return _done(context, Text("Error: ${snapshot.error}"));
|
|
|
|
+ } else {
|
|
|
|
+ return _done(context, null);
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ return const CircularProgressIndicator();
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Widget _done(BuildContext context, Widget? error) {
|
|
|
|
+ final theme = context.watch<AppTheme>();
|
|
|
|
+ return Container(
|
|
|
|
+ padding: const EdgeInsets.symmetric(horizontal: 24.0, vertical: 12.0),
|
|
|
|
+ decoration: BoxDecoration(borderRadius: BorderRadius.circular(25.0), color: theme.main1),
|
|
|
|
+ child: Row(
|
|
|
|
+ mainAxisSize: MainAxisSize.min,
|
|
|
|
+ children: [
|
|
|
|
+ const Icon(Icons.check),
|
|
|
|
+ const SizedBox(width: 12.0),
|
|
|
|
+ (error == null) ? Text(LocaleKeys.questionBubble_debug_success.tr()) : error
|
|
|
|
+ ],
|
|
|
|
+ ),
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ void show() {
|
|
|
|
+ fToast.showToast(
|
|
|
|
+ child: this,
|
|
|
|
+ gravity: ToastGravity.BOTTOM,
|
|
|
|
+ toastDuration: const Duration(seconds: 3),
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Future<String> _getDeviceInfo() async {
|
|
|
|
+ final deviceInfoPlugin = DeviceInfoPlugin();
|
|
|
|
+ final deviceInfo = deviceInfoPlugin.deviceInfo;
|
|
|
|
+
|
|
|
|
+ return deviceInfo.then((info) {
|
|
|
|
+ var debugText = "";
|
|
|
|
+ info.toMap().forEach((key, value) {
|
|
|
|
+ debugText = debugText + "$key: $value\n";
|
|
|
|
+ });
|
|
|
|
+ return debugText;
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Future<String> _getDocumentPath() async {
|
|
|
|
+ return appFlowyDocumentDirectory().then((directory) {
|
|
|
|
+ final path = directory.path.toString();
|
|
|
|
+ return "Document: $path\n";
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
class QuestionBubbleActionSheet with ActionList<BubbleActionWrapper>, FlowyOverlayDelegate {
|
|
class QuestionBubbleActionSheet with ActionList<BubbleActionWrapper>, FlowyOverlayDelegate {
|
|
final Function(dartz.Option<BubbleAction>) onSelected;
|
|
final Function(dartz.Option<BubbleAction>) onSelected;
|
|
final _items = BubbleAction.values.map((action) => BubbleActionWrapper(action)).toList();
|
|
final _items = BubbleAction.values.map((action) => BubbleActionWrapper(action)).toList();
|