lucky1213 4 years ago
parent
commit
d1e9b86474

+ 14
- 0
.vscode/launch.json View File

@@ -0,0 +1,14 @@
1
+{
2
+  // 使用 IntelliSense 了解相关属性。
3
+  // 悬停以查看现有属性的描述。
4
+  // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
5
+  "version": "0.2.0",
6
+  "configurations": [
7
+    {
8
+      "name": "Flutter",
9
+      "request": "launch",
10
+      "type": "dart",
11
+      "program": "packages/zefyr/example/lib/main.dart"
12
+    }
13
+  ]
14
+}

+ 13
- 3
packages/zefyr/example/lib/src/full_page.dart View File

@@ -71,7 +71,7 @@ class _FullPageEditorScreenState extends State<FullPageEditorScreen> {
71 71
         ? IconButton(onPressed: _stopEditing, icon: Icon(Icons.save))
72 72
         : IconButton(onPressed: _startEditing, icon: Icon(Icons.edit));
73 73
     final result = Scaffold(
74
-      resizeToAvoidBottomPadding: true,
74
+      resizeToAvoidBottomInset: false,
75 75
       appBar: AppBar(
76 76
         title: ZefyrLogo(),
77 77
         actions: [
@@ -84,9 +84,10 @@ class _FullPageEditorScreenState extends State<FullPageEditorScreen> {
84 84
       ),
85 85
       body: ZefyrScaffold(
86 86
         child: ZefyrEditor(
87
+          autofocus: false,
87 88
           controller: _controller,
88 89
           focusNode: _focusNode,
89
-          mode: _editing ? ZefyrMode.edit : ZefyrMode.select,
90
+          mode: ZefyrMode.edit,
90 91
           imageDelegate: CustomImageDelegate(),
91 92
           keyboardAppearance: _darkTheme ? Brightness.dark : Brightness.light,
92 93
         ),
@@ -95,7 +96,16 @@ class _FullPageEditorScreenState extends State<FullPageEditorScreen> {
95 96
     if (_darkTheme) {
96 97
       return Theme(data: ThemeData.dark(), child: result);
97 98
     }
98
-    return Theme(data: ThemeData(primarySwatch: Colors.cyan), child: result);
99
+    return GestureDetector(
100
+      behavior: HitTestBehavior.translucent,
101
+      onTap: () {
102
+        _focusNode.unfocus();
103
+      },
104
+      child: Theme(
105
+        data: ThemeData(primarySwatch: Colors.cyan),
106
+        child: result,
107
+      ),
108
+    );
99 109
   }
100 110
 
101 111
   void handlePopupItemSelected(value) {

+ 0
- 4
packages/zefyr/example/pubspec.yaml View File

@@ -51,10 +51,6 @@ flutter:
51 51
   # "family" key with the font family name, and a "fonts" key with a
52 52
   # list giving the asset and other descriptors for the font. For
53 53
   # example:
54
-  fonts:
55
-    - family: ZefyrFont
56
-      fonts:
57
-        - asset: ../lib/fonts/iconfont.ttf
58 54
   #   - family: Trajan Pro
59 55
   #     fonts:
60 56
   #       - asset: fonts/TrajanPro.ttf

BIN
packages/zefyr/lib/fonts/iconfont.ttf → packages/zefyr/lib/fonts/zefyrfont.ttf View File


+ 8
- 10
packages/zefyr/lib/src/widgets/__theme.dart View File

@@ -282,10 +282,10 @@ class StyleTheme {
282 282
 /// Defines styles and colors for [ZefyrToolbar].
283 283
 class ZefyrToolbarTheme {
284 284
   /// The background color of toolbar.
285
-  final Color color;
285
+  final Color backgroundColor;
286 286
 
287 287
   /// Color of buttons in toggled state.
288
-  final Color toggleColor;
288
+  final Color primaryColor;
289 289
 
290 290
   /// Color of button icons.
291 291
   final Color iconColor;
@@ -297,10 +297,8 @@ class ZefyrToolbarTheme {
297 297
   factory ZefyrToolbarTheme.fallback(BuildContext context) {
298 298
     final theme = Theme.of(context);
299 299
     return ZefyrToolbarTheme._(
300
-      color: theme.primaryColorBrightness == Brightness.light
301
-          ? Colors.grey.shade300
302
-          : Colors.grey.shade800,
303
-      toggleColor: theme.primaryColorBrightness == Brightness.light
300
+      backgroundColor: theme.brightness == Brightness.light ? Color(0xFFFFFFFF) : Color(0xFF282828),
301
+      primaryColor: theme.brightness == Brightness.light
304 302
           ? Colors.grey.shade400
305 303
           : Colors.grey.shade900,
306 304
       iconColor: theme.primaryIconTheme.color,
@@ -309,8 +307,8 @@ class ZefyrToolbarTheme {
309 307
   }
310 308
 
311 309
   ZefyrToolbarTheme._({
312
-    @required this.color,
313
-    @required this.toggleColor,
310
+    @required this.backgroundColor,
311
+    @required this.primaryColor,
314 312
     @required this.iconColor,
315 313
     @required this.disabledIconColor,
316 314
   });
@@ -322,8 +320,8 @@ class ZefyrToolbarTheme {
322 320
     Color disabledIconColor,
323 321
   }) {
324 322
     return ZefyrToolbarTheme._(
325
-      color: color ?? this.color,
326
-      toggleColor: toggleColor ?? this.toggleColor,
323
+      backgroundColor: color ?? this.backgroundColor,
324
+      primaryColor: toggleColor ?? this.primaryColor,
327 325
       iconColor: iconColor ?? this.iconColor,
328 326
       disabledIconColor: disabledIconColor ?? this.disabledIconColor,
329 327
     );

+ 141
- 129
packages/zefyr/lib/src/widgets/buttons.dart View File

@@ -7,14 +7,26 @@ import 'dart:typed_data';
7 7
 import 'package:flutter/material.dart';
8 8
 import 'package:flutter/services.dart';
9 9
 import 'package:notus/notus.dart';
10
+import 'package:photo/photo.dart';
10 11
 import 'package:photo_manager/photo_manager.dart';
11 12
 import 'package:url_launcher/url_launcher.dart';
12
-import 'package:zefyr/src/widgets/gallery_item.dart';
13 13
 
14 14
 import 'scope.dart';
15 15
 import 'theme.dart';
16 16
 import 'toolbar.dart';
17 17
 
18
+const kToolbarButtonIcons = [
19
+  ZefyrToolbarAction.text,
20
+  ZefyrToolbarAction.heading,
21
+  ZefyrToolbarAction.emoji,
22
+  ZefyrToolbarAction.image,
23
+  ZefyrToolbarAction.link,
24
+  ZefyrToolbarAction.hideKeyboard,
25
+  ZefyrToolbarAction.showKeyboard,
26
+  ZefyrToolbarAction.close,
27
+  ZefyrToolbarAction.confirm,
28
+];
29
+
18 30
 /// A button used in [ZefyrToolbar].
19 31
 ///
20 32
 /// Create an instance of this widget with [ZefyrButton.icon] or
@@ -88,7 +100,9 @@ class ZefyrButton extends StatelessWidget {
88 100
     } else {
89 101
       assert(_text != null);
90 102
       var style = _textStyle ?? TextStyle();
91
-      style = style.copyWith(color: _getColor(editor, toolbarTheme),);
103
+      style = style.copyWith(
104
+        color: _getColor(editor, toolbarTheme),
105
+      );
92 106
       return RawZefyrButton(
93 107
         action: action,
94 108
         child: Text(_text, style: style),
@@ -110,7 +124,7 @@ class ZefyrButton extends StatelessWidget {
110 124
   }
111 125
 
112 126
   Color _getFillColor(ZefyrToolbarAction action, ToolbarTheme theme) {
113
-    if (action == ZefyrToolbarAction.text || action == ZefyrToolbarAction.heading || action == ZefyrToolbarAction.hideKeyboard || action == ZefyrToolbarAction.emoji || action == ZefyrToolbarAction.image || action == ZefyrToolbarAction.link) {
127
+    if (kToolbarButtonIcons.contains(action)) {
114 128
       return theme.color;
115 129
     }
116 130
     return theme.iconFillColor;
@@ -128,7 +142,9 @@ class ZefyrButton extends StatelessWidget {
128 142
     } else if (action == ZefyrToolbarAction.close) {
129 143
       return () => toolbar.closeOverlay();
130 144
     } else if (action == ZefyrToolbarAction.hideKeyboard) {
131
-      return () => editor.hideKeyboard();
145
+      return () => editor.closeKeyboard();
146
+    } else if (action == ZefyrToolbarAction.showKeyboard) {
147
+      return () => toolbar.closeOverlay();
132 148
     }
133 149
 
134 150
     return null;
@@ -189,21 +205,33 @@ class RawZefyrButton extends StatelessWidget {
189 205
   Widget build(BuildContext context) {
190 206
     final theme = Theme.of(context);
191 207
     final constraints = theme.buttonTheme.constraints.copyWith(
192
-      minWidth: 64, minHeight: 40, maxHeight: 40,
208
+      minWidth: 64,
209
+      minHeight: 40,
210
+      maxHeight: 40,
193 211
     );
194 212
     var radius = BorderRadius.all(Radius.circular(0));
195
-    if (action == ZefyrToolbarAction.headingLevel1 || action == ZefyrToolbarAction.bold || action == ZefyrToolbarAction.numberList) {
213
+    if (action == ZefyrToolbarAction.headingLevel1 ||
214
+        action == ZefyrToolbarAction.bold ||
215
+        action == ZefyrToolbarAction.numberList) {
196 216
       radius = BorderRadius.horizontal(left: Radius.circular(4));
197 217
     }
198
-    if (action == ZefyrToolbarAction.headingLevel6 || action == ZefyrToolbarAction.deleteline || action == ZefyrToolbarAction.bulletList) {
218
+    if (action == ZefyrToolbarAction.headingLevel6 ||
219
+        action == ZefyrToolbarAction.deleteline ||
220
+        action == ZefyrToolbarAction.bulletList) {
199 221
       radius = BorderRadius.horizontal(left: Radius.circular(4));
200 222
     }
201
-    if (action == ZefyrToolbarAction.quote || action == ZefyrToolbarAction.horizontalRule || action == ZefyrToolbarAction.code) {
223
+    if (action == ZefyrToolbarAction.quote ||
224
+        action == ZefyrToolbarAction.horizontalRule ||
225
+        action == ZefyrToolbarAction.code) {
202 226
       radius = BorderRadius.all(Radius.circular(4));
203 227
     }
204 228
     return Padding(
205
-      padding: const EdgeInsets.symmetric(horizontal: 1.0, vertical: 6.0).copyWith(
206
-        left: action == ZefyrToolbarAction.code || action == ZefyrToolbarAction.quote ? 12.0 : 1.0,
229
+      padding:
230
+          const EdgeInsets.symmetric(horizontal: 1.0, vertical: 6.0).copyWith(
231
+        left: action == ZefyrToolbarAction.code ||
232
+                action == ZefyrToolbarAction.quote
233
+            ? 12.0
234
+            : 1.0,
207 235
       ),
208 236
       child: RawMaterialButton(
209 237
         shape: RoundedRectangleBorder(borderRadius: radius),
@@ -283,11 +311,9 @@ class _HeadingButtonState extends State<HeadingButton> {
283 311
     ];
284 312
     return Material(
285 313
       color: theme.color,
286
-          child: Container(
314
+      child: Container(
287 315
         decoration: BoxDecoration(
288
-          border: Border(
289
-            top: BorderSide(color: theme.dividerColor, width: 1)
290
-          ),
316
+          border: Border(top: BorderSide(color: theme.dividerColor, width: 1)),
291 317
         ),
292 318
         child: Column(
293 319
           children: [
@@ -305,8 +331,7 @@ class _HeadingButtonState extends State<HeadingButton> {
305 331
             Container(
306 332
               decoration: BoxDecoration(
307 333
                 border: Border(
308
-                  top: BorderSide(color: theme.dividerColor, width: 1)
309
-                ),
334
+                    top: BorderSide(color: theme.dividerColor, width: 1)),
310 335
               ),
311 336
               padding: EdgeInsets.symmetric(vertical: 16),
312 337
               margin: EdgeInsets.symmetric(horizontal: 16),
@@ -314,11 +339,14 @@ class _HeadingButtonState extends State<HeadingButton> {
314 339
                 children: <Widget>[
315 340
                   Padding(
316 341
                     padding: EdgeInsets.only(right: 12),
317
-                    child: Text('文字色', style: Theme.of(context).textTheme.caption.copyWith(
318
-                      color: Theme.of(context).colorScheme.onSurface,
319
-                      fontSize: 14,
320
-                      fontWeight: FontWeight.w500,
321
-                    ),),
342
+                    child: Text(
343
+                      '文字色',
344
+                      style: Theme.of(context).textTheme.caption.copyWith(
345
+                            color: Theme.of(context).colorScheme.onSurface,
346
+                            fontSize: 14,
347
+                            fontWeight: FontWeight.w500,
348
+                          ),
349
+                    ),
322 350
                   ),
323 351
                   Expanded(
324 352
                     child: Container(
@@ -330,7 +358,8 @@ class _HeadingButtonState extends State<HeadingButton> {
330 358
                             padding: EdgeInsets.all(1),
331 359
                             decoration: ShapeDecoration(
332 360
                               shape: CircleBorder(
333
-                                side: BorderSide(width: 1, color: theme.toggleColor),
361
+                                side: BorderSide(
362
+                                    width: 1, color: theme.toggleColor),
334 363
                               ),
335 364
                             ),
336 365
                             margin: EdgeInsets.symmetric(horizontal: 8),
@@ -396,31 +425,6 @@ class _HeadingButtonState extends State<HeadingButton> {
396 425
   }
397 426
 }
398 427
 
399
-// TODO(lucky1213): image预览这个无效
400
-extension AssetEntityExtension on AssetEntity {
401
-  static String idd;
402
-  static Uint8List _cacheThumbData;
403
-
404
-  Future<Uint8List> getThumbData() async {
405
-      print((idd ?? '') != id);
406
-      print(id);
407
-    if ((idd ?? '') != id) {
408
-      idd = id;
409
-      _cacheThumbData = await thumbData;
410
-      return thumbData;
411
-    } else {
412
-      print(idd);
413
-      return _cacheThumbData;
414
-    }
415
-    if (_cacheThumbData == null) {
416
-      _cacheThumbData = await thumbData;
417
-      return thumbData;
418
-    } else {
419
-      return _cacheThumbData;
420
-    }
421
-  }
422
-}
423
-
424 428
 /// Controls image attribute.
425 429
 ///
426 430
 /// When pressed, this button displays overlay toolbar with three
@@ -433,7 +437,6 @@ class ImageButton extends StatefulWidget {
433 437
 }
434 438
 
435 439
 class _ImageButtonState extends State<ImageButton> {
436
-  List<AssetEntity> assetList = [];
437 440
   @override
438 441
   Widget build(BuildContext context) {
439 442
     final toolbar = ZefyrToolbar.of(context);
@@ -449,8 +452,6 @@ class _ImageButtonState extends State<ImageButton> {
449 452
     if (Platform.isIOS || Platform.isAndroid) {
450 453
       var result = await PhotoManager.requestPermission();
451 454
       if (result) {
452
-        var list = await PhotoManager.getAssetPathList(onlyAll: true, type: RequestType.image);
453
-        assetList = await list[0].assetList;
454 455
         return toolbar.showOverlay(buildOverlay);
455 456
       } else {
456 457
         PhotoManager.openSetting();
@@ -463,19 +464,9 @@ class _ImageButtonState extends State<ImageButton> {
463 464
   Widget buildOverlay(BuildContext context) {
464 465
     final theme = ZefyrTheme.of(context).toolbarTheme;
465 466
     final toolbar = ZefyrToolbar.of(context);
466
-    final buttons = Row(
467
-      children: <Widget>[
468
-        SizedBox(width: 8.0),
469
-        toolbar.buildButton(context, ZefyrToolbarAction.cameraImage,
470
-            onPressed: _pickFromCamera),
471
-        toolbar.buildButton(context, ZefyrToolbarAction.galleryImage,
472
-            onPressed: _pickFromGallery),
473
-      ],
474
-    );
475 467
     return Material(
476 468
       color: theme.color,
477 469
       child: Container(
478
-        height: 260,
479 470
         child: Column(
480 471
           children: <Widget>[
481 472
             Expanded(
@@ -494,65 +485,86 @@ class _ImageButtonState extends State<ImageButton> {
494 485
                         children: [
495 486
                           Expanded(
496 487
                             child: FlatButton(
497
-                              shape: RoundedRectangleBorder(),
498
-                              color: Color(0xFFF6F6F6),
499
-                              onPressed: () {
500
-
501
-                              }, 
502
-                              child: Container(
503
-                                child: Column(
504
-                                  mainAxisAlignment: MainAxisAlignment.center,
505
-                                  children: [
506
-                                    Icon(kDefaultButtonIcons[ZefyrToolbarAction.cameraImage], size: 24, color: Color(0xFFBFBFBF),),
507
-                                    Padding(
508
-                                      padding: EdgeInsets.only(top: 6),
509
-                                      child: Text('拍照', style: TextStyle(
510
-                                        fontSize: 12,
511
-                                        color: Color(0xFF8C8C8C),
512
-                                      ),),
513
-                                    )
514
-                                  ],
515
-                                ),
516
-                              )
517
-                            ),
488
+                                shape: RoundedRectangleBorder(),
489
+                                color: Color(0xFFF6F6F6),
490
+                                onPressed: () {},
491
+                                child: Container(
492
+                                  child: Column(
493
+                                    mainAxisAlignment: MainAxisAlignment.center,
494
+                                    children: [
495
+                                      Icon(
496
+                                        kDefaultButtonIcons[
497
+                                            ZefyrToolbarAction.cameraImage],
498
+                                        size: 24,
499
+                                        color: Color(0xFFBFBFBF),
500
+                                      ),
501
+                                      Padding(
502
+                                        padding: EdgeInsets.only(top: 6),
503
+                                        child: Text(
504
+                                          '拍照',
505
+                                          style: TextStyle(
506
+                                            fontSize: 12,
507
+                                            color: Color(0xFF8C8C8C),
508
+                                          ),
509
+                                        ),
510
+                                      )
511
+                                    ],
512
+                                  ),
513
+                                )),
518 514
                           ),
519 515
                           Expanded(
520 516
                             child: FlatButton(
521
-                              shape: RoundedRectangleBorder(),
522
-                              color: Color(0xFFF6F6F6),
523
-                              onPressed: () {
524
-
525
-                              }, 
526
-                              child: Container(
527
-                                child: Column(
528
-                                  mainAxisAlignment: MainAxisAlignment.center,
529
-                                  children: [
530
-                                    Icon(kDefaultButtonIcons[ZefyrToolbarAction.galleryImage], size: 24, color: Color(0xFFBFBFBF),),
531
-                                    Padding(
532
-                                      padding: EdgeInsets.only(top: 6),
533
-                                      child: Text('相册', style: TextStyle(
534
-                                        fontSize: 12,
535
-                                        color: Color(0xFF8C8C8C),
536
-                                      ),),
537
-                                    )
538
-                                  ],
539
-                                ),
540
-                              )
541
-                            ),
517
+                                shape: RoundedRectangleBorder(),
518
+                                color: Color(0xFFF6F6F6),
519
+                                onPressed: () async {
520
+                                  List<AssetEntity> imgList = await PhotoPicker.pickAsset(
521
+                                    context: context,
522
+                                    rowCount: 4,
523
+                                    itemRadio: 1,
524
+                                    padding: 4,
525
+                                    provider: I18nProvider.chinese,
526
+                                    sortDelegate: SortDelegate.common,
527
+                                    pickType: PickType.onlyImage,
528
+                                    photoPathList: null,
529
+                                  );
530
+                                  print(imgList);
531
+                                },
532
+                                child: Container(
533
+                                  child: Column(
534
+                                    mainAxisAlignment: MainAxisAlignment.center,
535
+                                    children: [
536
+                                      Icon(
537
+                                        kDefaultButtonIcons[
538
+                                            ZefyrToolbarAction.galleryImage],
539
+                                        size: 24,
540
+                                        color: Color(0xFFBFBFBF),
541
+                                      ),
542
+                                      Padding(
543
+                                        padding: EdgeInsets.only(top: 6),
544
+                                        child: Text(
545
+                                          '相册',
546
+                                          style: TextStyle(
547
+                                            fontSize: 12,
548
+                                            color: Color(0xFF8C8C8C),
549
+                                          ),
550
+                                        ),
551
+                                      )
552
+                                    ],
553
+                                  ),
554
+                                )),
542 555
                           ),
543 556
                         ],
544 557
                       ),
545 558
                     ),
546 559
                     Expanded(
547
-                      child: ListView.builder(
548
-                        key: ValueKey(assetList.length),
549
-                        scrollDirection: Axis.horizontal,
550
-                        physics: ClampingScrollPhysics(),
551
-                        itemCount: assetList.length,
552
-                        itemExtent: 122,
553
-                        itemBuilder: (context, index) {
554
-                          return GalleryItem(key: ObjectKey(assetList[index].id), asset: assetList[index],);
555
-                        },
560
+                      child: PhotoPicker.buildGallery(
561
+                        context: context,
562
+                        itemWidth: (toolbar.keyboardHeight - 50) * 0.5,
563
+                        padding: 4,
564
+                        provider: I18nProvider.chinese,
565
+                        sortDelegate: SortDelegate.common,
566
+                        pickType: PickType.onlyImage,
567
+                        photoPathList: null,
556 568
                       ),
557 569
                     ),
558 570
                   ],
@@ -572,19 +584,18 @@ class _ImageButtonState extends State<ImageButton> {
572 584
                           width: 16,
573 585
                           height: 16,
574 586
                           child: Radio<bool>(
575
-                            value: false, 
576
-                            groupValue: false, 
577
-                            onChanged: (bool result) {
578
-
579
-                            },
587
+                            value: false,
588
+                            groupValue: false,
589
+                            onChanged: (bool result) {},
580 590
                           ),
581 591
                         ),
582 592
                         Padding(
583 593
                           padding: EdgeInsets.symmetric(horizontal: 8),
584
-                          child: Text('原图', style: TextStyle(
585
-                            color: theme.iconColor,
586
-                            fontSize: 16
587
-                          ),),
594
+                          child: Text(
595
+                            '原图',
596
+                            style:
597
+                                TextStyle(color: theme.iconColor, fontSize: 16),
598
+                          ),
588 599
                         ),
589 600
                       ],
590 601
                     ),
@@ -593,17 +604,18 @@ class _ImageButtonState extends State<ImageButton> {
593 604
                     padding: EdgeInsets.zero,
594 605
                     color: theme.toggleColor,
595 606
                     shape: StadiumBorder(),
596
-                    onPressed: () {
597
-
598
-                    }, 
607
+                    onPressed: () {},
599 608
                     child: Container(
600 609
                       height: 30,
601 610
                       alignment: Alignment.center,
602 611
                       padding: EdgeInsets.symmetric(horizontal: 20),
603
-                      child: Text('上传 (2)', style: TextStyle(
604
-                        color: Colors.white,
605
-                        fontSize: 14,
606
-                      ),),
612
+                      child: Text(
613
+                        '上传 (2)',
614
+                        style: TextStyle(
615
+                          color: Colors.white,
616
+                          fontSize: 14,
617
+                        ),
618
+                      ),
607 619
                     ),
608 620
                   ),
609 621
                 ],
@@ -753,7 +765,7 @@ class _LinkButtonState extends State<LinkButton> {
753 765
     var link = getLink();
754 766
     assert(link != null);
755 767
     if (await canLaunch(link)) {
756
-      editor.hideKeyboard();
768
+      editor.closeKeyboard();
757 769
       await launch(link, forceWebView: true);
758 770
     }
759 771
   }
@@ -921,4 +933,4 @@ class _LinkView extends StatelessWidget {
921 933
     }
922 934
     return widget;
923 935
   }
924
-}
936
+}

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

@@ -6,6 +6,7 @@ import 'package:flutter/material.dart';
6 6
 import 'package:flutter/widgets.dart';
7 7
 import 'package:notus/notus.dart';
8 8
 
9
+import '../../zefyr.dart';
9 10
 import 'code.dart';
10 11
 import 'common.dart';
11 12
 import 'controller.dart';
@@ -38,6 +39,7 @@ class ZefyrEditableText extends StatefulWidget {
38 39
     this.selectionControls,
39 40
     this.autofocus = true,
40 41
     this.mode = ZefyrMode.edit,
42
+    @required this.input,
41 43
     this.padding = const EdgeInsets.symmetric(horizontal: 16.0),
42 44
     this.physics,
43 45
     this.keyboardAppearance = Brightness.light,
@@ -66,6 +68,8 @@ class ZefyrEditableText extends StatefulWidget {
66 68
   /// Editing mode of this text field.
67 69
   final ZefyrMode mode;
68 70
 
71
+  final InputConnectionController input;
72
+
69 73
   /// Controls physics of scrollable text field.
70 74
   final ScrollPhysics physics;
71 75
 
@@ -111,9 +115,13 @@ class _ZefyrEditableTextState extends State<ZefyrEditableText>
111 115
   /// focus, the control will then attach to the keyboard and request that the
112 116
   /// keyboard become visible.
113 117
   void requestKeyboard() {
118
+    final scope = ZefyrScope.of(context);
114 119
     if (_focusNode.hasFocus) {
115
-      _input.openConnection(
116
-          widget.controller.plainTextEditingValue, widget.keyboardAppearance);
120
+      var show = scope.toolbarStatus == ToolbarStatus.open ? false : true;
121
+      _input.openConnection(widget.controller.plainTextEditingValue, widget.keyboardAppearance, show: show);
122
+      if (show) {
123
+        print(MediaQuery.of(context).viewInsets.bottom);
124
+      }
117 125
     } else {
118 126
       FocusScope.of(context).requestFocus(_focusNode);
119 127
     }
@@ -171,7 +179,6 @@ class _ZefyrEditableTextState extends State<ZefyrEditableText>
171 179
     _focusNode = widget.focusNode;
172 180
     super.initState();
173 181
     _focusAttachment = _focusNode.attach(context);
174
-    _input = InputConnectionController(_handleRemoteValueChange);
175 182
     _updateSubscriptions();
176 183
   }
177 184
 
@@ -225,7 +232,7 @@ class _ZefyrEditableTextState extends State<ZefyrEditableText>
225 232
   final ScrollController _scrollController = ScrollController();
226 233
   ZefyrRenderContext _renderContext;
227 234
   CursorTimer _cursorTimer;
228
-  InputConnectionController _input;
235
+  InputConnectionController get _input => widget.input;
229 236
   bool _didAutoFocus = false;
230 237
 
231 238
   List<Widget> _buildChildren(BuildContext context) {
@@ -304,7 +311,7 @@ class _ZefyrEditableTextState extends State<ZefyrEditableText>
304 311
 
305 312
   void _handleFocusChange() {
306 313
     _input.openOrCloseConnection(_focusNode,
307
-        widget.controller.plainTextEditingValue, widget.keyboardAppearance);
314
+        widget.controller.plainTextEditingValue, widget.keyboardAppearance, show: !_focusNode.consumeKeyboardToken());
308 315
     _cursorTimer.startOrStop(_focusNode, selection);
309 316
     updateKeepAlive();
310 317
   }

+ 4
- 0
packages/zefyr/lib/src/widgets/editor.dart View File

@@ -8,6 +8,7 @@ import 'package:flutter/widgets.dart';
8 8
 import 'controller.dart';
9 9
 import 'editable_text.dart';
10 10
 import 'image.dart';
11
+import 'input.dart';
11 12
 import 'mode.dart';
12 13
 import 'scaffold.dart';
13 14
 import 'scope.dart';
@@ -94,12 +95,14 @@ class _ZefyrEditorState extends State<ZefyrEditor> {
94 95
     assert(_toolbarKey == null);
95 96
     _toolbarKey = GlobalKey();
96 97
     _scaffold.showToolbar(buildToolbar);
98
+    _scope.toolbarStatus = ToolbarStatus.show;
97 99
   }
98 100
 
99 101
   void hideToolbar() {
100 102
     if (_toolbarKey == null) return;
101 103
     _scaffold.hideToolbar(buildToolbar);
102 104
     _toolbarKey = null;
105
+    _scope.toolbarStatus = ToolbarStatus.hide;
103 106
   }
104 107
 
105 108
   Widget buildToolbar(BuildContext context) {
@@ -197,6 +200,7 @@ class _ZefyrEditorState extends State<ZefyrEditor> {
197 200
       selectionControls: widget.selectionControls,
198 201
       autofocus: widget.autofocus,
199 202
       mode: widget.mode,
203
+      input: _scope.input,
200 204
       padding: widget.padding,
201 205
       physics: widget.physics,
202 206
       keyboardAppearance: keyboardAppearance,

+ 0
- 86
packages/zefyr/lib/src/widgets/gallery_item.dart View File

@@ -1,86 +0,0 @@
1
-import 'dart:typed_data';
2
-
3
-import 'package:flutter/material.dart';
4
-import 'package:photo_manager/photo_manager.dart';
5
-
6
-import 'iconfont.dart';
7
-import 'theme.dart';
8
-
9
-class GalleryItem extends StatefulWidget {
10
-  const GalleryItem({Key key, this.asset}) : super(key: key);
11
-  final AssetEntity asset;
12
-
13
-  @override
14
-  _GalleryItemState createState() => _GalleryItemState();
15
-}
16
-
17
-class _GalleryItemState extends State<GalleryItem> {
18
-  final ValueNotifier<bool> _checked = ValueNotifier<bool>(false);
19
-  Uint8List _thumbData;
20
-
21
-  @override
22
-  Widget build(BuildContext context) {
23
-    final theme = ZefyrTheme.of(context).toolbarTheme;
24
-    return Stack(
25
-      children: <Widget>[
26
-        GestureDetector(
27
-          behavior: HitTestBehavior.opaque,
28
-          child: Container(
29
-            height: 210,
30
-            margin: EdgeInsets.only(left: 4),
31
-            child: _thumbData != null
32
-                ? Image.memory(
33
-                    _thumbData,
34
-                    fit: BoxFit.cover,
35
-                  )
36
-                : FutureBuilder<Uint8List>(
37
-                    future: widget.asset.thumbData,
38
-                    builder: (BuildContext context, snapshot) {
39
-                      Widget w;
40
-                      if (snapshot.hasError) {
41
-                        w = ErrorWidget(snapshot.error);
42
-                      } else if (snapshot.hasData) {
43
-                        _thumbData = snapshot.data;
44
-                        w = Image.memory(
45
-                          snapshot.data,
46
-                          fit: BoxFit.cover,
47
-                        );
48
-                      } else {
49
-                        w = Center(
50
-                          child: Container(
51
-                            color: Colors.white,
52
-                            padding: const EdgeInsets.all(20),
53
-                            child: CircularProgressIndicator(),
54
-                          ),
55
-                        );
56
-                      }
57
-                      return w;
58
-                    },
59
-                  ),
60
-          ),
61
-          onTap: () {},
62
-        ),
63
-        Positioned(
64
-          top: 6,
65
-          right: 6,
66
-          child: ValueListenableBuilder(
67
-            valueListenable: _checked,
68
-            builder: (BuildContext context, bool value, Widget child) {
69
-              return GestureDetector(
70
-                behavior: HitTestBehavior.opaque,
71
-                onTap: () {
72
-                  _checked.value = !value;
73
-                },
74
-                child: Icon(
75
-                  IconFont.list_update_complete,
76
-                  size: 24,
77
-                  color: value ? theme.toggleColor : Colors.white,
78
-                ),
79
-              );
80
-            },
81
-          ),
82
-        ),
83
-      ],
84
-    );
85
-  }
86
-}

+ 184
- 183
packages/zefyr/lib/src/widgets/iconfont.dart View File

@@ -1,318 +1,319 @@
1 1
 import 'package:flutter/widgets.dart';
2 2
 
3
-class IconFont {
4
-  IconFont._();
3
+class ZefyrFont {
4
+  ZefyrFont._();
5 5
   static const String _family = 'ZefyrFont';
6
-  static const IconData global_language = IconData(0xe725, fontFamily: _family);
7
-	static const IconData light = IconData(0xe723, fontFamily: _family);
8
-	static const IconData checked = IconData(0xe724, fontFamily: _family);
9
-  static const IconData largetitle_dropdown = IconData(0xe722, fontFamily: _family);
10
-	static const IconData global_toast_loading_delete = IconData(0xe721, fontFamily: _family);
11
-	static const IconData toast_fail = IconData(0xe71e, fontFamily: _family);
12
-	static const IconData toast_success = IconData(0xe71f, fontFamily: _family);
13
-	static const IconData toast_loading = IconData(0xe720, fontFamily: _family);
14
-	static const IconData global_sidebar_profile = IconData(0xe71d, fontFamily: _family);
15
-	static const IconData lightmode = IconData(0xe71c, fontFamily: _family);
16
-	static const IconData salary_details_time = IconData(0xe71b, fontFamily: _family);
17
-	static const IconData share = IconData(0xe719, fontFamily: _family);
18
-	static const IconData btn_global_videoplay = IconData(0xe6c5, fontFamily: _family);
19
-	static const IconData im_groupdetails_archive = IconData(0xe6cf, fontFamily: _family);
20
-	static const IconData im_notice_arrow = IconData(0xe71a, fontFamily: _family);
21
-	static const IconData minus = IconData(0xe718, fontFamily: _family);
22
-	static const IconData staffdetails_review = IconData(0xe716, fontFamily: _family);
23
-	static const IconData staffdetails_salary = IconData(0xe717, fontFamily: _family);
6
+  static const String _fontPackage = 'zefyr';
7
+  static const IconData global_language = IconData(0xe725, fontFamily: _family , fontPackage: _fontPackage);
8
+	static const IconData light = IconData(0xe723, fontFamily: _family , fontPackage: _fontPackage);
9
+	static const IconData checked = IconData(0xe724, fontFamily: _family , fontPackage: _fontPackage);
10
+  static const IconData largetitle_dropdown = IconData(0xe722, fontFamily: _family , fontPackage: _fontPackage);
11
+	static const IconData global_toast_loading_delete = IconData(0xe721, fontFamily: _family , fontPackage: _fontPackage);
12
+	static const IconData toast_fail = IconData(0xe71e, fontFamily: _family , fontPackage: _fontPackage);
13
+	static const IconData toast_success = IconData(0xe71f, fontFamily: _family , fontPackage: _fontPackage);
14
+	static const IconData toast_loading = IconData(0xe720, fontFamily: _family , fontPackage: _fontPackage);
15
+	static const IconData global_sidebar_profile = IconData(0xe71d, fontFamily: _family , fontPackage: _fontPackage);
16
+	static const IconData lightmode = IconData(0xe71c, fontFamily: _family , fontPackage: _fontPackage);
17
+	static const IconData salary_details_time = IconData(0xe71b, fontFamily: _family , fontPackage: _fontPackage);
18
+	static const IconData share = IconData(0xe719, fontFamily: _family , fontPackage: _fontPackage);
19
+	static const IconData btn_global_videoplay = IconData(0xe6c5, fontFamily: _family , fontPackage: _fontPackage);
20
+	static const IconData im_groupdetails_archive = IconData(0xe6cf, fontFamily: _family , fontPackage: _fontPackage);
21
+	static const IconData im_notice_arrow = IconData(0xe71a, fontFamily: _family , fontPackage: _fontPackage);
22
+	static const IconData minus = IconData(0xe718, fontFamily: _family , fontPackage: _fontPackage);
23
+	static const IconData staffdetails_review = IconData(0xe716, fontFamily: _family , fontPackage: _fontPackage);
24
+	static const IconData staffdetails_salary = IconData(0xe717, fontFamily: _family , fontPackage: _fontPackage);
24 25
   static const IconData list_update_fail =
25
-      IconData(0xe715, fontFamily: _family);
26
+      IconData(0xe715, fontFamily: _family , fontPackage: _fontPackage);
26 27
   static const IconData list_update_complete =
27
-      IconData(0xe712, fontFamily: _family);
28
+      IconData(0xe712, fontFamily: _family , fontPackage: _fontPackage);
28 29
   static const IconData list_update_pull =
29
-      IconData(0xe713, fontFamily: _family);
30
+      IconData(0xe713, fontFamily: _family , fontPackage: _fontPackage);
30 31
   static const IconData list_update_loading =
31
-      IconData(0xe714, fontFamily: _family);
32
+      IconData(0xe714, fontFamily: _family , fontPackage: _fontPackage);
32 33
   static const IconData contact_organization =
33
-      IconData(0xe70d, fontFamily: _family);
34
+      IconData(0xe70d, fontFamily: _family , fontPackage: _fontPackage);
34 35
   static const IconData contact_outsider =
35
-      IconData(0xe70e, fontFamily: _family);
36
-  static const IconData contact_new = IconData(0xe70f, fontFamily: _family);
37
-  static const IconData contact_mygroup = IconData(0xe710, fontFamily: _family);
38
-  static const IconData contact_robot = IconData(0xe711, fontFamily: _family);
39
-  static const IconData note_createnote = IconData(0xe70b, fontFamily: _family);
36
+      IconData(0xe70e, fontFamily: _family , fontPackage: _fontPackage);
37
+  static const IconData contact_new = IconData(0xe70f, fontFamily: _family , fontPackage: _fontPackage);
38
+  static const IconData contact_mygroup = IconData(0xe710, fontFamily: _family , fontPackage: _fontPackage);
39
+  static const IconData contact_robot = IconData(0xe711, fontFamily: _family , fontPackage: _fontPackage);
40
+  static const IconData note_createnote = IconData(0xe70b, fontFamily: _family , fontPackage: _fontPackage);
40 41
   static const IconData note_createfolder =
41
-      IconData(0xe70c, fontFamily: _family);
42
-  static const IconData rating_full = IconData(0xe708, fontFamily: _family);
43
-  static const IconData rating_half = IconData(0xe709, fontFamily: _family);
44
-  static const IconData rating_unfull = IconData(0xe70a, fontFamily: _family);
42
+      IconData(0xe70c, fontFamily: _family , fontPackage: _fontPackage);
43
+  static const IconData rating_full = IconData(0xe708, fontFamily: _family , fontPackage: _fontPackage);
44
+  static const IconData rating_half = IconData(0xe709, fontFamily: _family , fontPackage: _fontPackage);
45
+  static const IconData rating_unfull = IconData(0xe70a, fontFamily: _family , fontPackage: _fontPackage);
45 46
   static const IconData note_searchfile_pre =
46
-      IconData(0xe706, fontFamily: _family);
47
+      IconData(0xe706, fontFamily: _family , fontPackage: _fontPackage);
47 48
   static const IconData note_searchfile_next =
48
-      IconData(0xe707, fontFamily: _family);
49
+      IconData(0xe707, fontFamily: _family , fontPackage: _fontPackage);
49 50
   static const IconData note_notelist_more =
50
-      IconData(0xe705, fontFamily: _family);
51
+      IconData(0xe705, fontFamily: _family , fontPackage: _fontPackage);
51 52
   static const IconData note_notelist_folder =
52
-      IconData(0xe700, fontFamily: _family);
53
+      IconData(0xe700, fontFamily: _family , fontPackage: _fontPackage);
53 54
   static const IconData note_notelist_emptyfolder =
54
-      IconData(0xe701, fontFamily: _family);
55
+      IconData(0xe701, fontFamily: _family , fontPackage: _fontPackage);
55 56
   static const IconData note_notelist_rubbish =
56
-      IconData(0xe702, fontFamily: _family);
57
+      IconData(0xe702, fontFamily: _family , fontPackage: _fontPackage);
57 58
   static const IconData note_notelist_note =
58
-      IconData(0xe703, fontFamily: _family);
59
+      IconData(0xe703, fontFamily: _family , fontPackage: _fontPackage);
59 60
   static const IconData note_notelist_savefolder =
60
-      IconData(0xe704, fontFamily: _family);
61
+      IconData(0xe704, fontFamily: _family , fontPackage: _fontPackage);
61 62
   static const IconData note_more_comment =
62
-      IconData(0xe6f7, fontFamily: _family);
63
+      IconData(0xe6f7, fontFamily: _family , fontPackage: _fontPackage);
63 64
   static const IconData note_more_history =
64
-      IconData(0xe6f8, fontFamily: _family);
65
-  static const IconData note_more_info = IconData(0xe6f9, fontFamily: _family);
65
+      IconData(0xe6f8, fontFamily: _family , fontPackage: _fontPackage);
66
+  static const IconData note_more_info = IconData(0xe6f9, fontFamily: _family , fontPackage: _fontPackage);
66 67
   static const IconData note_more_search =
67
-      IconData(0xe6fa, fontFamily: _family);
68
-  static const IconData note_more_copy = IconData(0xe6fb, fontFamily: _family);
69
-  static const IconData note_more_pin = IconData(0xe6fc, fontFamily: _family);
68
+      IconData(0xe6fa, fontFamily: _family , fontPackage: _fontPackage);
69
+  static const IconData note_more_copy = IconData(0xe6fb, fontFamily: _family , fontPackage: _fontPackage);
70
+  static const IconData note_more_pin = IconData(0xe6fc, fontFamily: _family , fontPackage: _fontPackage);
70 71
   static const IconData note_more_delete =
71
-      IconData(0xe6fd, fontFamily: _family);
72
+      IconData(0xe6fd, fontFamily: _family , fontPackage: _fontPackage);
72 73
   static const IconData note_more_favorite =
73
-      IconData(0xe6fe, fontFamily: _family);
74
-  static const IconData note_more_move = IconData(0xe6ff, fontFamily: _family);
74
+      IconData(0xe6fe, fontFamily: _family , fontPackage: _fontPackage);
75
+  static const IconData note_more_move = IconData(0xe6ff, fontFamily: _family , fontPackage: _fontPackage);
75 76
   static const IconData note_editor_text_h =
76
-      IconData(0xe6e4, fontFamily: _family);
77
+      IconData(0xe6e4, fontFamily: _family , fontPackage: _fontPackage);
77 78
   static const IconData note_editor_text_code =
78
-      IconData(0xe6e5, fontFamily: _family);
79
+      IconData(0xe6e5, fontFamily: _family , fontPackage: _fontPackage);
79 80
   static const IconData note_editor_text_bold =
80
-      IconData(0xe6e6, fontFamily: _family);
81
+      IconData(0xe6e6, fontFamily: _family , fontPackage: _fontPackage);
81 82
   static const IconData note_editor_text_h1 =
82
-      IconData(0xe6e7, fontFamily: _family);
83
+      IconData(0xe6e7, fontFamily: _family , fontPackage: _fontPackage);
83 84
   static const IconData note_editor_text_center =
84
-      IconData(0xe6e8, fontFamily: _family);
85
+      IconData(0xe6e8, fontFamily: _family , fontPackage: _fontPackage);
85 86
   static const IconData note_editor_text_deleteline =
86
-      IconData(0xe6e9, fontFamily: _family);
87
+      IconData(0xe6e9, fontFamily: _family , fontPackage: _fontPackage);
87 88
   static const IconData note_editor_text_left =
88
-      IconData(0xe6ea, fontFamily: _family);
89
+      IconData(0xe6ea, fontFamily: _family , fontPackage: _fontPackage);
89 90
   static const IconData note_editor_text_h2 =
90
-      IconData(0xe6eb, fontFamily: _family);
91
+      IconData(0xe6eb, fontFamily: _family , fontPackage: _fontPackage);
91 92
   static const IconData note_editor_text_h3 =
92
-      IconData(0xe6ec, fontFamily: _family);
93
+      IconData(0xe6ec, fontFamily: _family , fontPackage: _fontPackage);
93 94
   static const IconData note_editor_text_right =
94
-      IconData(0xe6ed, fontFamily: _family);
95
+      IconData(0xe6ed, fontFamily: _family , fontPackage: _fontPackage);
95 96
   static const IconData note_editor_text_hr =
96
-      IconData(0xe6ee, fontFamily: _family);
97
+      IconData(0xe6ee, fontFamily: _family , fontPackage: _fontPackage);
97 98
   static const IconData note_editor_text_h4 =
98
-      IconData(0xe6ef, fontFamily: _family);
99
+      IconData(0xe6ef, fontFamily: _family , fontPackage: _fontPackage);
99 100
   static const IconData note_editor_text_underline =
100
-      IconData(0xe6f0, fontFamily: _family);
101
+      IconData(0xe6f0, fontFamily: _family , fontPackage: _fontPackage);
101 102
   static const IconData note_editor_text_ul =
102
-      IconData(0xe6f1, fontFamily: _family);
103
+      IconData(0xe6f1, fontFamily: _family , fontPackage: _fontPackage);
103 104
   static const IconData note_editor_text_quote =
104
-      IconData(0xe6f2, fontFamily: _family);
105
+      IconData(0xe6f2, fontFamily: _family , fontPackage: _fontPackage);
105 106
   static const IconData note_editor_text_in =
106
-      IconData(0xe6f3, fontFamily: _family);
107
+      IconData(0xe6f3, fontFamily: _family , fontPackage: _fontPackage);
107 108
   static const IconData note_editor_text_h5 =
108
-      IconData(0xe6f4, fontFamily: _family);
109
+      IconData(0xe6f4, fontFamily: _family , fontPackage: _fontPackage);
109 110
   static const IconData note_editor_text_para =
110
-      IconData(0xe6f5, fontFamily: _family);
111
+      IconData(0xe6f5, fontFamily: _family , fontPackage: _fontPackage);
111 112
   static const IconData note_editor_text_ol =
112
-      IconData(0xe6f6, fontFamily: _family);
113
+      IconData(0xe6f6, fontFamily: _family , fontPackage: _fontPackage);
113 114
   static const IconData note_editor_unkeyboard =
114
-      IconData(0xe6dc, fontFamily: _family);
115
+      IconData(0xe6dc, fontFamily: _family , fontPackage: _fontPackage);
115 116
   static const IconData note_editor_keyboard =
116
-      IconData(0xe6dd, fontFamily: _family);
117
+      IconData(0xe6dd, fontFamily: _family , fontPackage: _fontPackage);
117 118
   static const IconData note_editor_redo =
118
-      IconData(0xe6de, fontFamily: _family);
119
+      IconData(0xe6de, fontFamily: _family , fontPackage: _fontPackage);
119 120
   static const IconData note_editor_undo =
120
-      IconData(0xe6df, fontFamily: _family);
121
+      IconData(0xe6df, fontFamily: _family , fontPackage: _fontPackage);
121 122
   static const IconData note_editor_text =
122
-      IconData(0xe6e0, fontFamily: _family);
123
+      IconData(0xe6e0, fontFamily: _family , fontPackage: _fontPackage);
123 124
   static const IconData note_editor_image =
124
-      IconData(0xe6e1, fontFamily: _family);
125
+      IconData(0xe6e1, fontFamily: _family , fontPackage: _fontPackage);
125 126
   static const IconData note_editor_link =
126
-      IconData(0xe6e2, fontFamily: _family);
127
+      IconData(0xe6e2, fontFamily: _family , fontPackage: _fontPackage);
127 128
   static const IconData note_editor_save =
128
-      IconData(0xe6e3, fontFamily: _family);
129
+      IconData(0xe6e3, fontFamily: _family , fontPackage: _fontPackage);
129 130
   static const IconData desktop_todolist_warning =
130
-      IconData(0xe6d8, fontFamily: _family);
131
+      IconData(0xe6d8, fontFamily: _family , fontPackage: _fontPackage);
131 132
   static const IconData desktop_global_calender =
132
-      IconData(0xe6d9, fontFamily: _family);
133
+      IconData(0xe6d9, fontFamily: _family , fontPackage: _fontPackage);
133 134
   static const IconData desktop_global_repeat =
134
-      IconData(0xe6da, fontFamily: _family);
135
+      IconData(0xe6da, fontFamily: _family , fontPackage: _fontPackage);
135 136
   static const IconData desktop_global_important =
136
-      IconData(0xe6db, fontFamily: _family);
137
+      IconData(0xe6db, fontFamily: _family , fontPackage: _fontPackage);
137 138
   static const IconData startpage_jointeam =
138
-      IconData(0xe6d6, fontFamily: _family);
139
+      IconData(0xe6d6, fontFamily: _family , fontPackage: _fontPackage);
139 140
   static const IconData startpage_creatteam =
140
-      IconData(0xe6d7, fontFamily: _family);
141
+      IconData(0xe6d7, fontFamily: _family , fontPackage: _fontPackage);
141 142
   static const IconData staffdetails_videocall =
142
-      IconData(0xe6d3, fontFamily: _family);
143
+      IconData(0xe6d3, fontFamily: _family , fontPackage: _fontPackage);
143 144
   static const IconData staffdetails_voicecall =
144
-      IconData(0xe6d4, fontFamily: _family);
145
+      IconData(0xe6d4, fontFamily: _family , fontPackage: _fontPackage);
145 146
   static const IconData staffdetails_sendmessage =
146
-      IconData(0xe6d5, fontFamily: _family);
147
+      IconData(0xe6d5, fontFamily: _family , fontPackage: _fontPackage);
147 148
   static const IconData staffdetails_job =
148
-      IconData(0xe6d0, fontFamily: _family);
149
+      IconData(0xe6d0, fontFamily: _family , fontPackage: _fontPackage);
149 150
   static const IconData staffdetails_contact =
150
-      IconData(0xe6d1, fontFamily: _family);
151
+      IconData(0xe6d1, fontFamily: _family , fontPackage: _fontPackage);
151 152
   static const IconData staffdetails_basic =
152
-      IconData(0xe6d2, fontFamily: _family);
153
+      IconData(0xe6d2, fontFamily: _family , fontPackage: _fontPackage);
153 154
   static const IconData selectpeople_delete =
154
-      IconData(0xe6cf, fontFamily: _family);
155
+      IconData(0xe6cf, fontFamily: _family , fontPackage: _fontPackage);
155 156
   static const IconData im_comment_empty =
156
-      IconData(0xe6ce, fontFamily: _family);
157
+      IconData(0xe6ce, fontFamily: _family , fontPackage: _fontPackage);
157 158
   static const IconData im_filebar_download =
158
-      IconData(0xe6c8, fontFamily: _family);
159
+      IconData(0xe6c8, fontFamily: _family , fontPackage: _fontPackage);
159 160
   static const IconData im_filebar_favorite_faved =
160
-      IconData(0xe6c9, fontFamily: _family);
161
+      IconData(0xe6c9, fontFamily: _family , fontPackage: _fontPackage);
161 162
   static const IconData im_filebar_forward =
162
-      IconData(0xe6ca, fontFamily: _family);
163
+      IconData(0xe6ca, fontFamily: _family , fontPackage: _fontPackage);
163 164
   static const IconData im_filebar_comment =
164
-      IconData(0xe6cb, fontFamily: _family);
165
+      IconData(0xe6cb, fontFamily: _family , fontPackage: _fontPackage);
165 166
   static const IconData im_filebar_delete =
166
-      IconData(0xe6cc, fontFamily: _family);
167
+      IconData(0xe6cc, fontFamily: _family , fontPackage: _fontPackage);
167 168
   static const IconData im_filebar_favorite_unfav =
168
-      IconData(0xe6cd, fontFamily: _family);
169
+      IconData(0xe6cd, fontFamily: _family , fontPackage: _fontPackage);
169 170
   static const IconData im_groupdetails_edit =
170
-      IconData(0xe6c5, fontFamily: _family);
171
+      IconData(0xe6c5, fontFamily: _family , fontPackage: _fontPackage);
171 172
   static const IconData im_groupdetails_member =
172
-      IconData(0xe6c6, fontFamily: _family);
173
+      IconData(0xe6c6, fontFamily: _family , fontPackage: _fontPackage);
173 174
   static const IconData im_groupdetails_robot =
174
-      IconData(0xe6c7, fontFamily: _family);
175
+      IconData(0xe6c7, fontFamily: _family , fontPackage: _fontPackage);
175 176
   static const IconData im_groupdetails_file =
176
-      IconData(0xe6c1, fontFamily: _family);
177
+      IconData(0xe6c1, fontFamily: _family , fontPackage: _fontPackage);
177 178
   static const IconData im_groupdetails_history =
178
-      IconData(0xe6c2, fontFamily: _family);
179
+      IconData(0xe6c2, fontFamily: _family , fontPackage: _fontPackage);
179 180
   static const IconData im_groupdetails_pin =
180
-      IconData(0xe6c3, fontFamily: _family);
181
+      IconData(0xe6c3, fontFamily: _family , fontPackage: _fontPackage);
181 182
   static const IconData im_groupdetails_board =
182
-      IconData(0xe6c4, fontFamily: _family);
183
+      IconData(0xe6c4, fontFamily: _family , fontPackage: _fontPackage);
183 184
   static const IconData im_list_nodisturb =
184
-      IconData(0xe6c0, fontFamily: _family);
185
+      IconData(0xe6c0, fontFamily: _family , fontPackage: _fontPackage);
185 186
   static const IconData im_videocall_camera =
186
-      IconData(0xe6ba, fontFamily: _family);
187
+      IconData(0xe6ba, fontFamily: _family , fontPackage: _fontPackage);
187 188
   static const IconData im_voicecall_sound =
188
-      IconData(0xe6bb, fontFamily: _family);
189
+      IconData(0xe6bb, fontFamily: _family , fontPackage: _fontPackage);
189 190
   static const IconData im_videocall_stretch =
190
-      IconData(0xe6bc, fontFamily: _family);
191
+      IconData(0xe6bc, fontFamily: _family , fontPackage: _fontPackage);
191 192
   static const IconData im_voicecall_video =
192
-      IconData(0xe6bd, fontFamily: _family);
193
+      IconData(0xe6bd, fontFamily: _family , fontPackage: _fontPackage);
193 194
   static const IconData im_videocall_voice =
194
-      IconData(0xe6be, fontFamily: _family);
195
+      IconData(0xe6be, fontFamily: _family , fontPackage: _fontPackage);
195 196
   static const IconData im_voicecall_mute =
196
-      IconData(0xe6bf, fontFamily: _family);
197
+      IconData(0xe6bf, fontFamily: _family , fontPackage: _fontPackage);
197 198
   static const IconData im_sidebar_favorite =
198
-      IconData(0xe6b6, fontFamily: _family);
199
-  static const IconData im_sidebar_file = IconData(0xe6b7, fontFamily: _family);
200
-  static const IconData im_sidebar_at = IconData(0xe6b8, fontFamily: _family);
199
+      IconData(0xe6b6, fontFamily: _family , fontPackage: _fontPackage);
200
+  static const IconData im_sidebar_file = IconData(0xe6b7, fontFamily: _family , fontPackage: _fontPackage);
201
+  static const IconData im_sidebar_at = IconData(0xe6b8, fontFamily: _family , fontPackage: _fontPackage);
201 202
   static const IconData im_sidebar_notice =
202
-      IconData(0xe6b9, fontFamily: _family);
203
+      IconData(0xe6b9, fontFamily: _family , fontPackage: _fontPackage);
203 204
   static const IconData im_dialoge_more_voicecall =
204
-      IconData(0xe6af, fontFamily: _family);
205
+      IconData(0xe6af, fontFamily: _family , fontPackage: _fontPackage);
205 206
   static const IconData im_dialoge_more_takephoto =
206
-      IconData(0xe6b0, fontFamily: _family);
207
+      IconData(0xe6b0, fontFamily: _family , fontPackage: _fontPackage);
207 208
   static const IconData im_dialoge_more_album =
208
-      IconData(0xe6b1, fontFamily: _family);
209
+      IconData(0xe6b1, fontFamily: _family , fontPackage: _fontPackage);
209 210
   static const IconData im_dialoge_more_note =
210
-      IconData(0xe6b2, fontFamily: _family);
211
+      IconData(0xe6b2, fontFamily: _family , fontPackage: _fontPackage);
211 212
   static const IconData im_dialoge_more_task =
212
-      IconData(0xe6b3, fontFamily: _family);
213
+      IconData(0xe6b3, fontFamily: _family , fontPackage: _fontPackage);
213 214
   static const IconData im_dialoge_more_videocall =
214
-      IconData(0xe6b4, fontFamily: _family);
215
+      IconData(0xe6b4, fontFamily: _family , fontPackage: _fontPackage);
215 216
   static const IconData im_dialoge_more_project =
216
-      IconData(0xe6b5, fontFamily: _family);
217
+      IconData(0xe6b5, fontFamily: _family , fontPackage: _fontPackage);
217 218
   static const IconData im_dialogebar_sendmore =
218
-      IconData(0xe6ac, fontFamily: _family);
219
+      IconData(0xe6ac, fontFamily: _family , fontPackage: _fontPackage);
219 220
   static const IconData im_dialogebar_sendemoji =
220
-      IconData(0xe6ad, fontFamily: _family);
221
+      IconData(0xe6ad, fontFamily: _family , fontPackage: _fontPackage);
221 222
   static const IconData im_dialogebar_sendvoice =
222
-      IconData(0xe6ae, fontFamily: _family);
223
+      IconData(0xe6ae, fontFamily: _family , fontPackage: _fontPackage);
223 224
   static const IconData im_dialoge_voicestop =
224
-      IconData(0xe6a7, fontFamily: _family);
225
+      IconData(0xe6a7, fontFamily: _family , fontPackage: _fontPackage);
225 226
   static const IconData im_dialoge_voice =
226
-      IconData(0xe6a8, fontFamily: _family);
227
-  static const IconData im_dialoge_pin = IconData(0xe6a9, fontFamily: _family);
227
+      IconData(0xe6a8, fontFamily: _family , fontPackage: _fontPackage);
228
+  static const IconData im_dialoge_pin = IconData(0xe6a9, fontFamily: _family , fontPackage: _fontPackage);
228 229
   static const IconData im_dialoge_voiceplay =
229
-      IconData(0xe6aa, fontFamily: _family);
230
+      IconData(0xe6aa, fontFamily: _family , fontPackage: _fontPackage);
230 231
   static const IconData im_dialoge_record =
231
-      IconData(0xe6ab, fontFamily: _family);
232
+      IconData(0xe6ab, fontFamily: _family , fontPackage: _fontPackage);
232 233
   static const IconData global_list_arrow =
233
-      IconData(0xe6a5, fontFamily: _family);
234
+      IconData(0xe6a5, fontFamily: _family , fontPackage: _fontPackage);
234 235
   static const IconData global_list_delete =
235
-      IconData(0xe6a6, fontFamily: _family);
236
+      IconData(0xe6a6, fontFamily: _family , fontPackage: _fontPackage);
236 237
   static const IconData multiselect_unselected =
237
-      IconData(0xe6a2, fontFamily: _family);
238
+      IconData(0xe6a2, fontFamily: _family , fontPackage: _fontPackage);
238 239
   static const IconData multiselect_audio =
239
-      IconData(0xe6a3, fontFamily: _family);
240
+      IconData(0xe6a3, fontFamily: _family , fontPackage: _fontPackage);
240 241
   static const IconData multiselect_selected =
241
-      IconData(0xe6a4, fontFamily: _family);
242
-  static const IconData login_dropdown = IconData(0xe6a1, fontFamily: _family);
242
+      IconData(0xe6a4, fontFamily: _family , fontPackage: _fontPackage);
243
+  static const IconData login_dropdown = IconData(0xe6a1, fontFamily: _family , fontPackage: _fontPackage);
243 244
   static const IconData global_actionsheet_close =
244
-      IconData(0xe6a0, fontFamily: _family);
245
+      IconData(0xe6a0, fontFamily: _family , fontPackage: _fontPackage);
245 246
   static const IconData global_sidebar_status =
246
-      IconData(0xe69f, fontFamily: _family);
247
+      IconData(0xe69f, fontFamily: _family , fontPackage: _fontPackage);
247 248
   static const IconData global_sidebar_qrcode =
248
-      IconData(0xe69a, fontFamily: _family);
249
+      IconData(0xe69a, fontFamily: _family , fontPackage: _fontPackage);
249 250
   static const IconData global_sidebar_teamsetting =
250
-      IconData(0xe69b, fontFamily: _family);
251
+      IconData(0xe69b, fontFamily: _family , fontPackage: _fontPackage);
251 252
   static const IconData global_sidebar_account =
252
-      IconData(0xe69c, fontFamily: _family);
253
+      IconData(0xe69c, fontFamily: _family , fontPackage: _fontPackage);
253 254
   static const IconData global_sidebar_noticesetting =
254
-      IconData(0xe69d, fontFamily: _family);
255
+      IconData(0xe69d, fontFamily: _family , fontPackage: _fontPackage);
255 256
   static const IconData global_sidebar_system =
256
-      IconData(0xe69e, fontFamily: _family);
257
+      IconData(0xe69e, fontFamily: _family , fontPackage: _fontPackage);
257 258
   static const IconData global_sidebar_notice =
258
-      IconData(0xe698, fontFamily: _family);
259
+      IconData(0xe698, fontFamily: _family , fontPackage: _fontPackage);
259 260
   static const IconData global_sidebar_darkmode =
260
-      IconData(0xe699, fontFamily: _family);
261
+      IconData(0xe699, fontFamily: _family , fontPackage: _fontPackage);
261 262
   static const IconData global_sidebar_lightmode =
262
-      IconData(0xe71c, fontFamily: _family);
263
+      IconData(0xe71c, fontFamily: _family , fontPackage: _fontPackage);
263 264
   static const IconData global_sidebar_add =
264
-      IconData(0xe697, fontFamily: _family);
265
+      IconData(0xe697, fontFamily: _family , fontPackage: _fontPackage);
265 266
   static const IconData global_share_more =
266
-      IconData(0xe691, fontFamily: _family);
267
+      IconData(0xe691, fontFamily: _family , fontPackage: _fontPackage);
267 268
   static const IconData global_share_message =
268
-      IconData(0xe692, fontFamily: _family);
269
-  static const IconData global_share_qq = IconData(0xe693, fontFamily: _family);
269
+      IconData(0xe692, fontFamily: _family , fontPackage: _fontPackage);
270
+  static const IconData global_share_qq = IconData(0xe693, fontFamily: _family , fontPackage: _fontPackage);
270 271
   static const IconData global_share_copylink =
271
-      IconData(0xe694, fontFamily: _family);
272
+      IconData(0xe694, fontFamily: _family , fontPackage: _fontPackage);
272 273
   static const IconData global_share_weibo =
273
-      IconData(0xe695, fontFamily: _family);
274
+      IconData(0xe695, fontFamily: _family , fontPackage: _fontPackage);
274 275
   static const IconData global_share_wechat =
275
-      IconData(0xe696, fontFamily: _family);
276
+      IconData(0xe696, fontFamily: _family , fontPackage: _fontPackage);
276 277
   static const IconData global_searchbox_delete =
277
-      IconData(0xe68f, fontFamily: _family);
278
+      IconData(0xe68f, fontFamily: _family , fontPackage: _fontPackage);
278 279
   static const IconData global_searchbox_search =
279
-      IconData(0xe690, fontFamily: _family);
280
+      IconData(0xe690, fontFamily: _family , fontPackage: _fontPackage);
280 281
   static const IconData global_invitecode_refresh =
281
-      IconData(0xe68c, fontFamily: _family);
282
+      IconData(0xe68c, fontFamily: _family , fontPackage: _fontPackage);
282 283
   static const IconData global_invitecode_link =
283
-      IconData(0xe68d, fontFamily: _family);
284
+      IconData(0xe68d, fontFamily: _family , fontPackage: _fontPackage);
284 285
   static const IconData global_invitecode_qrcode =
285
-      IconData(0xe68e, fontFamily: _family);
286
+      IconData(0xe68e, fontFamily: _family , fontPackage: _fontPackage);
286 287
   static const IconData global_invite_qrcode =
287
-      IconData(0xe688, fontFamily: _family);
288
+      IconData(0xe688, fontFamily: _family , fontPackage: _fontPackage);
288 289
   static const IconData global_invite_code =
289
-      IconData(0xe689, fontFamily: _family);
290
+      IconData(0xe689, fontFamily: _family , fontPackage: _fontPackage);
290 291
   static const IconData global_invite_wechat =
291
-      IconData(0xe68a, fontFamily: _family);
292
+      IconData(0xe68a, fontFamily: _family , fontPackage: _fontPackage);
292 293
   static const IconData global_invite_qq =
293
-      IconData(0xe68b, fontFamily: _family);
294
+      IconData(0xe68b, fontFamily: _family , fontPackage: _fontPackage);
294 295
   static const IconData global_hoverbtn_add =
295
-      IconData(0xe686, fontFamily: _family);
296
+      IconData(0xe686, fontFamily: _family , fontPackage: _fontPackage);
296 297
   static const IconData global_hoverbtn_close =
297
-      IconData(0xe687, fontFamily: _family);
298
-  static const IconData tabbar_note = IconData(0xe681, fontFamily: _family);
299
-  static const IconData tabbar_desktop = IconData(0xe682, fontFamily: _family);
300
-  static const IconData tabbar_explore = IconData(0xe683, fontFamily: _family);
301
-  static const IconData tabbar_message = IconData(0xe684, fontFamily: _family);
302
-  static const IconData tabbar_contact = IconData(0xe685, fontFamily: _family);
303
-  static const IconData topbar_back = IconData(0xe680, fontFamily: _family);
298
+      IconData(0xe687, fontFamily: _family , fontPackage: _fontPackage);
299
+  static const IconData tabbar_note = IconData(0xe681, fontFamily: _family , fontPackage: _fontPackage);
300
+  static const IconData tabbar_desktop = IconData(0xe682, fontFamily: _family , fontPackage: _fontPackage);
301
+  static const IconData tabbar_explore = IconData(0xe683, fontFamily: _family , fontPackage: _fontPackage);
302
+  static const IconData tabbar_message = IconData(0xe684, fontFamily: _family , fontPackage: _fontPackage);
303
+  static const IconData tabbar_contact = IconData(0xe685, fontFamily: _family , fontPackage: _fontPackage);
304
+  static const IconData topbar_back = IconData(0xe680, fontFamily: _family , fontPackage: _fontPackage);
304 305
   static const IconData topbar_closesidebar =
305
-      IconData(0xe67d, fontFamily: _family);
306
-  static const IconData topbar_people = IconData(0xe67e, fontFamily: _family);
307
-  static const IconData topbar_sidebar = IconData(0xe67f, fontFamily: _family);
308
-  static const IconData topbar_add = IconData(0xe674, fontFamily: _family);
309
-  static const IconData topbar_more = IconData(0xe675, fontFamily: _family);
310
-  static const IconData topbar_addrobot = IconData(0xe676, fontFamily: _family);
306
+      IconData(0xe67d, fontFamily: _family , fontPackage: _fontPackage);
307
+  static const IconData topbar_people = IconData(0xe67e, fontFamily: _family , fontPackage: _fontPackage);
308
+  static const IconData topbar_sidebar = IconData(0xe67f, fontFamily: _family , fontPackage: _fontPackage);
309
+  static const IconData topbar_add = IconData(0xe674, fontFamily: _family , fontPackage: _fontPackage);
310
+  static const IconData topbar_more = IconData(0xe675, fontFamily: _family , fontPackage: _fontPackage);
311
+  static const IconData topbar_addrobot = IconData(0xe676, fontFamily: _family , fontPackage: _fontPackage);
311 312
   static const IconData topbar_calenderview =
312
-      IconData(0xe677, fontFamily: _family);
313
-  static const IconData topbar_invite = IconData(0xe678, fontFamily: _family);
314
-  static const IconData topbar_share = IconData(0xe679, fontFamily: _family);
315
-  static const IconData topbar_group = IconData(0xe67a, fontFamily: _family);
316
-  static const IconData topbar_setting = IconData(0xe67b, fontFamily: _family);
317
-  static const IconData topbar_close = IconData(0xe67c, fontFamily: _family);
313
+      IconData(0xe677, fontFamily: _family , fontPackage: _fontPackage);
314
+  static const IconData topbar_invite = IconData(0xe678, fontFamily: _family , fontPackage: _fontPackage);
315
+  static const IconData topbar_share = IconData(0xe679, fontFamily: _family , fontPackage: _fontPackage);
316
+  static const IconData topbar_group = IconData(0xe67a, fontFamily: _family , fontPackage: _fontPackage);
317
+  static const IconData topbar_setting = IconData(0xe67b, fontFamily: _family , fontPackage: _fontPackage);
318
+  static const IconData topbar_close = IconData(0xe67c, fontFamily: _family , fontPackage: _fontPackage);
318 319
 }

+ 9
- 8
packages/zefyr/lib/src/widgets/input.dart View File

@@ -25,15 +25,16 @@ class InputConnectionController implements TextInputClient {
25 25
   /// Opens or closes input connection based on the current state of
26 26
   /// [focusNode] and [value].
27 27
   void openOrCloseConnection(FocusNode focusNode, TextEditingValue value,
28
-      Brightness keyboardAppearance) {
29
-    if (focusNode.hasFocus && focusNode.consumeKeyboardToken()) {
30
-      openConnection(value, keyboardAppearance);
28
+      Brightness keyboardAppearance, {bool show = true}) {
29
+        //  && focusNode.consumeKeyboardToken()
30
+    if (focusNode.hasFocus) {
31
+      openConnection(value, keyboardAppearance, show: show);
31 32
     } else if (!focusNode.hasFocus) {
32 33
       closeConnection();
33 34
     }
34 35
   }
35 36
 
36
-  void openConnection(TextEditingValue value, Brightness keyboardAppearance) {
37
+  void openConnection(TextEditingValue value, Brightness keyboardAppearance, {bool show = true}) {
37 38
     if (!hasConnection) {
38 39
       _lastKnownRemoteTextEditingValue = value;
39 40
       _textInputConnection = TextInput.attach(
@@ -49,7 +50,9 @@ class InputConnectionController implements TextInputClient {
49 50
       )..setEditingState(value);
50 51
       _sentRemoteValues.add(value);
51 52
     }
52
-    _textInputConnection.show();
53
+    if (show) {
54
+      _textInputConnection.show();
55
+    }
53 56
   }
54 57
 
55 58
   /// Closes input connection if it's currently open. Otherwise does nothing.
@@ -172,9 +175,7 @@ class InputConnectionController implements TextInputClient {
172 175
   }
173 176
 
174 177
   @override
175
-  // TODO: implement currentTextEditingValue
176
-  TextEditingValue get currentTextEditingValue =>
177
-      _lastKnownRemoteTextEditingValue;
178
+  TextEditingValue get currentTextEditingValue => _lastKnownRemoteTextEditingValue;
178 179
   
179 180
   @override
180 181
   void connectionClosed() {

+ 24
- 8
packages/zefyr/lib/src/widgets/scaffold.dart View File

@@ -39,15 +39,31 @@ class ZefyrScaffoldState extends State<ZefyrScaffold> {
39 39
   Widget build(BuildContext context) {
40 40
     final toolbar =
41 41
         (_toolbarBuilder == null) ? Container() : _toolbarBuilder(context);
42
+    // return Container(
43
+    //   margin: EdgeInsets.only(
44
+    //     bottom: MediaQuery.of(context).viewInsets.bottom > 0
45
+    //         ? MediaQuery.of(context).viewInsets.bottom
46
+    //         : 0,
47
+    //   ),
48
+    //   child: _ZefyrScaffoldAccess(
49
+    //     scaffold: this,
50
+    //     child: Column(
51
+    //       children: <Widget>[
52
+    //         Expanded(child: widget.child),
53
+    //         toolbar,
54
+    //       ],
55
+    //     ),
56
+    //   ),
57
+    // );
42 58
     return _ZefyrScaffoldAccess(
43
-      scaffold: this,
44
-      child: Column(
45
-        children: <Widget>[
46
-          Expanded(child: widget.child),
47
-          toolbar,
48
-        ],
49
-      ),
50
-    );
59
+        scaffold: this,
60
+        child: Column(
61
+          children: <Widget>[
62
+            Expanded(child: widget.child),
63
+            toolbar,
64
+          ],
65
+        ),
66
+      );
51 67
   }
52 68
 }
53 69
 

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

@@ -1,11 +1,13 @@
1 1
 import 'package:flutter/foundation.dart';
2 2
 import 'package:flutter/material.dart';
3
+import 'package:flutter/services.dart';
3 4
 import 'package:notus/notus.dart';
4 5
 
5 6
 import 'controller.dart';
6 7
 import 'cursor_timer.dart';
7 8
 import 'editor.dart';
8 9
 import 'image.dart';
10
+import 'input.dart';
9 11
 import 'mode.dart';
10 12
 import 'render_context.dart';
11 13
 import 'view.dart';
@@ -50,6 +52,9 @@ class ZefyrScope extends ChangeNotifier {
50 52
         _focusNode = focusNode,
51 53
         _focusScope = focusScope,
52 54
         _cursorTimer = CursorTimer(),
55
+        _input = InputConnectionController((int start, String deleted, String inserted, TextSelection selection) {
56
+          controller.replaceText(start, deleted.length, inserted, selection: selection);
57
+        }),
53 58
         _renderContext = ZefyrRenderContext() {
54 59
     _selectionStyle = _controller.getSelectionStyle();
55 60
     _selection = _controller.selection;
@@ -63,6 +68,25 @@ class ZefyrScope extends ChangeNotifier {
63 68
     return widget.scope;
64 69
   }
65 70
 
71
+  InputConnectionController _input;
72
+  InputConnectionController get input => _input;
73
+
74
+  ToolbarStatus _toolbarStatus = ToolbarStatus.hide;
75
+  ToolbarStatus get toolbarStatus => _toolbarStatus;
76
+  set toolbarStatus(ToolbarStatus value) {
77
+    if (_toolbarStatus != value) {
78
+      _toolbarStatus = value;
79
+      if (_toolbarStatus == ToolbarStatus.open) {
80
+        hideKeyboard();
81
+      } else if (_toolbarStatus == ToolbarStatus.hide) {
82
+        closeKeyboard();
83
+      } else if (_toolbarStatus == ToolbarStatus.show) {
84
+        showKeyboard();
85
+      }
86
+      notifyListeners();
87
+    }
88
+  }
89
+
66 90
   ZefyrImageDelegate _imageDelegate;
67 91
   ZefyrImageDelegate get imageDelegate => _imageDelegate;
68 92
   set imageDelegate(ZefyrImageDelegate value) {
@@ -187,12 +211,24 @@ class ZefyrScope extends ChangeNotifier {
187 211
     _focusScope.requestFocus(_focusNode);
188 212
   }
189 213
 
190
-  void hideKeyboard() {
214
+  void closeKeyboard() {
191 215
     assert(isEditable);
192 216
     assert(!_disposed);
193 217
     _focusNode.unfocus();
194 218
   }
195 219
 
220
+  void showKeyboard() {
221
+    assert(isEditable);
222
+    assert(!_disposed);
223
+    SystemChannels.textInput.invokeMethod('TextInput.show');
224
+  }
225
+
226
+  void hideKeyboard() {
227
+    assert(isEditable);
228
+    assert(!_disposed);
229
+    SystemChannels.textInput.invokeMethod('TextInput.hide');
230
+  }
231
+
196 232
   @override
197 233
   void dispose() {
198 234
     assert(!_disposed);
@@ -242,3 +278,9 @@ class ZefyrScopeAccess extends InheritedWidget {
242 278
     return scope != oldWidget.scope;
243 279
   }
244 280
 }
281
+
282
+enum ToolbarStatus {
283
+  show,
284
+  hide,
285
+  open,
286
+}

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

@@ -509,12 +509,12 @@ class ToolbarTheme {
509 509
   factory ToolbarTheme.fallback(BuildContext context) {
510 510
     final theme = Theme.of(context);
511 511
     return ToolbarTheme._(
512
-      color: theme.brightness == Brightness.dark ? Color(0xFF282828) : Color(0xFFFFFFFF),
512
+      color: theme.brightness == Brightness.light ? Color(0xFFFFFFFF) : Color(0xFF282828),
513 513
       toggleColor: Color(0xFF01AAFF),
514
-      iconFillColor: theme.brightness == Brightness.dark ? Color(0xFF1F1F1F) : Color(0xFFF2F2F2),
514
+      iconFillColor: theme.brightness == Brightness.light ? Color(0xFFF2F2F2) : Color(0xFF1F1F1F),
515 515
       iconColor: Color(0xFF595959),
516
-      disabledIconColor: Color(0xFF8C8C8C),
517
-      dividerColor: theme.brightness == Brightness.dark ? Color(0xFF3B3B3B) : Color(0xFFF2F2F2),
516
+      disabledIconColor: theme.disabledColor,
517
+      dividerColor: theme.dividerColor ?? (theme.brightness == Brightness.light ? Color(0xFFF2F2F2) : Color(0xFF3B3B3B)),
518 518
     );
519 519
   }
520 520
 

+ 51
- 32
packages/zefyr/lib/src/widgets/toolbar.dart View File

@@ -5,6 +5,7 @@ import 'dart:async';
5 5
 import 'dart:ui' as ui;
6 6
 
7 7
 import 'package:flutter/material.dart';
8
+import 'package:flutter/services.dart';
8 9
 import 'package:notus/notus.dart';
9 10
 
10 11
 import 'iconfont.dart';
@@ -40,6 +41,7 @@ enum ZefyrToolbarAction {
40 41
   cameraImage,
41 42
   galleryImage,
42 43
   hideKeyboard,
44
+  showKeyboard,
43 45
   close,
44 46
   confirm,
45 47
 }
@@ -60,34 +62,35 @@ final kZefyrToolbarAttributeActions = <ZefyrToolbarAction, NotusAttributeKey>{
60 62
 };
61 63
 
62 64
 const kDefaultButtonIcons = {
63
-  ZefyrToolbarAction.bold: IconFont.note_editor_text_bold,
64
-  ZefyrToolbarAction.italic: IconFont.note_editor_text_in,
65
-  ZefyrToolbarAction.underline: IconFont.note_editor_text_underline,
66
-  ZefyrToolbarAction.deleteline: IconFont.note_editor_text_deleteline,
67
-  ZefyrToolbarAction.quote: IconFont.note_editor_text_quote,
68
-  ZefyrToolbarAction.numberList: IconFont.note_editor_text_ol,
69
-  ZefyrToolbarAction.bulletList: IconFont.note_editor_text_ul,
70
-  ZefyrToolbarAction.link: IconFont.note_editor_link,
65
+  ZefyrToolbarAction.heading: ZefyrFont.note_editor_text,
66
+  ZefyrToolbarAction.emoji: ZefyrFont.im_dialogebar_sendemoji,
67
+  ZefyrToolbarAction.image: ZefyrFont.note_editor_image,
68
+  ZefyrToolbarAction.link: ZefyrFont.note_editor_link,
69
+  ZefyrToolbarAction.hideKeyboard: ZefyrFont.note_editor_keyboard,
70
+  ZefyrToolbarAction.showKeyboard: ZefyrFont.note_editor_unkeyboard,
71
+  ZefyrToolbarAction.close: Icons.close,
72
+  ZefyrToolbarAction.confirm: Icons.check,
73
+  ZefyrToolbarAction.bold: ZefyrFont.note_editor_text_bold,
74
+  ZefyrToolbarAction.italic: ZefyrFont.note_editor_text_in,
75
+  ZefyrToolbarAction.underline: ZefyrFont.note_editor_text_underline,
76
+  ZefyrToolbarAction.deleteline: ZefyrFont.note_editor_text_deleteline,
77
+  ZefyrToolbarAction.quote: ZefyrFont.note_editor_text_quote,
78
+  ZefyrToolbarAction.numberList: ZefyrFont.note_editor_text_ol,
79
+  ZefyrToolbarAction.bulletList: ZefyrFont.note_editor_text_ul,
71 80
   ZefyrToolbarAction.unlink: Icons.link_off,
72
-  ZefyrToolbarAction.emoji: IconFont.im_dialogebar_sendemoji,
73 81
   ZefyrToolbarAction.clipboardCopy: Icons.content_copy,
74 82
   ZefyrToolbarAction.openInBrowser: Icons.open_in_new,
75
-  ZefyrToolbarAction.heading: IconFont.note_editor_text,
76
-  ZefyrToolbarAction.headingLevel1: IconFont.note_editor_text_h,
77
-  ZefyrToolbarAction.headingLevel2: IconFont.note_editor_text_h1,
78
-  ZefyrToolbarAction.headingLevel3: IconFont.note_editor_text_h2,
79
-  ZefyrToolbarAction.headingLevel4: IconFont.note_editor_text_h3,
80
-  ZefyrToolbarAction.headingLevel5: IconFont.note_editor_text_h4,
81
-  ZefyrToolbarAction.headingLevel6: IconFont.note_editor_text_h5,
82
-  ZefyrToolbarAction.text: IconFont.note_editor_text,
83
-  ZefyrToolbarAction.code: IconFont.note_editor_text_code,
84
-  ZefyrToolbarAction.horizontalRule: IconFont.note_editor_text_hr,
85
-  ZefyrToolbarAction.image: IconFont.note_editor_image,
86
-  ZefyrToolbarAction.cameraImage: IconFont.im_dialoge_more_takephoto,
87
-  ZefyrToolbarAction.galleryImage: IconFont.im_dialoge_more_album,
88
-  ZefyrToolbarAction.hideKeyboard: IconFont.note_editor_keyboard,
89
-  ZefyrToolbarAction.close: Icons.close,
90
-  ZefyrToolbarAction.confirm: Icons.check,
83
+  ZefyrToolbarAction.headingLevel1: ZefyrFont.note_editor_text_h,
84
+  ZefyrToolbarAction.headingLevel2: ZefyrFont.note_editor_text_h1,
85
+  ZefyrToolbarAction.headingLevel3: ZefyrFont.note_editor_text_h2,
86
+  ZefyrToolbarAction.headingLevel4: ZefyrFont.note_editor_text_h3,
87
+  ZefyrToolbarAction.headingLevel5: ZefyrFont.note_editor_text_h4,
88
+  ZefyrToolbarAction.headingLevel6: ZefyrFont.note_editor_text_h5,
89
+  ZefyrToolbarAction.text: ZefyrFont.note_editor_text,
90
+  ZefyrToolbarAction.code: ZefyrFont.note_editor_text_code,
91
+  ZefyrToolbarAction.horizontalRule: ZefyrFont.note_editor_text_hr,
92
+  ZefyrToolbarAction.cameraImage: ZefyrFont.im_dialoge_more_takephoto,
93
+  ZefyrToolbarAction.galleryImage: ZefyrFont.im_dialoge_more_album,
91 94
 };
92 95
 
93 96
 const kSpecialIconSizes = {
@@ -158,7 +161,7 @@ class ZefyrToolbar extends StatefulWidget implements PreferredSizeWidget {
158 161
     @required this.editor,
159 162
     this.autoHide = true,
160 163
     this.delegate,
161
-  }) : super(key: key);
164
+  }) :  super(key: key);
162 165
 
163 166
   final ZefyrToolbarDelegate delegate;
164 167
   final ZefyrScope editor;
@@ -196,6 +199,9 @@ class ZefyrToolbarState extends State<ZefyrToolbar>
196 199
   final Key _toolbarKey = UniqueKey();
197 200
   final Key _overlayKey = UniqueKey();
198 201
 
202
+  double _keyboardHeight;
203
+  double get keyboardHeight => _keyboardHeight;
204
+
199 205
   ZefyrToolbarDelegate _delegate;
200 206
   AnimationController _overlayAnimation;
201 207
   WidgetBuilder _overlayBuilder;
@@ -227,17 +233,19 @@ class ZefyrToolbarState extends State<ZefyrToolbar>
227 233
       _overlayCompleter = completer;
228 234
       _overlayAnimation.forward();
229 235
     });
236
+    editor.toolbarStatus = ToolbarStatus.open;
230 237
     return completer.future;
231 238
   }
232 239
 
233 240
   void closeOverlay() {
234 241
     if (!hasOverlay) return;
235
-    _overlayAnimation.reverse().whenComplete(() {
242
+    _overlayAnimation.reverse().whenComplete(() async {
236 243
       setState(() {
237 244
         _overlayBuilder = null;
238 245
         _overlayCompleter?.complete();
239 246
         _overlayCompleter = null;
240 247
       });
248
+      editor.toolbarStatus = ToolbarStatus.show;
241 249
     });
242 250
   }
243 251
 
@@ -270,7 +278,13 @@ class ZefyrToolbarState extends State<ZefyrToolbar>
270 278
 
271 279
   @override
272 280
   Widget build(BuildContext context) {
281
+    if (MediaQuery.of(context).viewInsets.bottom > 0) {
282
+      _keyboardHeight = MediaQuery.of(context).viewInsets.bottom;
283
+    }
284
+    final theme = ZefyrTheme.of(context).toolbarTheme;
285
+    
273 286
     final layers = <Widget>[];
287
+    var overlay;
274 288
 
275 289
     // Must set unique key for the toolbar to prevent it from reconstructing
276 290
     // new state each time we toggle overlay.
@@ -278,21 +292,25 @@ class ZefyrToolbarState extends State<ZefyrToolbar>
278 292
     final toolbar = ZefyrToolbarScaffold(
279 293
       key: _toolbarKey,
280 294
       body: ZefyrButtonList(buttons: _buildButtons(context)),
281
-      trailing: buildButton(context, ZefyrToolbarAction.hideKeyboard),
295
+      trailing: hasOverlay ? buildButton(context, ZefyrToolbarAction.showKeyboard) : buildButton(context, ZefyrToolbarAction.hideKeyboard),
282 296
     );
283
-
284 297
     layers.add(toolbar);
285
-
286 298
     if (hasOverlay) {
287 299
       Widget widget = Builder(builder: _overlayBuilder);
288 300
       assert(widget != null);
289
-      final overlay = FadeTransition(
301
+      overlay = FadeTransition(
290 302
         key: _overlayKey,
291 303
         opacity: _overlayAnimation,
292 304
         child: widget,
293 305
       );
294
-      layers.add(overlay);
295 306
     }
307
+    layers.add(
308
+      Container(
309
+        height: keyboardHeight,
310
+        child: overlay,
311
+      ),
312
+    );
313
+
296 314
     return _ZefyrToolbarScope(
297 315
       toolbar: this,
298 316
       child: Column(
@@ -306,6 +324,7 @@ class ZefyrToolbarState extends State<ZefyrToolbar>
306 324
       HeadingButton(),
307 325
       buildButton(context, ZefyrToolbarAction.emoji),
308 326
       if (editor.imageDelegate != null) ImageButton(),
327
+      // ImageButton(),
309 328
       LinkButton(),
310 329
       
311 330
       // buildButton(context, ZefyrToolbarAction.bulletList),

+ 4
- 3
packages/zefyr/pubspec.yaml View File

@@ -1,6 +1,6 @@
1 1
 name: zefyr
2 2
 description: Clean, minimalistic and collaboration-ready rich text editor for Flutter.
3
-version: 0.10.0
3
+version: 0.10.1
4 4
 author: Anatoly Pulyaevskiy <anatoly.pulyaevskiy@gmail.com>
5 5
 homepage: https://github.com/memspace/zefyr
6 6
 
@@ -17,7 +17,8 @@ dependencies:
17 17
     path: ../notus
18 18
   meta: ^1.1.0
19 19
   quiver_hashcode: ^2.0.0
20
-  photo_manager: ^0.5.1-dev.4
20
+  photo: 
21
+    path: /Users/imac/Documents/flutter/projects/mutli_image_picker
21 22
 
22 23
 dev_dependencies:
23 24
   flutter_test:
@@ -29,4 +30,4 @@ flutter:
29 30
   fonts:
30 31
     - family: ZefyrFont
31 32
       fonts:
32
-        - asset: lib/fonts/iconfont.ttf
33
+        - asset: lib/fonts/zefyrfont.ttf