Browse Source

Merge branch 'hotfix/scarlet-cobra' of lyq/flutter_eyevideo into master

天问 1 year ago
parent
commit
721c536670

+ 1 - 0
.devcontainer/Dockerfile

@@ -0,0 +1 @@
+FROM jianboy/flutter-dev-container:3.0.5

+ 45 - 0
.devcontainer/devcontainer.json

@@ -0,0 +1,45 @@
+// java8 + android env
+// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at:
+// https://github.com/microsoft/vscode-dev-containers/tree/v0.233.0/containers/java-8
+{
+    "name": "Java 11",
+    "build": {
+        "dockerfile": "Dockerfile",
+        "args": {
+            // Use the VARIANT arg to pick a Debian OS version: buster, bullseye
+            // Use bullseye when running on local arm64/Apple Silicon.
+            "VARIANT": "buster",
+            // Options
+            "INSTALL_MAVEN": "true",
+            "INSTALL_GRADLE": "true",
+            "NODE_VERSION": "lts/*"
+        }
+    },
+    // Set *default* container specific settings.json values on container create.
+    "settings": {
+        "java.home": "/docker-java-home",
+        "java.import.gradle.java.home": "/usr/local/sdkman/candidates/java/current",
+        "java.configuration.runtimes": [
+            {
+                "default": true,
+                "name": "JavaSE-11",
+                "path": "/usr/local/sdkman/candidates/java/current"
+            }
+        ]
+    },
+    // Add the IDs of extensions you want installed when the container is created.
+    "extensions": [
+        "vscjava.vscode-java-pack",
+        "dart-code.dart-code",
+        "dart-code.flutter"
+    ],
+    // Use 'forwardPorts' to make a list of ports inside the container available locally.
+    // "forwardPorts": [],
+    // Use 'postCreateCommand' to run commands after the container is created.
+    // "postCreateCommand": "java -version",
+    // Comment out to connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
+    "remoteUser": "vscode",
+    "features": {
+        "docker-in-docker": "latest"
+    }
+}

+ 66 - 0
.gitpod.Dockerfile

@@ -0,0 +1,66 @@
+FROM gitpod/workspace-full-vnc
+SHELL ["/bin/bash", "-c"]
+
+ENV ANDROID_HOME=/home/gitpod/androidsdk \
+    FLUTTER_VERSION=2.10.5-stable
+
+# Install dart
+USER root
+RUN curl -fsSL https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
+    && curl -fsSL https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list \
+    && install-packages build-essential dart libkrb5-dev gcc make gradle android-tools-adb android-tools-fastboot
+
+# Install flutter
+USER gitpod
+RUN cd /home/gitpod \
+    && wget https://storage.googleapis.com/flutter_infra_release/releases/stable/linux/flutter_linux_${FLUTTER_VERSION}.tar.xz \
+    && tar -xvf flutter*.tar.xz \
+    && rm -f flutter*.tar.xz
+
+RUN flutter/bin/flutter precache
+RUN echo 'export PATH="$PATH:/home/gitpod/flutter/bin"' >> /home/gitpod/.bashrc
+
+# Install Open JDK
+USER gitpod
+RUN bash -c ". /home/gitpod/.sdkman/bin/sdkman-init.sh && \
+    sdk install java 11.0.16-amzn && \
+    sdk default java 11.0.16-amzn"
+
+# Install SDK Manager
+USER gitpod
+RUN  wget https://dl.google.com/android/repository/commandlinetools-linux-7583922_latest.zip \
+    && mkdir -p $ANDROID_HOME/cmdline-tools/latest \
+    && unzip commandlinetools-linux-*.zip -d $ANDROID_HOME \
+    && rm -f commandlinetools-linux-*.zip \
+    && mv $ANDROID_HOME/cmdline-tools/bin $ANDROID_HOME/cmdline-tools/latest \
+    && mv $ANDROID_HOME/cmdline-tools/lib $ANDROID_HOME/cmdline-tools/latest
+
+RUN echo "export ANDROID_HOME=$ANDROID_HOME" >> /home/gitpod/.bashrc \
+    && echo 'export PATH=$ANDROID_HOME/emulator:$ANDROID_HOME/tools:$ANDROID_HOME/cmdline-tools/bin:$ANDROID_HOME/platform-tools:$PATH' >> /home/gitpod/.bashrc
+
+# Install Android Image version 30
+USER gitpod
+RUN yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "platform-tools" "platforms;android-30" "emulator"
+RUN yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager "system-images;android-30;google_apis;x86_64"
+RUN echo no | $ANDROID_HOME/cmdline-tools/latest/bin/avdmanager create avd -n avd28 -k "system-images;android-30;google_apis;x86_64"
+
+
+# Install Google Chrome
+USER root
+RUN apt-get update \
+  && apt-get install -y apt-transport-https \
+  && curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
+  && echo "deb [arch=amd64] https://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list \
+  && apt-get update \
+  && sudo apt-get install -y google-chrome-stable
+
+# misc deps
+RUN apt-get install -y \
+  libasound2-dev \
+  libgtk-3-dev \
+  libnss3-dev \
+  fonts-noto \
+  fonts-noto-cjk
+
+# For Qt WebEngine on docker
+ENV QTWEBENGINE_DISABLE_SANDBOX 1

+ 75 - 0
.gitpod.yml

@@ -0,0 +1,75 @@
+image:
+  file: .gitpod.Dockerfile
+tasks:
+  - before: sudo mount -t tmpfs shm -osize=4096m /dev/shm
+  - init: |
+      flutter channel beta
+      flutter upgrade
+
+      # flutter config --enable-web
+      flutter config --android-sdk /home/gitpod/androidsdk
+      yes | flutter doctor --android-licenses
+
+      # flutter doctor
+
+      # flutter pub get
+
+      # flutter build -v bundle
+      # flutter build -v web
+      # flutter build -v appbundle
+      # flutter build -v apk
+      
+  # - command: |
+  #     # Gitpod is not able to run emulators within a worspace at this stage as
+  #     # Google Kubernetes Engine does not support Nested Virtualization.
+  #     #
+  #     # If running Gitpod on your own infrastructure or via the Dockerfile locally
+  #     # on infrastructure that exposes vmx or svm then this command will launch
+  #     # the emulator.
+  #     #
+  #     # $ emulator -avd avd28 -no-audio -no-window 
+  #     #
+  #     # Until this restriction is mitigated you can run native mobile apps in your
+  #     # browser via https://appetize.io/
+
+  #     if [[ -z "$APPETIZE_API_TOKEN" ]]; then
+  #         echo "Appetize API token not set. Run:"
+  #         echo ""
+  #         echo "    gp env APPETIZE_API_TOKEN=your_token"
+  #         echo ""
+  #         echo "and restart this workspace in order to get an app preview."
+  #         echo ""
+  #         echo "Request your token here: https://appetize.io/docs#request-api-token"
+  #     else
+  #         curl -sS --http1.1 "https://$APPETIZE_API_TOKEN@api.appetize.io/v1/apps/$APPETIZE_PUBLICKEY" \
+  #             -F "file=@/workspace/template-flutter/build/app/outputs/flutter-apk/app.apk" \
+  #             -F platform=android \
+  #             -F "buttonText=Start App" \
+  #             -F "postSessionButtonText=Start App" \
+  #             > .appetize.json
+
+  #         APPETIZE_PUBLICKEY=$(jq -r .publicKey .appetize.json)
+  #         gp env "APPETIZE_PUBLICKEY=$APPETIZE_PUBLICKEY"
+  #         export APPETIZE_PUBLICKEY
+
+  #         python -m webbrowser "https://appetize.io/embed/$APPETIZE_PUBLICKEY?device=pixel4&autoplay=true"
+  #     fi
+
+  #     flutter devices
+    
+  #     flutter run --web-port 8080
+
+
+ports:
+  - port: 5900
+    onOpen: ignore
+    # vnc
+  - port: 6080
+    onOpen: open-preview
+    # flutter
+  - port: 8080
+    onOpen: open-preview
+
+vscode:
+  extensions:
+    - dart-code.flutter

+ 2 - 14
android/app/build.gradle

@@ -22,25 +22,17 @@ if (flutterVersionName == null) {
 }
 
 apply plugin: 'com.android.application'
-apply plugin: 'kotlin-android'
 apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
 
 android {
-    compileSdkVersion 30
+    compileSdkVersion 31
 
-    sourceSets {
-        main.java.srcDirs += 'src/main/kotlin'
-    }
-
-    lintOptions {
-        disable 'InvalidPackage'
-    }
 
     defaultConfig {
         // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
         applicationId "com.example.demo"
         minSdkVersion 16
-        targetSdkVersion 30
+        targetSdkVersion 31
         versionCode flutterVersionCode.toInteger()
         versionName flutterVersionName
     }
@@ -60,7 +52,3 @@ android {
 flutter {
     source '../..'
 }
-
-dependencies {
-    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
-}

+ 1 - 1
android/app/src/main/AndroidManifest.xml

@@ -7,7 +7,7 @@
          FlutterApplication and put your custom class here. -->
     <uses-permission android:name="android.permission.INTERNET"/>
     <application
-        android:name="io.flutter.app.FlutterApplication"
+        
         android:label="demo"
         android:usesCleartextTraffic="true"
         android:icon="@mipmap/ic_launcher">

+ 7 - 0
android/app/src/main/java/com/example/demo/MainActivity.java

@@ -0,0 +1,7 @@
+package com.example.demo;
+
+
+import io.flutter.embedding.android.FlutterActivity;
+
+public class MainActivity extends FlutterActivity {
+}

+ 7 - 0
android/app/src/main/java/com/example/eye_video/MainActivity.java

@@ -0,0 +1,7 @@
+package com.example.eye_video;
+
+
+import io.flutter.embedding.android.FlutterActivity;
+
+public class MainActivity extends FlutterActivity {
+}

+ 0 - 6
android/app/src/main/kotlin/com/example/demo/MainActivity.kt

@@ -1,6 +0,0 @@
-package com.example.demo
-
-import io.flutter.embedding.android.FlutterActivity
-
-class MainActivity: FlutterActivity() {
-}

+ 0 - 6
android/app/src/main/kotlin/com/example/eye_video/MainActivity.kt

@@ -1,6 +0,0 @@
-package com.example.eye_video
-
-import io.flutter.embedding.android.FlutterActivity
-
-class MainActivity: FlutterActivity() {
-}

+ 3 - 5
android/build.gradle

@@ -1,20 +1,18 @@
 buildscript {
-    ext.kotlin_version = '1.3.50'
     repositories {
         google()
-        jcenter()
+        mavenCentral()
     }
 
     dependencies {
-        classpath 'com.android.tools.build:gradle:4.1.0'
-        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
+        classpath 'com.android.tools.build:gradle:7.2.2'
     }
 }
 
 allprojects {
     repositories {
         google()
-        jcenter()
+        mavenCentral()
     }
 }
 

+ 1 - 1
android/gradle/wrapper/gradle-wrapper.properties

@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip

+ 1 - 1
lib/bizmodule/bizwidget/cover_image_item.dart

@@ -47,7 +47,7 @@ class CoverImageItem extends StatelessWidget {
 
       return Stack(
         alignment: AlignmentDirectional.bottomEnd,
-        children: <Widget>[
+        children: [
           coverImageWidget,
           Positioned(
             child: tvTimeLabel,

+ 1 - 1
lib/bizmodule/main/selections/widgets/follow_Item.dart

@@ -25,7 +25,7 @@ class FollowItemVideo extends StatelessWidget {
     return Container(
       margin: EdgeInsets.all(10),
       child: Column(
-        children: <Widget>[
+        children: [
           CoverImageItem(
             coverUrl: coverUrl,
             duration: duration,

+ 2 - 2
lib/framework/uikit/layout/nine_layout.dart

@@ -55,13 +55,13 @@ class NineLayoutDelegate extends FlowDelegate {
       var w = context.getChildSize(i).width + x;
       if (w < totalW) {
         context.paintChild(i,
-            transform: new Matrix4.translationValues(x, y, 0.0));
+            transform: Matrix4.translationValues(x, y, 0.0));
         x += context.getChildSize(i).width + gap;
       } else {
         x = gap;
         y += context.getChildSize(i).height + gap;
         context.paintChild(i,
-            transform: new Matrix4.translationValues(x, y, 0.0));
+            transform: Matrix4.translationValues(x, y, 0.0));
         x += context.getChildSize(i).width + gap;
       }
     }

+ 6 - 6
lib/framework/uikit/refresher/indicator/classic/classic_footer.dart

@@ -253,9 +253,9 @@ class ClassicFooterWidgetState extends State<ClassicFooterWidget>
     // 初始化时间
     _dateTime = DateTime.now();
     // 初始化动画
-    _readyController = new AnimationController(
+    _readyController = AnimationController(
         duration: const Duration(milliseconds: 200), vsync: this);
-    _readyAnimation = new Tween(begin: 0.5, end: 1.0).animate(_readyController)
+    _readyAnimation = Tween(begin: 0.5, end: 1.0).animate(_readyController)
       ..addListener(() {
         setState(() {
           if (_readyAnimation.status != AnimationStatus.dismissed) {
@@ -268,10 +268,10 @@ class ClassicFooterWidgetState extends State<ClassicFooterWidget>
         _readyController.reset();
       }
     });
-    _restoreController = new AnimationController(
+    _restoreController = AnimationController(
         duration: const Duration(milliseconds: 200), vsync: this);
     _restoreAnimation =
-        new Tween(begin: 1.0, end: 0.5).animate(_restoreController)
+        Tween(begin: 1.0, end: 0.5).animate(_restoreController)
           ..addListener(() {
             setState(() {
               if (_restoreAnimation.status != AnimationStatus.dismissed) {
@@ -305,7 +305,7 @@ class ClassicFooterWidgetState extends State<ClassicFooterWidget>
     overTriggerDistance = widget.loadState != LoadMode.inactive &&
         widget.pulledExtent >= widget.loadTriggerPullDistance;
     return Stack(
-      children: <Widget>[
+      children: [
         Positioned(
           top: !isVertical ? 0.0 : !isReverse ? 0.0 : null,
           bottom: !isVertical ? 0.0 : isReverse ? 0.0 : null,
@@ -394,7 +394,7 @@ class ClassicFooterWidgetState extends State<ClassicFooterWidget>
               child: Column(
                 crossAxisAlignment: CrossAxisAlignment.center,
                 mainAxisAlignment: MainAxisAlignment.center,
-                children: <Widget>[
+                children: [
                   Text(
                     _showText,
                     style: TextStyle(

+ 8 - 8
lib/framework/uikit/refresher/indicator/classic/classic_header.dart

@@ -289,9 +289,9 @@ class ClassicHeaderWidgetState extends State<ClassicHeaderWidget>
     // 初始化时间
     _dateTime = DateTime.now();
     // 准备动画
-    _readyController = new AnimationController(
+    _readyController = AnimationController(
         duration: const Duration(milliseconds: 200), vsync: this);
-    _readyAnimation = new Tween(begin: 0.5, end: 1.0).animate(_readyController)
+    _readyAnimation = Tween(begin: 0.5, end: 1.0).animate(_readyController)
       ..addListener(() {
         setState(() {
           if (_readyAnimation.status != AnimationStatus.dismissed) {
@@ -305,10 +305,10 @@ class ClassicHeaderWidgetState extends State<ClassicHeaderWidget>
       }
     });
     // 恢复动画
-    _restoreController = new AnimationController(
+    _restoreController = AnimationController(
         duration: const Duration(milliseconds: 200), vsync: this);
     _restoreAnimation =
-        new Tween(begin: 1.0, end: 0.5).animate(_restoreController)
+        Tween(begin: 1.0, end: 0.5).animate(_restoreController)
           ..addListener(() {
             setState(() {
               if (_restoreAnimation.status != AnimationStatus.dismissed) {
@@ -322,10 +322,10 @@ class ClassicHeaderWidgetState extends State<ClassicHeaderWidget>
       }
     });
     // float收起动画
-    _floatBackController = new AnimationController(
+    _floatBackController = AnimationController(
         duration: const Duration(milliseconds: 300), vsync: this);
     _floatBackAnimation =
-        new Tween(begin: widget.refreshIndicatorExtent, end: 0.0)
+        Tween(begin: widget.refreshIndicatorExtent, end: 0.0)
             .animate(_floatBackController)
               ..addListener(() {
                 setState(() {
@@ -364,7 +364,7 @@ class ClassicHeaderWidgetState extends State<ClassicHeaderWidget>
       refreshFinish = true;
     }
     return Stack(
-      children: <Widget>[
+      children: [
         Positioned(
           top: !isVertical
               ? 0.0
@@ -483,7 +483,7 @@ class ClassicHeaderWidgetState extends State<ClassicHeaderWidget>
               child: Column(
                 crossAxisAlignment: CrossAxisAlignment.center,
                 mainAxisAlignment: MainAxisAlignment.center,
-                children: <Widget>[
+                children: [
                   Text(
                     _showText,
                     style: TextStyle(

+ 1 - 1
lib/framework/uikit/refresher/indicator/material/material_footer.dart

@@ -117,7 +117,7 @@ class MaterialFooterWidgetState extends State<MaterialFooterWidget> {
     double indicatorValue = _pulledExtent / _riggerPullDistance;
     indicatorValue = indicatorValue < 1.0 ? indicatorValue : 1.0;
     return Stack(
-      children: <Widget>[
+      children: [
         Positioned(
           top: isVertical ? !isReverse ? 0.0 : null : 0.0,
           bottom: isVertical ? isReverse ? 0.0 : null : 0.0,

+ 1 - 1
lib/framework/uikit/refresher/indicator/material/material_header.dart

@@ -183,7 +183,7 @@ class MaterialHeaderWidgetState extends State<MaterialHeaderWidget>
           ? _refreshState == RefreshMode.inactive ? 0.0 : _pulledExtent
           : double.infinity,
       child: Stack(
-        children: <Widget>[
+        children: [
           Positioned(
             top: isVertical ? isReverse ? 0.0 : null : 0.0,
             bottom: isVertical ? !isReverse ? 0.0 : null : 0.0,

+ 1 - 1
lib/framework/uikit/refresher/physics/scroll_physics.dart

@@ -179,7 +179,7 @@ class RefreshPhysics extends ScrollPhysics {
   // 2- Record incoming speed and make rapid flings in the test app.
   // 3- If the scrollables stopped overlapping at any moment, adjust the desired
   //    output value of this function at that input speed.
-  // 4- Feed new input/output set into a power curve fitter. Change function
+  // 4- Feed input/output set into a power curve fitter. Change function
   //    and repeat from 2.
   // 5- Repeat from 2 with medium and slow flings.
   // Momentum build-up function that mimics iOS's scroll speed increase with repeated flings.

+ 6 - 6
lib/framework/uikit/refresher/sliver/sliver_loading.dart

@@ -208,11 +208,11 @@ class _RenderRefreshSliverLoad extends RenderSliverSingleBoxAdapter {
       }
     }
 
-    // The new layout extent this sliver should now have.
+    // The layout extent this sliver should now have.
     final double layoutExtent =
         (_hasLayoutExtent || enableInfiniteLoad ? 1.0 : 0.0) *
             _loadIndicatorExtent;
-    // If the new layoutExtent instructive changed, the SliverGeometry's
+    // If the layoutExtent instructive changed, the SliverGeometry's
     // layoutExtent will take that value (on the next performLayout run). Shift
     // the scroll offset first so it doesn't make the scroll position suddenly jump.
     /*if (layoutExtent != layoutExtentOffsetCompensation) {
@@ -222,7 +222,7 @@ class _RenderRefreshSliverLoad extends RenderSliverSingleBoxAdapter {
       layoutExtentOffsetCompensation = layoutExtent;
       // Return so we don't have to do temporary accounting and adjusting the
       // child's constraints accounting for this one transient frame using a
-      // combination of existing layout extent, new layout extent change and
+      // combination of existing layout extent, layout extent change and
       // the overlap.
       return;
     }*/
@@ -404,7 +404,7 @@ typedef BindLoadIndicator = void Function(
 ///    [RefreshSliverLoadControl] is part of the scrollable and actively occupies
 ///    scrollable space.
 class RefreshSliverLoadControl extends StatefulWidget {
-  /// Create a new refresh control for inserting into a list of slivers.
+  /// Create a refresh control for inserting into a list of slivers.
   ///
   /// The [loadTriggerPullDistance] and [loadIndicatorExtent] arguments
   /// must not be null and must be >= 0.
@@ -870,7 +870,7 @@ class _RefreshSliverLoadControlState extends State<RefreshSliverLoadControl> {
             // 顶出列表未占满多余部分
             return isVertical
                 ? Column(
-                    children: <Widget>[
+                    children: [
                       isReverse
                           ? SizedBox()
                           : Expanded(
@@ -890,7 +890,7 @@ class _RefreshSliverLoadControlState extends State<RefreshSliverLoadControl> {
                     ],
                   )
                 : Row(
-                    children: <Widget>[
+                    children: [
                       isReverse
                           ? SizedBox()
                           : Expanded(

+ 3 - 3
lib/framework/uikit/refresher/sliver/sliver_refresh.dart

@@ -210,11 +210,11 @@ class _RenderRefreshSliverRefresh extends RenderSliverSingleBoxAdapter {
       }
     }
 
-    // The new layout extent this sliver should now have.
+    // The layout extent this sliver should now have.
     final double layoutExtent =
         (_hasLayoutExtent || enableInfiniteRefresh ? 1.0 : 0.0) *
             _refreshIndicatorExtent;
-    // If the new layoutExtent instructive changed, the SliverGeometry's
+    // If the layoutExtent instructive changed, the SliverGeometry's
     // layoutExtent will take that value (on the next performLayout run). Shift
     // the scroll offset first so it doesn't make the scroll position suddenly jump.
     // 如果Header浮动则不用过渡
@@ -226,7 +226,7 @@ class _RenderRefreshSliverRefresh extends RenderSliverSingleBoxAdapter {
         layoutExtentOffsetCompensation = layoutExtent;
         // Return so we don't have to do temporary accounting and adjusting the
         // child's constraints accounting for this one transient frame using a
-        // combination of existing layout extent, new layout extent change and
+        // combination of existing layout extent, layout extent change and
         // the overlap.
         return;
       }

+ 11 - 11
pubspec.yaml

@@ -4,7 +4,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
 version: 1.0.0+1
 
 environment:
-  sdk: ">=2.7.0 <3.0.0"
+  sdk: ">=2.17.6 <3.0.0"
 
 dependencies:
   flutter:
@@ -32,13 +32,13 @@ flutter:
     - assets/images/
     # - assets/images/2.0x/
     # - assets/images/3.0x/
-  fonts:
-    - family: NotoSansHans-Medium
-      fonts:
-        - asset: assets/fonts/NotoSansHans-Medium.otf
-    - family: NotoSansHans-Regular
-      fonts:
-        - asset: assets/fonts/NotoSansHans-Regular.otf
-    - family: Oswald-Regular
-      fonts:
-        - asset: assets/fonts/Oswald-Regular.otf
+  # fonts:
+  #   - family: NotoSansHans-Medium
+  #     fonts:
+  #       - asset: assets/fonts/NotoSansHans-Medium.otf
+  #   - family: NotoSansHans-Regular
+  #     fonts:
+  #       - asset: assets/fonts/NotoSansHans-Regular.otf
+  #   - family: Oswald-Regular
+  #     fonts:
+  #       - asset: assets/fonts/Oswald-Regular.otf