Update home page for refactoring _isDesktop function

pull/324/head
Xin Yao 4 years ago
parent 59c8ec7fe7
commit 8aec946674
  1. 5
      example/lib/pages/home_page.dart
  2. 5
      example/lib/widgets/demo_scaffold.dart

@ -156,8 +156,7 @@ class _HomePageState extends State<HomePage> {
onImagePickCallback: _onImagePickCallback,
webImagePickImpl: _webImagePickImpl);
}
final isDesktop = !kIsWeb && !Platform.isAndroid && !Platform.isIOS;
if (isDesktop) {
if (_isDesktop()) {
toolbar = QuillToolbar.basic(
controller: _controller!,
onImagePickCallback: _onImagePickCallback,
@ -189,6 +188,8 @@ class _HomePageState extends State<HomePage> {
);
}
bool _isDesktop() => !kIsWeb && !Platform.isAndroid && !Platform.isIOS;
Future<String?> openFileSystemPickerForDesktop(BuildContext context) async {
return await FilesystemPicker.open(
context: context,

@ -87,8 +87,7 @@ class _DemoScaffoldState extends State<DemoScaffold> {
Widget build(BuildContext context) {
final actions = widget.actions ?? <Widget>[];
var toolbar = QuillToolbar.basic(controller: _controller!);
final isDesktop = !kIsWeb && !Platform.isAndroid && !Platform.isIOS;
if (isDesktop) {
if (_isDesktop()) {
toolbar = QuillToolbar.basic(
controller: _controller!,
filePickImpl: openFileSystemPickerForDesktop);
@ -117,4 +116,6 @@ class _DemoScaffoldState extends State<DemoScaffold> {
: widget.builder(context, _controller),
);
}
bool _isDesktop() => !kIsWeb && !Platform.isAndroid && !Platform.isIOS;
}

Loading…
Cancel
Save