monaco_editor 0.0.1+2 monaco_editor: ^0.0.1+2 copied to clipboard
A Flutter plugin for using the monaco editor in the WEB application
import 'package:flutter/material.dart';
import 'package:monaco_editor/monaco_editor.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
final controller1 = MonacoEditorController();
final controller2 = MonacoEditorController();
@override
void initState() {
controller1.initialize(
MonacoEditorOptions(
language: MonacoLanguage.json,
theme: MonacoTheme.vsDark,
),
);
controller2.initialize(
MonacoEditorOptions(
language: MonacoLanguage.json,
theme: MonacoTheme.vsDark,
),
);
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
floatingActionButton: FloatingActionButton(
onPressed: () async {
controller1.setText('hello');
},
child: const Icon(Icons.add),
),
appBar: AppBar(
title: const Text('Monaco Editor Example'),
),
body: Row(
children: [
Expanded(
child: MonacoEditorWidget(
controller: controller1,
),
),
Expanded(
child: MonacoEditorWidget(
controller: controller2,
),
),
],
),
),
);
}
}