Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📝 Markdown Viewer added when opening a markdown file #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 29 additions & 1 deletion lib/views/editor/code.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -70,7 +71,34 @@ class CodeEditor extends HookConsumerWidget {
codeController.setCursor(sourceFile.extentOffset);
}

return getCodeEditor(ref, focusNode, codeController, codeStyle);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use MultiSplitView instead so that editor and viewer is resizable.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! Also, It will easy to extend and implement split view for open files (left, right) etc. We might have to maintain multiple providers for open files then. Eg. If we implement only horizontal split in the beginning then, two providers to maintain open files on split view left and split view right! LMK

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())),
Expand Down
2 changes: 1 addition & 1 deletion macos/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: 353c8bcc5d5b0994e508d035b5431cfe18c1dea7

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1
16 changes: 16 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
86 changes: 34 additions & 52 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:

Expand All @@ -95,4 +78,3 @@ flutter:
assets:
- assets/
- assets/icon/