From 4b44435ad2156242143a7e7ae9978c47fb120c5f Mon Sep 17 00:00:00 2001 From: slimpotatoboy Date: Fri, 19 May 2023 10:17:55 +0545 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Markdown=20Viewer=20added=20when?= =?UTF-8?q?=20opening=20a=20markdown=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/views/editor/code.dart | 30 ++++++++++++- macos/Podfile.lock | 2 +- pubspec.lock | 16 +++++++ pubspec.yaml | 86 +++++++++++++++----------------------- 4 files changed, 80 insertions(+), 54 deletions(-) diff --git a/lib/views/editor/code.dart b/lib/views/editor/code.dart index 20d5ae4..f13bc59 100644 --- a/lib/views/editor/code.dart +++ b/lib/views/editor/code.dart @@ -6,6 +6,7 @@ import 'package:code_text_field/code_text_field.dart' as lite; import 'package:flutter_code_editor/flutter_code_editor.dart'; import 'package:highlight/languages/dart.dart'; import 'package:quinine/keys/activators.dart'; +import 'package:flutter_markdown/flutter_markdown.dart'; import '../../hooks/code.dart'; import '../../intents/file.dart'; @@ -70,7 +71,34 @@ class CodeEditor extends HookConsumerWidget { codeController.setCursor(sourceFile.extentOffset); } - return getCodeEditor(ref, focusNode, codeController, codeStyle); + return Row( + children: [ + Expanded( + child: getCodeEditor(ref, focusNode, codeController, codeStyle), + ), + if (fileExtension == "md") + Expanded( + child: Container( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text( + "MarkDown Viewer", + style: TextStyle( + fontSize: 18, + fontWeight: FontWeight.w600, + ), + ), + Expanded( + child: Markdown(data: codeController.text), + ), + ], + ), + ), + ) + ], + ); }, loading: () => const Center( child: SizedBox(width: 72, child: LinearProgressIndicator())), diff --git a/macos/Podfile.lock b/macos/Podfile.lock index d20d81a..8ae972b 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -44,4 +44,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7 -COCOAPODS: 1.11.3 +COCOAPODS: 1.12.1 diff --git a/pubspec.lock b/pubspec.lock index f21b8aa..494a3f3 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -384,6 +384,14 @@ packages: description: flutter source: sdk version: "0.0.0" + flutter_markdown: + dependency: "direct main" + description: + name: flutter_markdown + sha256: "7b25c10de1fea883f3c4f9b8389506b54053cd00807beab69fd65c8653a2711f" + url: "https://pub.dev" + source: hosted + version: "0.6.14" flutter_plugin_android_lifecycle: dependency: transitive description: @@ -644,6 +652,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.1" + markdown: + dependency: transitive + description: + name: markdown + sha256: "8e332924094383133cee218b676871f42db2514f1f6ac617b6cf6152a7faab8e" + url: "https://pub.dev" + source: hosted + version: "7.1.0" matcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index a12004c..3cd5d8b 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: quinine description: A core IDE for Flutter development -publish_to: 'none' +publish_to: 'none' # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 @@ -15,77 +15,60 @@ environment: sdk: '>=2.19.6 <3.0.0' dependencies: + clock: ^1.1.1 + code_text_field: ^1.1.0 + file_picker: ^5.3.0 + flex_color_scheme: ^7.1.0 flutter: sdk: flutter + flutter_code_editor: ^0.2.23 + flutter_fancy_tree_view: ^1.1.1 + flutter_highlight: ^0.7.0 + flutter_hooks: ^0.18.6 flutter_localizations: sdk: flutter - - # For utilities - logger: any - intl: any - path: any - nanoid: ^1.0.0 - clock: ^1.1.1 - - # For user interface - responsive_framework: ^1.0.0 - google_fonts: ^4.0.4 - flex_color_scheme: ^7.1.0 + flutter_markdown: ^0.6.14 font_awesome_flutter: ^10.4.0 - flutter_fancy_tree_view: ^1.1.1 - multi_split_view: ^2.4.0 + freezed_annotation: ^2.2.0 + go_router: ^7.0.1 + google_fonts: ^4.0.4 highlight: ^0.7.0 - flutter_highlight: ^0.7.0 - code_text_field: ^1.1.0 - flutter_code_editor: ^0.2.23 - tabbed_view: ^1.16.0+1 - - # For window management - window_manager: ^0.3.2 - - # For state management - flutter_hooks: ^0.18.6 hooks_riverpod: ^2.3.6 - - # For routing - go_router: ^7.0.1 - - # For file management - watcher: ^1.0.2 - file_picker: ^5.3.0 - path_provider: ^2.0.15 - - # For storage management + intl: any isar: ^3.1.0+1 isar_flutter_libs: ^3.1.0+1 - - # For annotations json_annotation: ^4.8.1 - freezed_annotation: ^2.2.0 + logger: any + multi_split_view: ^2.4.0 + nanoid: ^1.0.0 + path: any + path_provider: ^2.0.15 + responsive_framework: ^1.0.0 riverpod_annotation: ^2.1.1 + tabbed_view: ^1.16.0+1 + watcher: ^1.0.2 + window_manager: ^0.3.2 dev_dependencies: - # For testing - flutter_test: - sdk: flutter - integration_test: - sdk: flutter - test: any - mockito: ^5.4.0 - # For generating code build_runner: any build_verify: any - json_serializable: any - freezed: ^2.3.3 - riverpod_generator: ^2.2.1 - isar_generator: ^3.1.0+1 - go_router_builder: ^2.0.1 # For linting flutter_lints: ^2.0.1 + flutter_test: + sdk: flutter + freezed: ^2.3.3 + go_router_builder: ^2.0.1 + integration_test: + sdk: flutter + isar_generator: ^3.1.0+1 + json_serializable: any + mockito: ^5.4.0 + riverpod_generator: ^2.2.1 riverpod_lint: ^1.3.1 + test: any flutter: @@ -95,4 +78,3 @@ flutter: assets: - assets/ - assets/icon/ -