Skip to content

Commit

Permalink
next
Browse files Browse the repository at this point in the history
  • Loading branch information
leoafarias committed Aug 13, 2024
1 parent 79b71a3 commit 18bd80a
Show file tree
Hide file tree
Showing 23 changed files with 731 additions and 46 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 0 additions & 5 deletions packages/superdeck/example/.superdeck/slides.json
Original file line number Diff line number Diff line change
Expand Up @@ -134,11 +134,6 @@
}
],
"assets": [
{
"path": ".superdeck/generated/thumbnail_HR8xUsF0.png",
"width": 512,
"height": 288
},
{
"path": ".superdeck/generated/thumbnail_RiJb4GGG.png",
"width": 512,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "generated_plugin_registrant.h"

#include <file_saver/file_saver_plugin.h>
#include <file_selector_linux/file_selector_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
#include <window_manager/window_manager_plugin.h>
Expand All @@ -15,6 +16,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) file_saver_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSaverPlugin");
file_saver_plugin_register_with_registrar(file_saver_registrar);
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

list(APPEND FLUTTER_PLUGIN_LIST
file_saver
file_selector_linux
screen_retriever
url_launcher_linux
window_manager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import FlutterMacOS
import Foundation

import file_saver
import file_selector_macos
import path_provider_foundation
import screen_retriever
import sqflite
Expand All @@ -14,6 +15,7 @@ import window_manager

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FileSaverPlugin.register(with: registry.registrar(forPlugin: "FileSaverPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
ScreenRetrieverPlugin.register(with: registry.registrar(forPlugin: "ScreenRetrieverPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
Expand Down
6 changes: 6 additions & 0 deletions packages/superdeck/example/macos/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
PODS:
- file_saver (0.0.1):
- FlutterMacOS
- file_selector_macos (0.0.1):
- FlutterMacOS
- FlutterMacOS (1.0.0)
- path_provider_foundation (0.0.1):
- Flutter
Expand All @@ -17,6 +19,7 @@ PODS:

DEPENDENCIES:
- file_saver (from `Flutter/ephemeral/.symlinks/plugins/file_saver/macos`)
- file_selector_macos (from `Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos`)
- FlutterMacOS (from `Flutter/ephemeral`)
- path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`)
- screen_retriever (from `Flutter/ephemeral/.symlinks/plugins/screen_retriever/macos`)
Expand All @@ -27,6 +30,8 @@ DEPENDENCIES:
EXTERNAL SOURCES:
file_saver:
:path: Flutter/ephemeral/.symlinks/plugins/file_saver/macos
file_selector_macos:
:path: Flutter/ephemeral/.symlinks/plugins/file_selector_macos/macos
FlutterMacOS:
:path: Flutter/ephemeral
path_provider_foundation:
Expand All @@ -42,6 +47,7 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
file_saver: 44e6fbf666677faf097302460e214e977fdd977b
file_selector_macos: 54fdab7caa3ac3fc43c9fac4d7d8d231277f8cf2
FlutterMacOS: 8f6f14fa908a6fb3fba0cd85dbd81ec4b251fb24
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
screen_retriever: 59634572a57080243dd1bf715e55b6c54f241a38
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,16 @@
#include "generated_plugin_registrant.h"

#include <file_saver/file_saver_plugin.h>
#include <file_selector_windows/file_selector_windows.h>
#include <screen_retriever/screen_retriever_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>
#include <window_manager/window_manager_plugin.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
FileSaverPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSaverPlugin"));
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
ScreenRetrieverPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("ScreenRetrieverPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

list(APPEND FLUTTER_PLUGIN_LIST
file_saver
file_selector_windows
screen_retriever
url_launcher_windows
window_manager
Expand Down
113 changes: 113 additions & 0 deletions packages/superdeck/lib/chat/chat_theme.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
import 'package:flutter/material.dart';
import 'package:flutter_chat_ui/flutter_chat_ui.dart';

import '../helpers/extensions.dart';

final _baseTheme = DarkChatTheme();

ChatTheme buildChatTheme(BuildContext context) {
return DarkChatTheme(
backgroundColor: context.colorScheme.surface,
inputSurfaceTintColor: Colors.black,
dateDividerTextStyle: TextStyle(
color: context.colorScheme.onSurface,
fontSize: 12,
fontWeight: FontWeight.w800,
height: 1.333,
),
emptyChatPlaceholderTextStyle: TextStyle(
color: context.colorScheme.onSurface.withOpacity(0.6),
fontSize: 16,
fontWeight: FontWeight.w500,
height: 1.5,
),
errorColor: context.colorScheme.error,
inputBackgroundColor: Colors.black,
inputBorderRadius: BorderRadius.zero,
inputTextColor: context.colorScheme.onSurface,
primaryColor: context.colorScheme.primary,
receivedMessageBodyTextStyle: TextStyle(
color: context.colorScheme.onSecondary,
fontSize: 16,
fontWeight: FontWeight.w500,
height: 1.5,
),
receivedMessageCaptionTextStyle: TextStyle(
color: context.colorScheme.onSecondary.withOpacity(0.6),
fontSize: 12,
fontWeight: FontWeight.w500,
height: 1.333,
),
receivedMessageDocumentIconColor: context.colorScheme.primary,
receivedMessageLinkDescriptionTextStyle: TextStyle(
color: context.colorScheme.onSecondary,
fontSize: 14,
fontWeight: FontWeight.w400,
height: 1.428,
),
receivedMessageLinkTitleTextStyle: TextStyle(
color: context.colorScheme.onSecondary,
fontSize: 16,
fontWeight: FontWeight.w800,
height: 1.375,
),
secondaryColor: context.colorScheme.secondary,
sentMessageBodyTextStyle: TextStyle(
color: context.colorScheme.onPrimary,
fontSize: 16,
fontWeight: FontWeight.w500,
height: 1.5,
),
sentMessageCaptionTextStyle: TextStyle(
color: context.colorScheme.onPrimary.withOpacity(0.6),
fontSize: 12,
fontWeight: FontWeight.w500,
height: 1.333,
),
sentMessageDocumentIconColor: context.colorScheme.onPrimary,
sentMessageLinkDescriptionTextStyle: TextStyle(
color: context.colorScheme.onPrimary,
fontSize: 14,
fontWeight: FontWeight.w400,
height: 1.428,
),
sentMessageLinkTitleTextStyle: TextStyle(
color: context.colorScheme.onPrimary,
fontSize: 16,
fontWeight: FontWeight.w800,
height: 1.375,
),
// systemMessageTheme: SystemMessageTheme(
// textStyle: TextStyle(
// color: context.colorScheme.onSurface,
// fontSize: 12,
// fontWeight: FontWeight.w800,
// height: 1.333,
// ),
// ),
// typingIndicatorTheme: TypingIndicatorTheme(
// animatedCirclesColor: context.colorScheme.onSurface,
// bubbleColor: context.colorScheme.surface,
// countTextColor: context.colorScheme.onPrimary,
// animatedCircleSize: _baseTheme.typingIndicatorTheme.animatedCircleSize,
// bubbleBorder: _baseTheme.typingIndicatorTheme.bubbleBorder,
// countAvatarColor: context.colorScheme.primary,
// multipleUserTextStyle: context.textTheme.bodySmall!,
// ),
unreadHeaderTheme: UnreadHeaderTheme(
color: context.colorScheme.secondary,
textStyle: TextStyle(
color: context.colorScheme.onSecondary.withOpacity(0.6),
fontSize: 12,
fontWeight: FontWeight.w500,
height: 1.333,
),
),
userAvatarTextStyle: TextStyle(
color: context.colorScheme.onPrimary,
fontSize: 12,
fontWeight: FontWeight.w800,
height: 1.333,
),
);
}
66 changes: 66 additions & 0 deletions packages/superdeck/lib/chat/components/typing_indicator.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import 'dart:async';

import 'package:flutter/material.dart';

class WaitingIndicator extends StatefulWidget {
final bool isTyping;

const WaitingIndicator({Key? key, required this.isTyping}) : super(key: key);

@override
State createState() => _WaitingIndicatorState();
}

class _WaitingIndicatorState extends State<WaitingIndicator> {
late Timer _timer;
final List<double> _dotSizes = [6, 8, 10];

@override
void initState() {
super.initState();
_startTimer();
}

@override
void dispose() {
_stopTimer();
super.dispose();
}

void _startTimer() {
_timer = Timer.periodic(const Duration(milliseconds: 500), (_) {
setState(() {
_dotSizes.insert(0, _dotSizes.removeLast());
});
});
}

void _stopTimer() {
_timer.cancel();
}

@override
Widget build(BuildContext context) {
return widget.isTyping
? Row(
mainAxisSize: MainAxisSize.min,
children: [
for (final size in _dotSizes)
Padding(
padding: const EdgeInsets.only(right: 4),
child: AnimatedContainer(
duration: const Duration(milliseconds: 500),
curve: Curves.easeInOut,
height: size,
width: size,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Colors.grey[400],
),
),
),
],
)
: const SizedBox.shrink();
}
}
64 changes: 64 additions & 0 deletions packages/superdeck/lib/chat/prompt.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
final presentationAssistantPrompt = '''
**CONTEXT:**
You are a markdown presentation assistance bot designed to help users create, refine, and optimize markdown-based slides. Users often use frontmatter to define styles, layouts, and various options within their presentations. Your task is to assist in adjusting these elements to improve the overall presentation while providing feedback and suggestions on specific slide numbers.
**OBJECTIVE:**
To guide users in enhancing their markdown presentations by suggesting improvements to the structure, layout, and style. When proposing changes, you should clearly reference the slide number where the change is suggested. Additionally, ensure that the user is aware of available frontmatter options that can be utilized for better customization.
**STYLE:**
Never change the frontmatter structure, or any of the image urls.
Always focus on one specific slide and fixes before moving to the next changes.
Provide feedback in a concise and instructional manner, ensuring that each suggestion is actionable. The feedback should focus on optimizing the presentation's readability, visual appeal, and effectiveness in conveying the intended message.
**TONE:**
Professional and supportive. Encourage the user by acknowledging their current efforts and offering constructive advice to elevate the presentation.
**AUDIENCE:**
The audience comprises users who are actively working on creating markdown-based presentations. They may have varying levels of experience with markdown and frontmatter customization, so explanations should be clear and accessible.
**REQUIRED FORMAT:**
The suggestions are always conversational, you should should not provide code snippets.
Feedback and suggestions should be provided as text responses within the markdown file or as separate comments. Each suggestion must include a reference to the specific slide number being discussed.
**STEP-BACK PROMPTING:**
Before making specific suggestions, review the overall structure and style of the presentation. Consider the flow and coherence of the slides, as well as the effective use of frontmatter for layout and style consistency. Are there opportunities to better utilize frontmatter options to enhance the presentation's impact?
**END RESULT PROMPTING:**
Envision the final version of the markdown presentation after all suggested changes have been implemented. Describe how the presentation has improved in terms of clarity, visual appeal, and audience engagement. What specific changes have made the most significant impact, and how does the presentation now meet the user's original goals?
''';

final provideMarkdownEdits = '''
CONTEXT:
You need a finalized Markdown document incorporating all feedback and ready for immediate use, without extra lines or spaces, or extra content in the response.
OBJECTIVE:
Deliver a fully edited, complete Markdown file, ready to save and use with no further adjustments.
STYLE:
Clear, concise, and well-structured, with a focus on precision.
TONE:
Professional and straightforward, reflecting previous feedback.
AUDIENCE:
Intended for immediate use by professionals needing the finalized content.
REQUIRED FORMAT:
A complete and polished Markdown file, ready for saving.
STEP-BACK PROMPTING:
Review the Markdown file to ensure all feedback is integrated and the content is complete and aligned with clarity goals.
END RESULT PROMPTING:
Envision saving the file as the final version, reflecting all edits and ready for immediate use with no further modifications needed.
''';
36 changes: 36 additions & 0 deletions packages/superdeck/lib/components/atoms/markdown_viewer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -192,3 +192,39 @@ class CodeElementBuilder extends MarkdownElementBuilder {
);
}
}

class SampleCodeElementBuilder extends MarkdownElementBuilder {
final MdCodeblockSpec? spec;
SampleCodeElementBuilder(this.spec);
@override
Widget? visitElementAfter(md.Element element, TextStyle? preferredStyle) {
var language = 'dart';

if (element.attributes['class'] != null) {
String lg = element.attributes['class'] as String;
language = lg.substring(9);
}
return Row(
children: [
Expanded(
child: Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.transparent,
borderRadius: BorderRadius.circular(8),
),
child: RichText(
text: TextSpan(
style: spec?.textStyle,
children: SyntaxHighlight.render(
element.textContent.trim(),
language,
),
),
),
),
),
],
);
}
}
Loading

0 comments on commit 18bd80a

Please sign in to comment.