parent
2342509737
commit
9169345b1f
3 changed files with 42 additions and 0 deletions
@ -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…
Reference in new issue