parent
7c5a12b140
commit
356c833d32
15 changed files with 261 additions and 161 deletions
@ -1,89 +1,89 @@ |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<Scheme |
||||
LastUpgradeVersion = "1000" |
||||
version = "1.3"> |
||||
<BuildAction |
||||
parallelizeBuildables = "YES" |
||||
buildImplicitDependencies = "YES"> |
||||
<BuildActionEntries> |
||||
<BuildActionEntry |
||||
buildForTesting = "YES" |
||||
buildForRunning = "YES" |
||||
buildForProfiling = "YES" |
||||
buildForArchiving = "YES" |
||||
buildForAnalyzing = "YES"> |
||||
<BuildableReference |
||||
BuildableIdentifier = "primary" |
||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
||||
BuildableName = "app.app" |
||||
BlueprintName = "Runner" |
||||
ReferencedContainer = "container:Runner.xcodeproj"> |
||||
</BuildableReference> |
||||
</BuildActionEntry> |
||||
</BuildActionEntries> |
||||
</BuildAction> |
||||
<TestAction |
||||
buildConfiguration = "Debug" |
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
||||
shouldUseLaunchSchemeArgsEnv = "YES"> |
||||
<MacroExpansion> |
||||
<BuildableReference |
||||
BuildableIdentifier = "primary" |
||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
||||
BuildableName = "app.app" |
||||
BlueprintName = "Runner" |
||||
ReferencedContainer = "container:Runner.xcodeproj"> |
||||
</BuildableReference> |
||||
</MacroExpansion> |
||||
<AdditionalOptions> |
||||
</AdditionalOptions> |
||||
</TestAction> |
||||
<LaunchAction |
||||
buildConfiguration = "Debug" |
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
||||
launchStyle = "0" |
||||
useCustomWorkingDirectory = "NO" |
||||
ignoresPersistentStateOnLaunch = "NO" |
||||
debugDocumentVersioning = "YES" |
||||
debugServiceExtension = "internal" |
||||
allowLocationSimulation = "YES"> |
||||
<BuildableProductRunnable |
||||
runnableDebuggingMode = "0"> |
||||
<BuildableReference |
||||
BuildableIdentifier = "primary" |
||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
||||
BuildableName = "app.app" |
||||
BlueprintName = "Runner" |
||||
ReferencedContainer = "container:Runner.xcodeproj"> |
||||
</BuildableReference> |
||||
</BuildableProductRunnable> |
||||
<AdditionalOptions> |
||||
</AdditionalOptions> |
||||
</LaunchAction> |
||||
<ProfileAction |
||||
buildConfiguration = "Profile" |
||||
shouldUseLaunchSchemeArgsEnv = "YES" |
||||
savedToolIdentifier = "" |
||||
useCustomWorkingDirectory = "NO" |
||||
debugDocumentVersioning = "YES"> |
||||
<BuildableProductRunnable |
||||
runnableDebuggingMode = "0"> |
||||
<BuildableReference |
||||
BuildableIdentifier = "primary" |
||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
||||
BuildableName = "app.app" |
||||
BlueprintName = "Runner" |
||||
ReferencedContainer = "container:Runner.xcodeproj"> |
||||
</BuildableReference> |
||||
</BuildableProductRunnable> |
||||
</ProfileAction> |
||||
<AnalyzeAction |
||||
buildConfiguration = "Debug"> |
||||
</AnalyzeAction> |
||||
<ArchiveAction |
||||
buildConfiguration = "Release" |
||||
revealArchiveInOrganizer = "YES"> |
||||
</ArchiveAction> |
||||
</Scheme> |
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<Scheme |
||||
LastUpgradeVersion = "1430" |
||||
version = "1.3"> |
||||
<BuildAction |
||||
parallelizeBuildables = "YES" |
||||
buildImplicitDependencies = "YES"> |
||||
<BuildActionEntries> |
||||
<BuildActionEntry |
||||
buildForTesting = "YES" |
||||
buildForRunning = "YES" |
||||
buildForProfiling = "YES" |
||||
buildForArchiving = "YES" |
||||
buildForAnalyzing = "YES"> |
||||
<BuildableReference |
||||
BuildableIdentifier = "primary" |
||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
||||
BuildableName = "app.app" |
||||
BlueprintName = "Runner" |
||||
ReferencedContainer = "container:Runner.xcodeproj"> |
||||
</BuildableReference> |
||||
</BuildActionEntry> |
||||
</BuildActionEntries> |
||||
</BuildAction> |
||||
<TestAction |
||||
buildConfiguration = "Debug" |
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
||||
shouldUseLaunchSchemeArgsEnv = "YES"> |
||||
<MacroExpansion> |
||||
<BuildableReference |
||||
BuildableIdentifier = "primary" |
||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
||||
BuildableName = "app.app" |
||||
BlueprintName = "Runner" |
||||
ReferencedContainer = "container:Runner.xcodeproj"> |
||||
</BuildableReference> |
||||
</MacroExpansion> |
||||
<AdditionalOptions> |
||||
</AdditionalOptions> |
||||
</TestAction> |
||||
<LaunchAction |
||||
buildConfiguration = "Debug" |
||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
||||
launchStyle = "0" |
||||
useCustomWorkingDirectory = "NO" |
||||
ignoresPersistentStateOnLaunch = "NO" |
||||
debugDocumentVersioning = "YES" |
||||
debugServiceExtension = "internal" |
||||
allowLocationSimulation = "YES"> |
||||
<BuildableProductRunnable |
||||
runnableDebuggingMode = "0"> |
||||
<BuildableReference |
||||
BuildableIdentifier = "primary" |
||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
||||
BuildableName = "app.app" |
||||
BlueprintName = "Runner" |
||||
ReferencedContainer = "container:Runner.xcodeproj"> |
||||
</BuildableReference> |
||||
</BuildableProductRunnable> |
||||
<AdditionalOptions> |
||||
</AdditionalOptions> |
||||
</LaunchAction> |
||||
<ProfileAction |
||||
buildConfiguration = "Profile" |
||||
shouldUseLaunchSchemeArgsEnv = "YES" |
||||
savedToolIdentifier = "" |
||||
useCustomWorkingDirectory = "NO" |
||||
debugDocumentVersioning = "YES"> |
||||
<BuildableProductRunnable |
||||
runnableDebuggingMode = "0"> |
||||
<BuildableReference |
||||
BuildableIdentifier = "primary" |
||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
||||
BuildableName = "app.app" |
||||
BlueprintName = "Runner" |
||||
ReferencedContainer = "container:Runner.xcodeproj"> |
||||
</BuildableReference> |
||||
</BuildableProductRunnable> |
||||
</ProfileAction> |
||||
<AnalyzeAction |
||||
buildConfiguration = "Debug"> |
||||
</AnalyzeAction> |
||||
<ArchiveAction |
||||
buildConfiguration = "Release" |
||||
revealArchiveInOrganizer = "YES"> |
||||
</ArchiveAction> |
||||
</Scheme> |
||||
|
@ -0,0 +1,12 @@ |
||||
import 'package:flutter/foundation.dart' show immutable; |
||||
|
||||
import '../../flutter_quill.dart'; |
||||
|
||||
@immutable |
||||
class QuillConfigurations { |
||||
const QuillConfigurations({ |
||||
required this.controller, |
||||
}); |
||||
|
||||
final QuillController controller; |
||||
} |
@ -0,0 +1,21 @@ |
||||
import 'package:flutter/widgets.dart' show BuildContext; |
||||
|
||||
import '../../../flutter_quill.dart'; |
||||
|
||||
extension BuildContextExt on BuildContext { |
||||
QuillProvider get requireQuillProvider { |
||||
return QuillProvider.ofNotNull(this); |
||||
} |
||||
|
||||
QuillProvider? get quillProvider { |
||||
return QuillProvider.of(this); |
||||
} |
||||
|
||||
QuillController? get quilController { |
||||
return quillProvider?.configurations.controller; |
||||
} |
||||
|
||||
QuillController get requireQuillController { |
||||
return requireQuillProvider.configurations.controller; |
||||
} |
||||
} |
@ -0,0 +1,35 @@ |
||||
import 'package:flutter/foundation.dart' show debugPrint, kDebugMode; |
||||
import 'package:flutter/widgets.dart' show InheritedWidget, BuildContext; |
||||
|
||||
import '../../core/quill_configurations.dart'; |
||||
|
||||
class QuillProvider extends InheritedWidget { |
||||
const QuillProvider({ |
||||
required this.configurations, |
||||
required super.child, |
||||
}); |
||||
|
||||
final QuillConfigurations configurations; |
||||
|
||||
@override |
||||
bool updateShouldNotify(covariant InheritedWidget oldWidget) { |
||||
throw false; |
||||
} |
||||
|
||||
static QuillProvider? of(BuildContext context) { |
||||
return context.dependOnInheritedWidgetOfExactType<QuillProvider>(); |
||||
} |
||||
|
||||
static QuillProvider ofNotNull(BuildContext context) { |
||||
final provider = of(context); |
||||
if (provider == null) { |
||||
if (kDebugMode) { |
||||
debugPrint( |
||||
'The quill provider must be provided in the widget tree.', |
||||
); |
||||
} |
||||
throw ArgumentError.checkNotNull(provider, 'QuillProvider'); |
||||
} |
||||
return provider; |
||||
} |
||||
} |
Loading…
Reference in new issue