Skip to content

Commit

Permalink
Log panel
Browse files Browse the repository at this point in the history
  • Loading branch information
danemadsen committed Jun 19, 2024
1 parent 7ee9c40 commit 5e698b2
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
4 changes: 3 additions & 1 deletion lib/providers/desktop_navigator.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:maid/ui/desktop/settings_panels/app_settings_panel.dart';
import 'package:maid/ui/desktop/settings_panels/log_panel.dart';
import 'package:maid/ui/desktop/settings_panels/user_panel.dart';
import 'package:maid/ui/desktop/side_panels/characters_panel.dart';
import 'package:maid/ui/desktop/side_panels/model_settings_panel.dart';
Expand All @@ -23,7 +24,8 @@ class DesktopNavigator extends ChangeNotifier {

final Map<String, Widget Function(BuildContext)> _settingsPanelRoutes = {
"/user-settings": (context) => const UserPanel(),
"/settings": (context) => const AppSettingsPanel()
"/settings": (context) => const AppSettingsPanel(),
"/log": (context) => const LogPanel(),
};

bool get sidePanelOpen => _sidePanelOpen;
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/desktop/layout/side_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ class SideBar extends StatelessWidget {
return Column(
children: [
IconButton(
tooltip: 'Toggle Terminal',
tooltip: 'Toggle Log',
icon: const Icon(Icons.terminal_rounded),
onPressed: () {
DesktopNavigator.of(context).navigateSettingsPanel("/terminal");
DesktopNavigator.of(context).navigateSettingsPanel("/log");
},
),
IconButton(
Expand Down
33 changes: 33 additions & 0 deletions lib/ui/desktop/settings_panels/log_panel.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import 'package:flutter/material.dart';
import 'package:maid/providers/app_data.dart';
import 'package:maid/providers/app_preferences.dart';
import 'package:maid/providers/user.dart';
import 'package:maid/static/logger.dart';
import 'package:provider/provider.dart';

class LogPanel extends StatelessWidget {
const LogPanel({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
body: Consumer3<AppData, AppPreferences, User>(
builder: buildLog,
),
);
}

Widget buildLog(BuildContext context, AppData appData, AppPreferences appPreferences, User user, Widget? child) {
return Container(
padding: const EdgeInsets.all(8.0),
color: Colors.black,
child: SelectableText(
Logger.getLog,
style: const TextStyle(
color: Colors.white,
fontFamily: 'monospace',
),
)
);
}
}
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ packages:
path: "packages/maid_llm"
relative: true
source: path
version: "1.0.2"
version: "1.0.1"
matcher:
dependency: transitive
description:
Expand Down

0 comments on commit 5e698b2

Please sign in to comment.