Reputation: 847
I search since 5 hours for a textfield with an editor like this : :
So multiline and with editor.
EDIT :
My temporary solution :
final _commentMarkdownTextContributorCreateMissionView = Padding(
padding: EdgeInsets.only(top: 24.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text("Tout comprendre sur le "),
InkWell(
child: Text(
"Markdown",
style: TextStyle(color: IneatColors.pink),
),
onTap: () async {
if (await canLaunch("https://fr.wikipedia.org/wiki/Markdown")) {
await launch("https://fr.wikipedia.org/wiki/Markdown");
}
},
),
],
),
);
final _contextMissionMarkdownTextInputContributorCreateMissionView =
Padding(
padding: EdgeInsets.only(top: 24.0, bottom: 12.0),
child: MarkdownTextInput(
(String value) => model.setOnTextChangedContext(value),
model.contextMarkdownTextInput,
label: 'Contexte',
),
);
final _contextMissionMarkdownBodyContributorCreateMissionView = Padding(
padding: EdgeInsets.only(top: 24.0, left: 12.0),
child: MarkdownBody(
data: model.contextMarkdownTextInput,
),
);
flutter_markdown: # #Markdown : https://pub:dev/packages/flutter_markdown:
markdown_editable_textinput: # Text input : https://pub:dev/packages/markdown_editable_textinput#-example-tab-:
Markdown language in the textfield works but the not the tools for the moment, so if you have a solution.
Can you healp me ? Compatible for flutter web
Upvotes: 3
Views: 3578
Reputation: 4391
I hope this plugin would help you. I have copied the example code of plugin here. [flutter_markdown][1]
import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
const String _markdownData = """
# Markdown Example
Markdown allows you to easily include formatted text, images, and even formatted Dart code in your app.
## Titles
Setext-style
Atx-style
Select the valid headers:
- [x] `# hello`
- [ ] `#hello`
## Links
[Google's Homepage][Google]
[reference-style][Google]
## Images
![Flutter logo](/dart-lang/site-shared/master/src/_assets/image/flutter/icon/64.png)
## Tables
|Syntax |Result |
|---------------------------------------|-------------------------------------|
|`*italic 1*` |*italic 1* |
|`_italic 2_` | _italic 2_ |
|`**bold 1**` |**bold 1** |
|`__bold 2__` |__bold 2__ |
|`This is a ~~strikethrough~~` |This is a ~~strikethrough~~ |
|`***italic bold 1***` |***italic bold 1*** |
|`___italic bold 2___` |___italic bold 2___ |
|`***~~italic bold strikethrough 1~~***`|***~~italic bold strikethrough 1~~***|
|`~~***italic bold strikethrough 2***~~`|~~***italic bold strikethrough 2***~~|
## Styling
Style text as _italic_, __bold__, ~~strikethrough~~, or `inline code`.
- Use bulleted lists
- To better clarify
- Your points
## Code blocks
Formatted Dart code looks really pretty too:
void main() { runApp(MaterialApp( home: Scaffold( body: Markdown(data: markdownData), ), )); }
## Markdown widget
This is an example of how to create your own Markdown widget:
Markdown(data: 'Hello _world_!');
Enjoy!
[Google]: https://www.google.com/
""";
void main() {
final controller = ScrollController();
runApp(
MaterialApp(
title: "Markdown Demo",
home: Scaffold(
appBar: AppBar(
title: const Text('Markdown Demo'),
),
body: SafeArea(
child: Markdown(
controller: controller,
selectable: true,
data: _markdownData,
imageDirectory: 'https://raw.githubusercontent.com',
),
),
floatingActionButton: FloatingActionButton(
child: Icon(Icons.arrow_upward),
onPressed: () => controller.animateTo(0,
duration: Duration(seconds: 1), curve: Curves.easeOut),
),
),
),
);
}
[1]: https://pub.dev/packages/flutter_markdown
Upvotes: 3