1- import 'package:appflowy/core/helpers/url_launcher.dart' ;
21import 'package:appflowy/generated/flowy_svgs.g.dart' ;
32import 'package:appflowy/generated/locale_keys.g.dart' ;
4- import 'package:appflowy/workspace/application/settings/ai/download_offline_ai_app_bloc.dart' ;
53import 'package:appflowy/workspace/application/settings/ai/plugin_state_bloc.dart' ;
64import 'package:appflowy/workspace/presentation/settings/pages/setting_ai_view/init_local_ai.dart' ;
75import 'package:easy_localization/easy_localization.dart' ;
8- import 'package:flowy_infra/size.dart' ;
96import 'package:flowy_infra_ui/style_widget/button.dart' ;
107import 'package:flowy_infra_ui/style_widget/text.dart' ;
118import 'package:flowy_infra_ui/widget/spacing.dart' ;
12- import 'package:flutter/gestures.dart' ;
139import 'package:flutter/material.dart' ;
1410import 'package:flutter_bloc/flutter_bloc.dart' ;
1511
@@ -27,7 +23,7 @@ class PluginStateIndicator extends StatelessWidget {
2723 unknown: () => const SizedBox .shrink (),
2824 readToRun: () => const _PrepareRunning (),
2925 initializingPlugin: () => const InitLocalAIIndicator (),
30- running: () => const _LocalAIRunning (),
26+ running: (version ) => _LocalAIRunning (version : version ),
3127 restartPlugin: () => const _RestartPluginButton (),
3228 lackOfResource: (desc) => _LackOfResource (desc: desc),
3329 );
@@ -88,7 +84,9 @@ class _RestartPluginButton extends StatelessWidget {
8884}
8985
9086class _LocalAIRunning extends StatelessWidget {
91- const _LocalAIRunning ();
87+ const _LocalAIRunning ({required this .version});
88+
89+ final String version;
9290
9391 @override
9492 Widget build (BuildContext context) {
@@ -115,7 +113,11 @@ class _LocalAIRunning extends StatelessWidget {
115113 const HSpace (6 ),
116114 Flexible (
117115 child: FlowyText (
118- LocaleKeys .settings_aiPage_keys_localAIRunning.tr (),
116+ LocaleKeys .settings_aiPage_keys_localAIRunning.tr (
117+ args: [
118+ version,
119+ ],
120+ ),
119121 fontSize: 11 ,
120122 color: const Color (0xFF1E4620 ),
121123 maxLines: 3 ,
@@ -131,95 +133,6 @@ class _LocalAIRunning extends StatelessWidget {
131133 }
132134}
133135
134- class OpenOrDownloadOfflineAIApp extends StatelessWidget {
135- const OpenOrDownloadOfflineAIApp ({required this .onRetry, super .key});
136-
137- final VoidCallback onRetry;
138-
139- @override
140- Widget build (BuildContext context) {
141- return BlocProvider (
142- create: (context) => DownloadOfflineAIBloc (),
143- child: BlocBuilder <DownloadOfflineAIBloc , DownloadOfflineAIState >(
144- builder: (context, state) {
145- return Column (
146- crossAxisAlignment: CrossAxisAlignment .start,
147- children: [
148- RichText (
149- maxLines: 3 ,
150- textAlign: TextAlign .left,
151- text: TextSpan (
152- children: < TextSpan > [
153- TextSpan (
154- text:
155- "${LocaleKeys .settings_aiPage_keys_offlineAIInstruction1 .tr ()} " ,
156- style: Theme .of (context)
157- .textTheme
158- .bodySmall!
159- .copyWith (height: 1.5 ),
160- ),
161- TextSpan (
162- text:
163- " ${LocaleKeys .settings_aiPage_keys_offlineAIInstruction2 .tr ()} " ,
164- style: Theme .of (context).textTheme.bodyMedium! .copyWith (
165- fontSize: FontSizes .s14,
166- color: Theme .of (context).colorScheme.primary,
167- height: 1.5 ,
168- ),
169- recognizer: TapGestureRecognizer ()
170- ..onTap = () => afLaunchUrlString (
171- "https://docs.appflowy.io/docs/appflowy/product/appflowy-ai-offline" ,
172- ),
173- ),
174- TextSpan (
175- text:
176- " ${LocaleKeys .settings_aiPage_keys_offlineAIInstruction3 .tr ()} " ,
177- style: Theme .of (context)
178- .textTheme
179- .bodySmall!
180- .copyWith (height: 1.5 ),
181- ),
182- TextSpan (
183- text:
184- "${LocaleKeys .settings_aiPage_keys_offlineAIDownload1 .tr ()} " ,
185- style: Theme .of (context)
186- .textTheme
187- .bodySmall!
188- .copyWith (height: 1.5 ),
189- ),
190- TextSpan (
191- text:
192- " ${LocaleKeys .settings_aiPage_keys_offlineAIDownload2 .tr ()} " ,
193- style: Theme .of (context).textTheme.bodyMedium! .copyWith (
194- fontSize: FontSizes .s14,
195- color: Theme .of (context).colorScheme.primary,
196- height: 1.5 ,
197- ),
198- recognizer: TapGestureRecognizer ()
199- ..onTap =
200- () => context.read <DownloadOfflineAIBloc >().add (
201- const DownloadOfflineAIEvent .started (),
202- ),
203- ),
204- TextSpan (
205- text:
206- " ${LocaleKeys .settings_aiPage_keys_offlineAIDownload3 .tr ()} " ,
207- style: Theme .of (context)
208- .textTheme
209- .bodySmall!
210- .copyWith (height: 1.5 ),
211- ),
212- ],
213- ),
214- ),
215- ],
216- );
217- },
218- ),
219- );
220- }
221- }
222-
223136class _LackOfResource extends StatelessWidget {
224137 const _LackOfResource ({required this .desc});
225138
0 commit comments