diff --git a/lib/main.dart b/lib/main.dart index 6528de4..c60fe0c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:flu_console/flu_console.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:get_storage/get_storage.dart'; @@ -26,7 +27,9 @@ void main() async { fenix: true, ); - runApp(const MainApp()); + FluConsole.run(() { + runApp(const MainApp()); + }); } class MainApp extends StatelessWidget { diff --git a/lib/pages/home_panels/settings_panel.dart b/lib/pages/home_panels/settings_panel.dart index 687b730..2f2265a 100644 --- a/lib/pages/home_panels/settings_panel.dart +++ b/lib/pages/home_panels/settings_panel.dart @@ -1,5 +1,10 @@ +import 'package:flutter/services.dart'; +import 'package:flu_console/flu_console.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; +import 'package:styled_widget/styled_widget.dart'; +import 'package:tuuli_app/api_controller.dart'; +import 'package:tuuli_app/pages/home_page.dart'; class SettingsPanel extends StatefulWidget { const SettingsPanel({super.key}); @@ -16,21 +21,53 @@ class _SettingsPanelState extends State { @override Widget build(BuildContext context) { - return SingleChildScrollView( - child: IntrinsicHeight( - child: _buildBody(), - ), - ); - } - - Widget _buildBody() { return Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text( - 'Settings', - style: Theme.of(context).textTheme.headlineSmall, - ), + const Text("Current user access token:") + .textStyle(Get.textTheme.bodySmall!), + [ + Text(ApiController.to.token) + .textStyle(Get.textTheme.titleSmall!) + .expanded(), + IconButton( + onPressed: () async { + await Clipboard.setData( + ClipboardData(text: ApiController.to.token), + ); + Get.snackbar( + "Copied", + "Token copied to clipboard", + snackPosition: SnackPosition.BOTTOM, + ); + }, + icon: const Icon(Icons.copy), + ), + ].toRow(), + const SizedBox(height: 16), + [ + TextFormField( + enabled: false, + decoration: const InputDecoration( + labelText: 'Endpoint', + hintText: 'Enter Tuuli Endpoint', + ), + initialValue: ApiController.to.endPoint, + ).expanded(), + ElevatedButton( + onPressed: () => Get.find().logout(), + child: const Text("Logout to change"), + ) + ].toRow(), + const SizedBox(height: 16), + [ + ElevatedButton( + onPressed: () => Get.bottomSheet(const LogPrintPanel()), + child: const Text("Show app logs"), + ).expanded(), + ].toRow(), ], - ); + ).paddingAll(8); } } diff --git a/pubspec.lock b/pubspec.lock index 860577d..8d31f21 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -305,6 +305,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" + flu_console: + dependency: "direct main" + description: + name: flu_console + sha256: a6d9c70366fffd69c69f486677f86ec290dd72ca7cb1110271d6ddeda51ca769 + url: "https://pub.dev" + source: hosted + version: "0.0.1" flutter: dependency: "direct main" description: flutter @@ -472,6 +480,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.0.1" + logger: + dependency: transitive + description: + name: logger + sha256: db2ff852ed77090ba9f62d3611e4208a3d11dfa35991a81ae724c113fcb3e3f7 + url: "https://pub.dev" + source: hosted + version: "1.3.0" logging: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 79c95a6..0d7f7de 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -17,6 +17,7 @@ dependencies: data_table_2: ^2.4.2 dio: ^5.1.1 file_icon: ^1.0.0 + flu_console: ^0.0.1 flutter_chips_input: ^2.0.0 flutter_fast_forms: ^10.0.0 get: ^4.6.5 diff --git a/windows/flutter/generated_plugin_registrant.cc b/windows/flutter/generated_plugin_registrant.cc index 842ecd9..55d09f8 100644 --- a/windows/flutter/generated_plugin_registrant.cc +++ b/windows/flutter/generated_plugin_registrant.cc @@ -7,12 +7,15 @@ #include "generated_plugin_registrant.h" #include +#include #include #include void RegisterPlugins(flutter::PluginRegistry* registry) { AudioplayersWindowsPluginRegisterWithRegistrar( registry->GetRegistrarForPlugin("AudioplayersWindowsPlugin")); + FluConsolePluginCApiRegisterWithRegistrar( + registry->GetRegistrarForPlugin("FluConsolePluginCApi")); IrondashEngineContextPluginCApiRegisterWithRegistrar( registry->GetRegistrarForPlugin("IrondashEngineContextPluginCApi")); SuperNativeExtensionsPluginCApiRegisterWithRegistrar( diff --git a/windows/flutter/generated_plugins.cmake b/windows/flutter/generated_plugins.cmake index a6bba34..218809d 100644 --- a/windows/flutter/generated_plugins.cmake +++ b/windows/flutter/generated_plugins.cmake @@ -4,6 +4,7 @@ list(APPEND FLUTTER_PLUGIN_LIST audioplayers_windows + flu_console irondash_engine_context super_native_extensions )