Browse Source

Upgraded to Flutter dev 1.18

lucky1213 4 years ago
parent
commit
8f9b05e1f6

+ 10
- 4
packages/zefyr/example/android/app/build.gradle View File

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

20
             android:name=".MainActivity"
20
             android:name=".MainActivity"
21
             android:launchMode="singleTop"
21
             android:launchMode="singleTop"
22
             android:theme="@style/LaunchTheme"
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
             android:hardwareAccelerated="true"
24
             android:hardwareAccelerated="true"
25
             android:windowSoftInputMode="adjustResize">
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
             <intent-filter>
27
             <intent-filter>
34
                 <action android:name="android.intent.action.MAIN"/>
28
                 <action android:name="android.intent.action.MAIN"/>
35
                 <category android:name="android.intent.category.LAUNCHER"/>
29
                 <category android:name="android.intent.category.LAUNCHER"/>
36
             </intent-filter>
30
             </intent-filter>
37
         </activity>
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
     </application>
37
     </application>
39
 </manifest>
38
 </manifest>

+ 0
- 13
packages/zefyr/example/android/app/src/main/java/com/zefyr/example/MainActivity.java View File

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 View File

3
 import android.os.Bundle
3
 import android.os.Bundle
4
 
4
 
5
 import io.flutter.app.FlutterActivity
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
 import io.flutter.plugins.GeneratedPluginRegistrant
9
 import io.flutter.plugins.GeneratedPluginRegistrant
7
 
10
 
8
 class MainActivity: FlutterActivity() {
11
 class MainActivity: FlutterActivity() {
10
     super.onCreate(savedInstanceState)
13
     super.onCreate(savedInstanceState)
11
     GeneratedPluginRegistrant.registerWith(this)
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 View File

1
 buildscript {
1
 buildscript {
2
+    ext.kotlin_version = '1.3.50'
2
     repositories {
3
     repositories {
3
         google()
4
         google()
4
         jcenter()
5
         jcenter()
6
 
7
 
7
     dependencies {
8
     dependencies {
8
         classpath 'com.android.tools.build:gradle:3.5.0'
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 View File

1
 org.gradle.jvmargs=-Xmx1536M
1
 org.gradle.jvmargs=-Xmx1536M
2
 android.enableR8=true
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 View File

1
+0c5c940fb5dd17aaeef542d93a77c9c0

+ 0
- 2
packages/zefyr/example/ios/Runner.xcodeproj/project.pbxproj View File

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

+ 11
- 5
packages/zefyr/example/lib/src/images.dart View File

6
 import 'dart:typed_data';
6
 import 'dart:typed_data';
7
 import 'package:flutter/gestures.dart';
7
 import 'package:flutter/gestures.dart';
8
 import 'package:flutter/services.dart';
8
 import 'package:flutter/services.dart';
9
-import 'package:image/image.dart' as Im;
10
 
9
 
11
 import 'package:flutter/material.dart';
10
 import 'package:flutter/material.dart';
12
 import 'package:flutter/widgets.dart';
11
 import 'package:flutter/widgets.dart';
76
   @override
75
   @override
77
   Future<ZefyrLinkEntity> fillLink(
76
   Future<ZefyrLinkEntity> fillLink(
78
       BuildContext context, ZefyrLinkEntity value) async {
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
     return showGeneralDialog<ZefyrLinkEntity>(
80
     return showGeneralDialog<ZefyrLinkEntity>(
81
       context: context,
81
       context: context,
82
       pageBuilder: (BuildContext buildContext, Animation<double> animation,
82
       pageBuilder: (BuildContext buildContext, Animation<double> animation,
96
                   children: <Widget>[
96
                   children: <Widget>[
97
                     TextField(
97
                     TextField(
98
                       controller: _controller,
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
                     FlatButton(
109
                     FlatButton(
104
                       onPressed: () {
110
                       onPressed: () {

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

2
 // for details. All rights reserved. Use of this source code is governed by a
2
 // for details. All rights reserved. Use of this source code is governed by a
3
 // BSD-style license that can be found in the LICENSE file.
3
 // BSD-style license that can be found in the LICENSE file.
4
 import 'package:flutter/services.dart';
4
 import 'package:flutter/services.dart';
5
+import 'package:flutter/src/services/autofill.dart';
5
 import 'package:flutter/widgets.dart';
6
 import 'package:flutter/widgets.dart';
6
 import 'package:zefyr/util.dart';
7
 import 'package:zefyr/util.dart';
7
 
8
 
187
       _sentRemoteValues.clear();
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 View File

318
     final position = box.getPositionForOffset(localPoint);
318
     final position = box.getPositionForOffset(localPoint);
319
     var word = box.getWordBoundary(position);
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
     final selection = TextSelection(
339
     final selection = TextSelection(
340
       baseOffset: word.start,
340
       baseOffset: word.start,
341
       extentOffset: word.end,
341
       extentOffset: word.end,

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

338
           HeadingButton(),
338
           HeadingButton(),
339
           buildButton(context, ZefyrToolbarAction.emoji),
339
           buildButton(context, ZefyrToolbarAction.emoji),
340
           if (editor.imageDelegate != null) ImageButton(),
340
           if (editor.imageDelegate != null) ImageButton(),
341
-          // ImageButton(),
342
-          LinkButton(),
341
+          if (editor.linkDelegate != null) LinkButton(),
343
         ],
342
         ],
344
         physics: ClampingScrollPhysics(),
343
         physics: ClampingScrollPhysics(),
345
       ),),
344
       ),),