Parcourir la source

Upgraded to Flutter dev 1.18

lucky1213 il y a 4 ans
Parent
révision
8f9b05e1f6

+ 10
- 4
packages/zefyr/example/android/app/build.gradle Voir le fichier

@@ -22,11 +22,16 @@ if (flutterVersionName == null) {
22 22
 }
23 23
 
24 24
 apply plugin: 'com.android.application'
25
+apply plugin: 'kotlin-android'
25 26
 apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
26 27
 
27 28
 android {
28 29
     compileSdkVersion 28
29 30
 
31
+    sourceSets {
32
+        main.java.srcDirs += 'src/main/kotlin'
33
+    }
34
+
30 35
     lintOptions {
31 36
         disable 'InvalidPackage'
32 37
     }
@@ -35,10 +40,10 @@ android {
35 40
         // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
36 41
         applicationId "com.zefyr.example"
37 42
         minSdkVersion 16
38
-        targetSdkVersion 27
43
+        targetSdkVersion 28
39 44
         versionCode flutterVersionCode.toInteger()
40 45
         versionName flutterVersionName
41
-        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
46
+        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
42 47
     }
43 48
 
44 49
     buildTypes {
@@ -55,7 +60,8 @@ flutter {
55 60
 }
56 61
 
57 62
 dependencies {
63
+    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
58 64
     testImplementation 'junit:junit:4.12'
59
-    androidTestImplementation 'com.android.support.test:runner:1.0.2'
60
-    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
65
+    androidTestImplementation 'androidx.test:runner:1.1.1'
66
+    androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.1'
61 67
 }

+ 7
- 8
packages/zefyr/example/android/app/src/main/AndroidManifest.xml Voir le fichier

@@ -20,20 +20,19 @@
20 20
             android:name=".MainActivity"
21 21
             android:launchMode="singleTop"
22 22
             android:theme="@style/LaunchTheme"
23
-            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
23
+            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
24 24
             android:hardwareAccelerated="true"
25 25
             android:windowSoftInputMode="adjustResize">
26
-            <!-- This keeps the window background of the activity showing
27
-                 until Flutter renders its first frame. It can be removed if
28
-                 there is no splash screen (such as the default splash screen
29
-                 defined in @style/LaunchTheme). -->
30
-            <meta-data
31
-                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
32
-                android:value="true" />
26
+            
33 27
             <intent-filter>
34 28
                 <action android:name="android.intent.action.MAIN"/>
35 29
                 <category android:name="android.intent.category.LAUNCHER"/>
36 30
             </intent-filter>
37 31
         </activity>
32
+        <!-- Don't delete the meta-data below.
33
+             This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
34
+        <meta-data
35
+            android:name="flutterEmbedding"
36
+            android:value="2" />
38 37
     </application>
39 38
 </manifest>

+ 0
- 13
packages/zefyr/example/android/app/src/main/java/com/zefyr/example/MainActivity.java Voir le fichier

@@ -1,13 +0,0 @@
1
-package com.zefyr.example;
2
-
3
-import android.os.Bundle;
4
-import io.flutter.app.FlutterActivity;
5
-import io.flutter.plugins.GeneratedPluginRegistrant;
6
-
7
-public class MainActivity extends FlutterActivity {
8
-  @Override
9
-  protected void onCreate(Bundle savedInstanceState) {
10
-    super.onCreate(savedInstanceState);
11
-    GeneratedPluginRegistrant.registerWith(this);
12
-  }
13
-}

+ 7
- 1
packages/zefyr/example/android/app/src/main/kotlin/com/zefyr/example/MainActivity.kt Voir le fichier

@@ -3,6 +3,9 @@ package com.zefyr.example
3 3
 import android.os.Bundle
4 4
 
5 5
 import io.flutter.app.FlutterActivity
6
+import androidx.annotation.NonNull;
7
+import io.flutter.embedding.android.FlutterActivity
8
+import io.flutter.embedding.engine.FlutterEngine
6 9
 import io.flutter.plugins.GeneratedPluginRegistrant
7 10
 
8 11
 class MainActivity: FlutterActivity() {
@@ -10,4 +13,7 @@ class MainActivity: FlutterActivity() {
10 13
     super.onCreate(savedInstanceState)
11 14
     GeneratedPluginRegistrant.registerWith(this)
12 15
   }
13
-}
16
+    override fun configureFlutterEngine(@NonNull flutterEngine: FlutterEngine) {
17
+        GeneratedPluginRegistrant.registerWith(flutterEngine);
18
+    }
19
+}

+ 2
- 0
packages/zefyr/example/android/build.gradle Voir le fichier

@@ -1,4 +1,5 @@
1 1
 buildscript {
2
+    ext.kotlin_version = '1.3.50'
2 3
     repositories {
3 4
         google()
4 5
         jcenter()
@@ -6,6 +7,7 @@ buildscript {
6 7
 
7 8
     dependencies {
8 9
         classpath 'com.android.tools.build:gradle:3.5.0'
10
+        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
9 11
     }
10 12
 }
11 13
 

+ 2
- 2
packages/zefyr/example/android/gradle.properties Voir le fichier

@@ -1,4 +1,4 @@
1 1
 org.gradle.jvmargs=-Xmx1536M
2 2
 android.enableR8=true
3
-android.enableJetifier=true
4
-android.useAndroidX=true
3
+android.useAndroidX=true
4
+android.enableJetifier=true

+ 1
- 0
packages/zefyr/example/ios/Flutter/.last_build_id Voir le fichier

@@ -0,0 +1 @@
1
+0c5c940fb5dd17aaeef542d93a77c9c0

+ 0
- 2
packages/zefyr/example/ios/Runner.xcodeproj/project.pbxproj Voir le fichier

@@ -313,7 +313,6 @@
313 313
 /* Begin XCBuildConfiguration section */
314 314
 		97C147031CF9000F007C117D /* Debug */ = {
315 315
 			isa = XCBuildConfiguration;
316
-			baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
317 316
 			buildSettings = {
318 317
 				ALWAYS_SEARCH_USER_PATHS = NO;
319 318
 				CLANG_ANALYZER_NONNULL = YES;
@@ -367,7 +366,6 @@
367 366
 		};
368 367
 		97C147041CF9000F007C117D /* Release */ = {
369 368
 			isa = XCBuildConfiguration;
370
-			baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
371 369
 			buildSettings = {
372 370
 				ALWAYS_SEARCH_USER_PATHS = NO;
373 371
 				CLANG_ANALYZER_NONNULL = YES;

+ 11
- 5
packages/zefyr/example/lib/src/images.dart Voir le fichier

@@ -6,7 +6,6 @@ import 'dart:io';
6 6
 import 'dart:typed_data';
7 7
 import 'package:flutter/gestures.dart';
8 8
 import 'package:flutter/services.dart';
9
-import 'package:image/image.dart' as Im;
10 9
 
11 10
 import 'package:flutter/material.dart';
12 11
 import 'package:flutter/widgets.dart';
@@ -76,7 +75,8 @@ class CustomLinkDelegate implements ZefyrLinkDelegate {
76 75
   @override
77 76
   Future<ZefyrLinkEntity> fillLink(
78 77
       BuildContext context, ZefyrLinkEntity value) async {
79
-    TextEditingController _controller = TextEditingController();
78
+    TextEditingController _controller = TextEditingController(text: value.text);
79
+    TextEditingController _controller2 = TextEditingController(text: value.url);
80 80
     return showGeneralDialog<ZefyrLinkEntity>(
81 81
       context: context,
82 82
       pageBuilder: (BuildContext buildContext, Animation<double> animation,
@@ -96,9 +96,15 @@ class CustomLinkDelegate implements ZefyrLinkDelegate {
96 96
                   children: <Widget>[
97 97
                     TextField(
98 98
                       controller: _controller,
99
-                      inputFormatters: [
100
-                        WhitelistingTextInputFormatter.digitsOnly
101
-                      ],
99
+                      decoration: InputDecoration(
100
+                        hintText: '请填写链接文字',
101
+                      ),
102
+                    ),
103
+                    TextField(
104
+                      controller: _controller2,
105
+                      decoration: InputDecoration(
106
+                        hintText: '请填写链接',
107
+                      ),
102 108
                     ),
103 109
                     FlatButton(
104 110
                       onPressed: () {

+ 9
- 0
packages/zefyr/lib/src/widgets/input.dart Voir le fichier

@@ -2,6 +2,7 @@
2 2
 // for details. All rights reserved. Use of this source code is governed by a
3 3
 // BSD-style license that can be found in the LICENSE file.
4 4
 import 'package:flutter/services.dart';
5
+import 'package:flutter/src/services/autofill.dart';
5 6
 import 'package:flutter/widgets.dart';
6 7
 import 'package:zefyr/util.dart';
7 8
 
@@ -187,4 +188,12 @@ class InputConnectionController implements TextInputClient {
187 188
       _sentRemoteValues.clear();
188 189
     }
189 190
   }
191
+
192
+  @override
193
+  AutofillScope get currentAutofillScope => null;
194
+
195
+  @override
196
+  void showAutocorrectionPromptRect(int start, int end) {
197
+    
198
+  }
190 199
 }

+ 18
- 18
packages/zefyr/lib/src/widgets/selection.dart Voir le fichier

@@ -318,24 +318,24 @@ class _ZefyrSelectionOverlayState extends State<ZefyrSelectionOverlay>
318 318
     final position = box.getPositionForOffset(localPoint);
319 319
     var word = box.getWordBoundary(position);
320 320
     
321
-    if (box?.child is RenderZefyrParagraph) {
322
-      RenderZefyrParagraph paragraph = box.child;
323
-      if (_scope.controller.getStyleForSelection(TextSelection.collapsed(
324
-          offset: position.offset,
325
-          affinity: position.affinity,
326
-        )).contains(NotusAttribute.link)) {
327
-        // 当前点击的是link
328
-        var spanPosition = paragraph.getRenderBoxPositionForOffset(localPoint);
329
-        // // 第一个字符和最后一个字符将不触发onTap
330
-        final TextSpan span = paragraph.text.getSpanForPosition(TextPosition(
331
-          offset: spanPosition.offset == 0 ? spanPosition.offset - 1 : spanPosition.offset + 1,
332
-          affinity: spanPosition.affinity,
333
-        ));
334
-        if (span != null) {
335
-          word = paragraph.getRenderBoxWordBoundary(span.text.length);
336
-        }
337
-      }
338
-    }
321
+    // if (box?.child is RenderZefyrParagraph) {
322
+    //   RenderZefyrParagraph paragraph = box.child;
323
+    //   if (_scope.controller.getStyleForSelection(TextSelection.collapsed(
324
+    //       offset: position.offset,
325
+    //       affinity: position.affinity,
326
+    //     )).contains(NotusAttribute.link)) {
327
+    //     // 当前点击的是link
328
+    //     var spanPosition = paragraph.getRenderBoxPositionForOffset(localPoint);
329
+    //     // // 第一个字符和最后一个字符将不触发onTap
330
+    //     final TextSpan span = paragraph.text.getSpanForPosition(TextPosition(
331
+    //       offset: spanPosition.offset == 0 ? spanPosition.offset - 1 : spanPosition.offset + 1,
332
+    //       affinity: spanPosition.affinity,
333
+    //     ));
334
+    //     if (span != null) {
335
+    //       word = paragraph.getRenderBoxWordBoundary(span.text.length);
336
+    //     }
337
+    //   }
338
+    // }
339 339
     final selection = TextSelection(
340 340
       baseOffset: word.start,
341 341
       extentOffset: word.end,

+ 1
- 2
packages/zefyr/lib/src/widgets/toolbar.dart Voir le fichier

@@ -338,8 +338,7 @@ class ZefyrToolbarState extends State<ZefyrToolbar>
338 338
           HeadingButton(),
339 339
           buildButton(context, ZefyrToolbarAction.emoji),
340 340
           if (editor.imageDelegate != null) ImageButton(),
341
-          // ImageButton(),
342
-          LinkButton(),
341
+          if (editor.linkDelegate != null) LinkButton(),
343 342
         ],
344 343
         physics: ClampingScrollPhysics(),
345 344
       ),),