parent
7c5a12b140
commit
356c833d32
15 changed files with 261 additions and 161 deletions
@ -1,89 +1,89 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<Scheme |
<Scheme |
||||||
LastUpgradeVersion = "1000" |
LastUpgradeVersion = "1430" |
||||||
version = "1.3"> |
version = "1.3"> |
||||||
<BuildAction |
<BuildAction |
||||||
parallelizeBuildables = "YES" |
parallelizeBuildables = "YES" |
||||||
buildImplicitDependencies = "YES"> |
buildImplicitDependencies = "YES"> |
||||||
<BuildActionEntries> |
<BuildActionEntries> |
||||||
<BuildActionEntry |
<BuildActionEntry |
||||||
buildForTesting = "YES" |
buildForTesting = "YES" |
||||||
buildForRunning = "YES" |
buildForRunning = "YES" |
||||||
buildForProfiling = "YES" |
buildForProfiling = "YES" |
||||||
buildForArchiving = "YES" |
buildForArchiving = "YES" |
||||||
buildForAnalyzing = "YES"> |
buildForAnalyzing = "YES"> |
||||||
<BuildableReference |
<BuildableReference |
||||||
BuildableIdentifier = "primary" |
BuildableIdentifier = "primary" |
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
||||||
BuildableName = "app.app" |
BuildableName = "app.app" |
||||||
BlueprintName = "Runner" |
BlueprintName = "Runner" |
||||||
ReferencedContainer = "container:Runner.xcodeproj"> |
ReferencedContainer = "container:Runner.xcodeproj"> |
||||||
</BuildableReference> |
</BuildableReference> |
||||||
</BuildActionEntry> |
</BuildActionEntry> |
||||||
</BuildActionEntries> |
</BuildActionEntries> |
||||||
</BuildAction> |
</BuildAction> |
||||||
<TestAction |
<TestAction |
||||||
buildConfiguration = "Debug" |
buildConfiguration = "Debug" |
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
||||||
shouldUseLaunchSchemeArgsEnv = "YES"> |
shouldUseLaunchSchemeArgsEnv = "YES"> |
||||||
<MacroExpansion> |
<MacroExpansion> |
||||||
<BuildableReference |
<BuildableReference |
||||||
BuildableIdentifier = "primary" |
BuildableIdentifier = "primary" |
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
||||||
BuildableName = "app.app" |
BuildableName = "app.app" |
||||||
BlueprintName = "Runner" |
BlueprintName = "Runner" |
||||||
ReferencedContainer = "container:Runner.xcodeproj"> |
ReferencedContainer = "container:Runner.xcodeproj"> |
||||||
</BuildableReference> |
</BuildableReference> |
||||||
</MacroExpansion> |
</MacroExpansion> |
||||||
<AdditionalOptions> |
<AdditionalOptions> |
||||||
</AdditionalOptions> |
</AdditionalOptions> |
||||||
</TestAction> |
</TestAction> |
||||||
<LaunchAction |
<LaunchAction |
||||||
buildConfiguration = "Debug" |
buildConfiguration = "Debug" |
||||||
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" |
||||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" |
||||||
launchStyle = "0" |
launchStyle = "0" |
||||||
useCustomWorkingDirectory = "NO" |
useCustomWorkingDirectory = "NO" |
||||||
ignoresPersistentStateOnLaunch = "NO" |
ignoresPersistentStateOnLaunch = "NO" |
||||||
debugDocumentVersioning = "YES" |
debugDocumentVersioning = "YES" |
||||||
debugServiceExtension = "internal" |
debugServiceExtension = "internal" |
||||||
allowLocationSimulation = "YES"> |
allowLocationSimulation = "YES"> |
||||||
<BuildableProductRunnable |
<BuildableProductRunnable |
||||||
runnableDebuggingMode = "0"> |
runnableDebuggingMode = "0"> |
||||||
<BuildableReference |
<BuildableReference |
||||||
BuildableIdentifier = "primary" |
BuildableIdentifier = "primary" |
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
||||||
BuildableName = "app.app" |
BuildableName = "app.app" |
||||||
BlueprintName = "Runner" |
BlueprintName = "Runner" |
||||||
ReferencedContainer = "container:Runner.xcodeproj"> |
ReferencedContainer = "container:Runner.xcodeproj"> |
||||||
</BuildableReference> |
</BuildableReference> |
||||||
</BuildableProductRunnable> |
</BuildableProductRunnable> |
||||||
<AdditionalOptions> |
<AdditionalOptions> |
||||||
</AdditionalOptions> |
</AdditionalOptions> |
||||||
</LaunchAction> |
</LaunchAction> |
||||||
<ProfileAction |
<ProfileAction |
||||||
buildConfiguration = "Profile" |
buildConfiguration = "Profile" |
||||||
shouldUseLaunchSchemeArgsEnv = "YES" |
shouldUseLaunchSchemeArgsEnv = "YES" |
||||||
savedToolIdentifier = "" |
savedToolIdentifier = "" |
||||||
useCustomWorkingDirectory = "NO" |
useCustomWorkingDirectory = "NO" |
||||||
debugDocumentVersioning = "YES"> |
debugDocumentVersioning = "YES"> |
||||||
<BuildableProductRunnable |
<BuildableProductRunnable |
||||||
runnableDebuggingMode = "0"> |
runnableDebuggingMode = "0"> |
||||||
<BuildableReference |
<BuildableReference |
||||||
BuildableIdentifier = "primary" |
BuildableIdentifier = "primary" |
||||||
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
BlueprintIdentifier = "33CC10EC2044A3C60003C045" |
||||||
BuildableName = "app.app" |
BuildableName = "app.app" |
||||||
BlueprintName = "Runner" |
BlueprintName = "Runner" |
||||||
ReferencedContainer = "container:Runner.xcodeproj"> |
ReferencedContainer = "container:Runner.xcodeproj"> |
||||||
</BuildableReference> |
</BuildableReference> |
||||||
</BuildableProductRunnable> |
</BuildableProductRunnable> |
||||||
</ProfileAction> |
</ProfileAction> |
||||||
<AnalyzeAction |
<AnalyzeAction |
||||||
buildConfiguration = "Debug"> |
buildConfiguration = "Debug"> |
||||||
</AnalyzeAction> |
</AnalyzeAction> |
||||||
<ArchiveAction |
<ArchiveAction |
||||||
buildConfiguration = "Release" |
buildConfiguration = "Release" |
||||||
revealArchiveInOrganizer = "YES"> |
revealArchiveInOrganizer = "YES"> |
||||||
</ArchiveAction> |
</ArchiveAction> |
||||||
</Scheme> |
</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