1- import 'package:app_flowy/startup/startup.dart' ;
21import 'package:app_flowy/startup/tasks/rust_sdk.dart' ;
2+ import 'package:app_flowy/workspace/presentation/home/toast.dart' ;
33import 'package:app_flowy/workspace/presentation/widgets/pop_up_action.dart' ;
44import 'package:easy_localization/easy_localization.dart' ;
55import 'package:flowy_infra/theme.dart' ;
@@ -16,7 +16,6 @@ import 'package:package_info_plus/package_info_plus.dart';
1616import 'package:url_launcher/url_launcher.dart' ;
1717import 'package:app_flowy/generated/locale_keys.g.dart' ;
1818import 'package:device_info_plus/device_info_plus.dart' ;
19- import 'package:fluttertoast/fluttertoast.dart' ;
2019
2120class QuestionBubble extends StatelessWidget {
2221 const QuestionBubble ({Key ? key}) : super (key: key);
@@ -46,7 +45,7 @@ class QuestionBubble extends StatelessWidget {
4645 _launchURL ("https://discord.gg/9Q2xaN37tV" );
4746 break ;
4847 case BubbleAction .debug:
49- const _DebugToast ().show ();
48+ _DebugToast ().show ();
5049 break ;
5150 }
5251 });
@@ -71,55 +70,14 @@ class QuestionBubble extends StatelessWidget {
7170 }
7271}
7372
74- class _DebugToast extends StatelessWidget {
75- const _DebugToast ({Key ? key}) : super (key: key);
73+ class _DebugToast {
74+ void show () async {
75+ var debugInfo = "" ;
76+ debugInfo += await _getDeviceInfo ();
77+ debugInfo += await _getDocumentPath ();
78+ Clipboard .setData (ClipboardData (text: debugInfo));
7679
77- @override
78- Widget build (BuildContext context) {
79- return FutureBuilder (
80- future: Future (() async {
81- var debugInfo = "" ;
82- debugInfo += await _getDeviceInfo ();
83- debugInfo += await _getDocumentPath ();
84-
85- Clipboard .setData (ClipboardData (text: debugInfo));
86- }),
87- builder: (BuildContext context, AsyncSnapshot <void > snapshot) {
88- if (snapshot.connectionState == ConnectionState .done) {
89- if (snapshot.hasError) {
90- return _done (context, Text ("Error: ${snapshot .error }" ));
91- } else {
92- return _done (context, null );
93- }
94- } else {
95- return const CircularProgressIndicator ();
96- }
97- },
98- );
99- }
100-
101- Widget _done (BuildContext context, Widget ? error) {
102- final theme = context.watch <AppTheme >();
103- return Container (
104- padding: const EdgeInsets .symmetric (horizontal: 24.0 , vertical: 12.0 ),
105- decoration: BoxDecoration (borderRadius: BorderRadius .circular (25.0 ), color: theme.main1),
106- child: Row (
107- mainAxisSize: MainAxisSize .min,
108- children: [
109- const Icon (Icons .check),
110- const SizedBox (width: 12.0 ),
111- (error == null ) ? Text (LocaleKeys .questionBubble_debug_success.tr ()) : error
112- ],
113- ),
114- );
115- }
116-
117- void show () {
118- getIt <FToast >().showToast (
119- child: this ,
120- gravity: ToastGravity .BOTTOM ,
121- toastDuration: const Duration (seconds: 3 ),
122- );
80+ showMessageToast (LocaleKeys .questionBubble_debug_success.tr ());
12381 }
12482
12583 Future <String > _getDeviceInfo () async {
0 commit comments