2023-10-29 SteemLife Development JournalsteemCreated with Sketch.

in Steem Dev6 months ago (edited)

I'm currently developing a markdown editor for the writing screen in Flutter. To achieve this, I searched pub.dev for Flutter editor libraries and found some useful packages.

markdown_editable_textinput

markdown_editable_textinput is one of the simplest packages to implement. However, it has limited customization options.

Here's an example of its usage:

import 'package:markdown_editable_textinput/format_markdown.dart';
import 'package:markdown_editable_textinput/markdown_text_input.dart';

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

  @override
  Widget build(BuildContext) { 
    return MarkdownTextInput(
      (String value) {
        // your code here
      }, 
      label: 'Tell me your story',
      markdown,
      actions: MarkdownType.values,
      controller: contentController,
      textStyle: TextStyle(fontSize: 16),
    );
  }
}

Here's a demo screen of this package:

I initially considered using this package but eventually gave up due to its lack of customization.

simple_markdown_editor

Simple_markdown_editor has not received updates since March 12, 2022, and installation fails due to a conflict with the markdown package version.

Below is a screenshot of the failed installation:

There was also a modified version called simple_markdown_editor_plus, but it faced the same installation issues.

I briefly contemplated forking this package and making modifications but abandoned the idea after discovering the markdown_toolbar package.

markdown_toolbar

I anchored it to the bottom of the screen using markdown_toolbar and crafted a Markdown Editor Toolbar tailored to my specific button requirements.

Here's a code snippet to integrate markdown_toolbar:

MarkdownToolbar(
  useIncludedTextField: false,
  controller: contentController,
  focusNode: contentFocusNode,
  collapsable: false,
  iconSize: 18.0,
  width: MediaQuery.of(context).size.width / 9 - 2.0,
  height: 40,
  spacing: 0.0,
  runSpacing: 0.0,
  hideCode: true,
  hideCheckbox: true,
  hideNumberedList: true,
  hideStrikethrough: true,
  alignment: WrapAlignment.spaceBetween,
  iconColor: Theme.of(context).colorScheme.onSurface,
  dropdownTextColor: Theme.of(context).colorScheme.onSurface,
  backgroundColor: Theme.of(context).colorScheme.surface,
);

Below is an image of a markdown toolbar created with markdown_toolbar:

Conclusion

On mobile platforms, a writing editor may not require an extensive set of features. A simple and user-friendly design is essential for a mobile editor. The combination of markdown_editable_textinput and markdown_toolbar can be an excellent choice to meet these requirements. Specifically, markdown_editable_textinput offers a straightforward implementation, while markdown_toolbar effectively provides the necessary core functionality.

Compared to other editors with numerous options and complex layouts, these packages enable users to write and publish quickly. I aim is to provide a stress-free writing experience for mobile users.


I'm a full-stack developer, working on various apps and projects.
And I'm constantly sharing articles related to development.
If you're curious about the project, you can learn more about it through the following links: [Steemlife] Dreaming of a free life on Steem




Posted through the ECblog app (https://blog.etain.club)

Sort:  

[광고] STEEM 개발자 커뮤니티에 참여 하시면, 다양한 혜택을 받을 수 있습니다.

꾸준히 쉬지 않고 개발을 하고 계시네요
저는 스팀 체인을 이용한 신문을 만들어 보려고 합니다.
이제 처음 코딩을 배우는 중이라 뭐하나를 하려고 하니 한계에 봉착하는군요
5년전에 만드신 vue이용한 스팀앱 개발을 보고 저도 우선 vue 강의를 들으면서 제가 생각하는 것을 하나씩 구현해 보려고 합니다.
5년전에 만드신 것을 보고 용기를 내고 있습니다.
저는 신문을 4개의 섹션으로 나누고 각각의 섹션을 한개의 계정으로 글을 쓰고 이것을 모아서 블로그 및 신문 형식으로 만들어 보려고 합니다.
공부를 하다가 모르는 부분이 있으면 문의를 드리겠습니다

코딩을 이제 배워서 개발하신다니 대단하십니다.
화이팅입니다~!

스팀체인에서 글을 불러와서 신문과 같은 방식으로 해보려 합니다. 그러다 보니 5년전에 올리신 글을 보고 저도 vue 강의를 듣고 있습니다. 그동안 자바스크립트는 공부를 했지만 아는 것과 그것으로 코딩을 하는것은 상당한 차이가 있군요. vue 강의를 듣고 따라가는데 앞으로 최소한 2-3주는 걸릴 것 같습니다. 그래야 포스팅 해놓으신 내용을 이해할 수 있겠지요

5년 전에 작성한 글을 보았군요. 그 당시에 프론트엔드 개발을 처음 시작했던 때였으니, 글에 부족한 부분이 많을 것입니다.
아고라님 화이팅입니다~!

그글을 보고 용기를 내어 vue 공부를 시작하고 있습니다

It will be a great component to integrate into a Flutter app. I suggest you get the code files from the library and change everything according to your. When you write code by yourself then you will be confident to enhance it.

Thanks for the advice faisalamin.

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.032
BTC 62985.30
ETH 3106.93
USDT 1.00
SBD 3.87