Browse Source

fix macOS

lucky1213 4 years ago
parent
commit
9044178051

+ 4
- 2
packages/zefyr/example/ios/Flutter/flutter_export_environment.sh View File

2
 # This is a generated file; do not edit or check into version control.
2
 # This is a generated file; do not edit or check into version control.
3
 export "FLUTTER_ROOT=/Users/imac/.fvm/versions/latest-dev"
3
 export "FLUTTER_ROOT=/Users/imac/.fvm/versions/latest-dev"
4
 export "FLUTTER_APPLICATION_PATH=/Users/imac/Documents/flutter/projects/zefyr/packages/zefyr/example"
4
 export "FLUTTER_APPLICATION_PATH=/Users/imac/Documents/flutter/projects/zefyr/packages/zefyr/example"
5
-export "FLUTTER_TARGET=/Users/imac/Documents/flutter/projects/zefyr/packages/zefyr/example/lib/main.dart"
5
+export "FLUTTER_TARGET=lib/main.dart"
6
 export "FLUTTER_BUILD_DIR=build"
6
 export "FLUTTER_BUILD_DIR=build"
7
 export "SYMROOT=${SOURCE_ROOT}/../build/ios"
7
 export "SYMROOT=${SOURCE_ROOT}/../build/ios"
8
 export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
8
 export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
9
 export "FLUTTER_FRAMEWORK_DIR=/Users/imac/.fvm/versions/latest-dev/bin/cache/artifacts/engine/ios"
9
 export "FLUTTER_FRAMEWORK_DIR=/Users/imac/.fvm/versions/latest-dev/bin/cache/artifacts/engine/ios"
10
 export "FLUTTER_BUILD_NAME=1.0.0"
10
 export "FLUTTER_BUILD_NAME=1.0.0"
11
 export "FLUTTER_BUILD_NUMBER=1"
11
 export "FLUTTER_BUILD_NUMBER=1"
12
-export "TRACK_WIDGET_CREATION=true"
12
+export "DART_OBFUSCATION=false"
13
+export "TRACK_WIDGET_CREATION=false"
14
+export "TREE_SHAKE_ICONS=false"

+ 2
- 0
packages/zefyr/lib/src/widgets/buttons.dart View File

921
           ));
921
           ));
922
       editor.formatSelection(NotusAttribute.link.fromString(result.url));
922
       editor.formatSelection(NotusAttribute.link.fromString(result.url));
923
       editor.closeKeyboard();
923
       editor.closeKeyboard();
924
+    } else {
925
+      editor.updateSelection(_selection, source: ChangeSource.local);
924
     }
926
     }
925
   }
927
   }
926
 
928
 

+ 1
- 1
packages/zefyr/lib/src/widgets/editable_text.dart View File

137
 
137
 
138
   TextSelectionControls defaultSelectionControls(BuildContext context) {
138
   TextSelectionControls defaultSelectionControls(BuildContext context) {
139
     TargetPlatform platform = Theme.of(context).platform;
139
     TargetPlatform platform = Theme.of(context).platform;
140
-    if (platform == TargetPlatform.iOS) {
140
+    if (platform == TargetPlatform.iOS || platform == TargetPlatform.macOS) {
141
       return cupertinoTextSelectionControls;
141
       return cupertinoTextSelectionControls;
142
     }
142
     }
143
     return materialTextSelectionControls;
143
     return materialTextSelectionControls;

+ 1
- 0
packages/zefyr/lib/src/widgets/theme.dart View File

360
     String monospaceFontFamily;
360
     String monospaceFontFamily;
361
     switch (theme.platform) {
361
     switch (theme.platform) {
362
       case TargetPlatform.iOS:
362
       case TargetPlatform.iOS:
363
+      case TargetPlatform.macOS:
363
         monospaceFontFamily = 'Menlo';
364
         monospaceFontFamily = 'Menlo';
364
         break;
365
         break;
365
       case TargetPlatform.android:
366
       case TargetPlatform.android:

+ 18
- 19
packages/zefyr/lib/src/widgets/toolbar.dart View File

311
     super.dispose();
311
     super.dispose();
312
   }
312
   }
313
 
313
 
314
+  Widget buildTrailing() {
315
+    Widget widget;
316
+    TargetPlatform platform = Theme.of(context).platform;
317
+    switch (platform) {
318
+      case TargetPlatform.iOS:
319
+      case TargetPlatform.android:
320
+        widget = hasOverlay ? buildButton(context, ZefyrToolbarAction.showKeyboard) : buildButton(context, ZefyrToolbarAction.hideKeyboard);
321
+        break;
322
+      default:
323
+        break;
324
+    }
325
+    return widget;
326
+  }
327
+
314
   @override
328
   @override
315
   Widget build(BuildContext context) {
329
   Widget build(BuildContext context) {
316
     if (MediaQuery.of(context).viewInsets.bottom > 0) {
330
     if (MediaQuery.of(context).viewInsets.bottom > 0) {
326
     );
340
     );
327
     final layers = <Widget>[];
341
     final layers = <Widget>[];
328
     Widget overlay;
342
     Widget overlay;
329
-
343
+    var trailing = buildTrailing();
330
     // Must set unique key for the toolbar to prevent it from reconstructing
344
     // Must set unique key for the toolbar to prevent it from reconstructing
331
     // new state each time we toggle overlay.
345
     // new state each time we toggle overlay.
332
     final bottons = <Widget>[
346
     final bottons = <Widget>[
347
+      if (trailing != null)
333
       kToolbarDivider,
348
       kToolbarDivider,
334
       Expanded(child: ListView(
349
       Expanded(child: ListView(
335
         scrollDirection: Axis.horizontal,
350
         scrollDirection: Axis.horizontal,
353
       body: Row(
368
       body: Row(
354
         children: bottons,
369
         children: bottons,
355
       ),
370
       ),
356
-      trailing: hasOverlay ? buildButton(context, ZefyrToolbarAction.showKeyboard) : buildButton(context, ZefyrToolbarAction.hideKeyboard),
371
+      trailing: trailing,
372
+      autoImplyTrailing: false,
357
     );
373
     );
358
     layers.add(toolbar);
374
     layers.add(toolbar);
359
     if (hasOverlay) {
375
     if (hasOverlay) {
384
       ),
400
       ),
385
     );
401
     );
386
   }
402
   }
387
-
388
-  List<Widget> _buildButtons(BuildContext context) {
389
-    final buttons = <Widget>[
390
-      HeadingButton(),
391
-      buildButton(context, ZefyrToolbarAction.emoji),
392
-      if (editor.imageDelegate != null) ImageButton(),
393
-      // ImageButton(),
394
-      LinkButton(),
395
-      
396
-      // buildButton(context, ZefyrToolbarAction.bulletList),
397
-      // buildButton(context, ZefyrToolbarAction.numberList),
398
-      // buildButton(context, ZefyrToolbarAction.quote),
399
-      // buildButton(context, ZefyrToolbarAction.code),
400
-      // buildButton(context, ZefyrToolbarAction.horizontalRule),
401
-    ];
402
-    return buttons;
403
-  }
404
 }
403
 }
405
 
404
 
406
 /// Scrollable list of toolbar buttons.
405
 /// Scrollable list of toolbar buttons.