Skip to content

Commit

Permalink
🐛 fixes #5
Browse files Browse the repository at this point in the history
  • Loading branch information
adeeteya committed Aug 1, 2023
1 parent 6799a77 commit 551daf1
Show file tree
Hide file tree
Showing 19 changed files with 700 additions and 134 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Please star⭐ the repo if you like what you see😊.

(or)

[![Download apk](https://img.shields.io/badge/Download-apk-green)](https://github.com/adityar224/FlutterMarkdownEditor/releases/download/1.1.0/MarkdownEditor-android-1.1.0.apk)
[![Download apk](https://img.shields.io/badge/Download-apk-green)](https://github.com/adityar224/FlutterMarkdownEditor/releases/download/1.2.0/MarkdownEditor-android-1.2.0.apk)

## ✨ Features

Expand All @@ -45,11 +45,11 @@ Please star⭐ the repo if you like what you see😊.

|Name|Usage|
|-|-|
|[**markdown_editable_textinput**](https://pub.dev/packages/markdown_editable_textinput)|Text field with useful markdown helper buttons|
|[**flutter_markdown**](https://pub.dev/packages/flutter_markdown)|To render markdown text|
|[**permission_handler**](https://pub.dev/packages/permission_handler)|To get storage permissions for opening and saving .md files|
|[**url_launcher**](https://pub.dev/packages/url_launcher)|To launch markdown links|
|[**file_picker**](https://pub.dev/packages/file_picker)|To open markdown files directly from the app|
|[**expandable**](https://pub.dev/packages/expandable)|To create expandable header buttons|
|[**flutter_localizations**](https://pub.dev/packages/flutter_localizations)|Internationalizing app|
|[**intl**](https://pub.dev/packages/intl)|Provides internationalization and localization facilities|
|[**flutter_lints**](https://pub.dev/packages/flutter_lints)|For linting|
Expand Down
1 change: 1 addition & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

| Version | Supported |
|---------| ------------------ |
| 1.2.0 | :white_check_mark: |
| 1.1.0 | :white_check_mark: |
| 1.0.0 | :white_check_mark: |

Expand Down
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ flutter {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
4 changes: 2 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.4.1'
classpath 'com.android.tools.build:gradle:7.3.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
4 changes: 2 additions & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Wed Mar 15 21:28:46 IST 2023
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
5 changes: 4 additions & 1 deletion lib/l10n/app_ar.arb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
"save": "حفظ",
"fileSaveSuccess": "تم حفظ الملف بنجاح في {filePath}",
"fileSaveError": "خطأ في حفظ الملف، جرب منح إذن الوصول إلى الملف في الإعدادات",
"imageAlternateTextFallback": "غير قادر على عرض الصورة"
"imageAlternateTextFallback": "غير قادر على عرض الصورة",
"example": "مثال",
"linkDialogTextTitle": "نص",
"linkDialogLinkTitle": "رابط"
}
14 changes: 13 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,17 @@
"imageAlternateTextFallback": "Unable to Display the Image",
"@imageAlternateTextFallback": {
"description": "Fallback Text if any case even altText of te image can't be displayed or isn't provided"
}
},
"example": "example",
"@example": {
"description": "Hint Text for Input Fields"
},
"linkDialogTextTitle": "Text",
"@linkDialogTextTitle": {
"description": "Text Field Title of The Link Dialog Box"
},
"linkDialogLinkTitle": "Link",
"@linkDialogLinkTitle": {
"description": "Link Field Title of The Link Dialog Box"
}
}
5 changes: 4 additions & 1 deletion lib/l10n/app_es.arb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
"save": "Guardar",
"fileSaveSuccess": "Archivo guardado exitosamente en {filePath}",
"fileSaveError": "Error al guardar el archivo, intente otorgar permisos de acceso al archivo en la configuración",
"imageAlternateTextFallback": "No se puede mostrar la imagen"
"imageAlternateTextFallback": "No se puede mostrar la imagen",
"example": "ejemplo",
"linkDialogTextTitle": "Texto",
"linkDialogLinkTitle": "Enlace"
}
30 changes: 30 additions & 0 deletions lib/l10n/app_fr.arb
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"ok": "D'accord",
"yes": "Oui",
"cancel": "Annuler",
"appTitle": "Éditeur Markdown",
"previewToolTip": "Aperçu",
"switchThemeMenuItem": "Changer de thème",
"switchViewMenuItem": "Changer de vue",
"openFileMenuItem": "Ouvrir",
"defaultFileName": "Markdown",
"markdownTextInputLabel": "Entrez votre texte Markdown ici",
"storagePermission": "Autorisation de stockage",
"storagePermissionContent": "Veuillez autoriser les permissions de stockage externe à l'écran suivant pour pouvoir ouvrir, éditer et enregistrer des fichiers Markdown.",
"error": "Erreur",
"unableToOpenFileError": "Impossible d'ouvrir le fichier, essayez de l'ouvrir à partir de l'option de fichier ouvert dans le menu.",
"unableToOpenFileFromMenuError": "Impossible d'ouvrir le fichier",
"emptyInputTextContent": "Veuillez saisir du texte",
"clear": "Effacer",
"clearAllTitle": "Tout effacer",
"clearAllContent": "Êtes-vous sûr de vouloir effacer tout le texte ?",
"saveFileDialogTitle": "Entrez le nom du fichier",
"saveFileDialogHintText": "Nom du fichier",
"save": "Enregistrer",
"fileSaveSuccess": "Fichier enregistré avec succès à {filePath}",
"fileSaveError": "Erreur lors de l'enregistrement du fichier, essayez d'accorder l'autorisation d'accès au fichier dans les paramètres.",
"imageAlternateTextFallback": "Impossible d'afficher l'image.",
"example": "exemple",
"linkDialogTextTitle": "Texte",
"linkDialogLinkTitle": "Lien"
}
5 changes: 4 additions & 1 deletion lib/l10n/app_hi.arb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
"save": "सहेजें",
"fileSaveSuccess": "फ़ाइल सफलतापूर्वक {filePath} में सहेजी गई",
"fileSaveError": "त्रुटि फ़ाइल सहेजते समय, सेटिंग में फ़ाइल एक्सेस अनुमति प्रदान करने का प्रयास करें",
"imageAlternateTextFallback": "चित्र नहीं दिखा सकता"
"imageAlternateTextFallback": "चित्र नहीं दिखा सकता",
"example": "उदाहरण",
"linkDialogTextTitle": "टेक्स्ट",
"linkDialogLinkTitle": "लिंक"
}
5 changes: 4 additions & 1 deletion lib/l10n/app_ja.arb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
"save": "保存",
"fileSaveSuccess": "{filePath}にファイルが正常に保存されました",
"fileSaveError": "ファイルの保存中にエラーが発生しました。設定でファイルアクセス許可を付与してみてください。",
"imageAlternateTextFallback": "画像を表示できません"
"imageAlternateTextFallback": "画像を表示できません",
"example": "例",
"linkDialogTextTitle": "テキスト",
"linkDialogLinkTitle": "リンク"
}
5 changes: 4 additions & 1 deletion lib/l10n/app_pt.arb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
"save": "Salvar",
"fileSaveSuccess": "Arquivo salvo com sucesso em {filePath}",
"fileSaveError": "Erro ao salvar o arquivo, tente conceder permissão de acesso ao arquivo nas configurações.",
"imageAlternateTextFallback": "Não é possível exibir a imagem"
"imageAlternateTextFallback": "Não é possível exibir a imagem",
"example": "exemplo",
"linkDialogTextTitle": "Texto",
"linkDialogLinkTitle": "Link"
}
5 changes: 4 additions & 1 deletion lib/l10n/app_ru.arb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
"save": "Сохранить",
"fileSaveSuccess": "Файл успешно сохранен в {filePath}",
"fileSaveError": "Ошибка сохранения файла. Попробуйте предоставить разрешение на доступ к файлам в настройках",
"imageAlternateTextFallback": "Невозможно отобразить изображение"
"imageAlternateTextFallback": "Невозможно отобразить изображение",
"example": "Пример",
"linkDialogTextTitle": "Текст",
"linkDialogLinkTitle": "Ссылка"
}
5 changes: 4 additions & 1 deletion lib/l10n/app_zh.arb
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,8 @@
"save": "保存",
"fileSaveSuccess": "文件已成功保存在{filePath}",
"fileSaveError": "保存文件时出错,请尝试在设置中授予文件访问权限",
"imageAlternateTextFallback": "无法显示图片"
"imageAlternateTextFallback": "无法显示图片",
"example": "例子",
"linkDialogTextTitle": "文本",
"linkDialogLinkTitle": "链接"
}
43 changes: 29 additions & 14 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
import 'dart:io';
import 'dart:ui';
import 'package:file_picker/file_picker.dart';
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart';
import 'package:flutter/services.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:markdown_editable_textinput/format_markdown.dart';
import 'package:markdown_editable_textinput/markdown_text_input.dart';
import 'package:markdown_editor/widgets/MarkdownTextInput/markdown_text_input.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

void main() => runApp(const MarkdownEditorApp());
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(
systemNavigationBarColor: Colors.transparent,
statusBarColor: Colors.transparent,
),
);
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
runApp(const MarkdownEditorApp());
}

class ThemeNotifier extends ValueNotifier<bool> {
ThemeNotifier(super.value);
Expand All @@ -22,7 +31,7 @@ class ThemeNotifier extends ValueNotifier<bool> {
}

ThemeNotifier isDarkNotifier = ThemeNotifier(
SchedulerBinding.instance.window.platformBrightness == Brightness.dark);
PlatformDispatcher.instance.platformBrightness == Brightness.dark);

class MarkdownEditorApp extends StatelessWidget {
const MarkdownEditorApp({Key? key}) : super(key: key);
Expand All @@ -42,14 +51,21 @@ class MarkdownEditorApp extends StatelessWidget {
),
darkTheme: ThemeData(
useMaterial3: true,
primaryColor: Colors.white,
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.indigo,
brightness: Brightness.dark,
),
brightness: Brightness.dark,
colorSchemeSeed: Colors.indigo,
),
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: AppLocalizations.supportedLocales,
supportedLocales: const [
Locale('en'),
Locale('ar'),
Locale('es'),
Locale('fr'),
Locale('hi'),
Locale('ja'),
Locale('pt'),
Locale('ru'),
Locale('zh'),
],
home: const Home(),
);
},
Expand Down Expand Up @@ -331,6 +347,7 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
child: MarkdownBody(
data: inputText,
shrinkWrap: true,
softLineBreak: true,
imageBuilder: (imageUri, _, alternateText) {
return Image.network(
imageUri.toString(),
Expand Down Expand Up @@ -364,9 +381,8 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
(String value) => setState(() => inputText = value),
inputText,
controller: _inputTextEditingController,
maxLines: 4,
maxLines: 8,
label: AppLocalizations.of(context)!.markdownTextInputLabel,
actions: MarkdownType.values,
),
],
),
Expand All @@ -386,7 +402,6 @@ class _HomeState extends State<Home> with WidgetsBindingObserver {
inputText,
controller: _inputTextEditingController,
label: AppLocalizations.of(context)!.markdownTextInputLabel,
actions: MarkdownType.values,
),
),
);
Expand Down
Loading

0 comments on commit 551daf1

Please sign in to comment.