Feat: added spellchecker service

pull/2118/head
CatHood0 8 months ago
parent 2342509737
commit 9169345b1f
  1. 11
      lib/src/editor/spellchecker/default_spellchecker_service.dart
  2. 12
      lib/src/editor/spellchecker/spellchecker_service.dart
  3. 19
      lib/src/editor/spellchecker/spellchecker_service_provider.dart

@ -0,0 +1,11 @@
import 'package:flutter/services.dart';
import 'spellchecker_service.dart';
class DefaultSpellcheckerService extends SpellcheckerService{
DefaultSpellcheckerService() : super(language: 'en');
@override
List<SuggestionSpan>? getSuggestions(String text) {
return null;
}
}

@ -0,0 +1,12 @@
import 'package:flutter/services.dart';
abstract class SpellcheckerService {
SpellcheckerService({
required this.language,
});
final String language;
List<SuggestionSpan>? getSuggestions(String text);
}

@ -0,0 +1,19 @@
import 'package:flutter/foundation.dart' show immutable;
import 'default_spellchecker_service.dart';
import 'spellchecker_service.dart';
@immutable
class SpellcheckerServiceProvider {
const SpellcheckerServiceProvider._();
static SpellcheckerService _instance = DefaultSpellcheckerService();
static SpellcheckerService get instance => _instance;
static void setInstance(SpellcheckerService service) {
_instance = service;
}
static void setInstanceToDefault() {
_instance = DefaultSpellcheckerService();
}
}
Loading…
Cancel
Save