git@h5.yoqi.me 1 year ago
parent
commit
f6df1e7e85

+ 1 - 0
.devcontainer/Dockerfile

@@ -0,0 +1 @@
+FROM jianboy/flutter-dev-container:2.10.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 8",
+    "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-1.8",
+                "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

+ 1 - 1
lib/main.dart

@@ -50,7 +50,7 @@ class MyOSCClientState extends State<MyOSCClient> {
       ];
     }
     _body = new IndexedStack(
-      children: <Widget>[
+      children: [
         new NewsListPage(),
         new TweetsListPage(),
         new DiscoveryPage(),

+ 4 - 4
lib/pages/AboutPage.dart

@@ -31,7 +31,7 @@ class AboutPageState extends State<AboutPage> {
         margin: const EdgeInsets.fromLTRB(0.0, 80.0, 0.0, 0.0),
         child: new Row(
           mainAxisAlignment: MainAxisAlignment.center,
-          children: <Widget>[
+          children: [
             new Text("作者:"),
             new Text(
               "yubo",
@@ -47,7 +47,7 @@ class AboutPageState extends State<AboutPage> {
         margin: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0),
         child: new Row(
           mainAxisAlignment: MainAxisAlignment.center,
-          children: <Widget>[
+          children: [
             new Text("码云:"),
             new Text(
               "https://gitee.com/yubo725",
@@ -63,7 +63,7 @@ class AboutPageState extends State<AboutPage> {
         margin: const EdgeInsets.fromLTRB(0.0, 10.0, 0.0, 0.0),
         child: new Row(
           mainAxisAlignment: MainAxisAlignment.center,
-          children: <Widget>[
+          children: [
             new Text("GitHub:"),
             new Text(
               "https://github.com/yubo725",
@@ -124,7 +124,7 @@ class AboutPageState extends State<AboutPage> {
       ),
       body: new Center(
         child: new Column(
-          children: <Widget>[
+          children: [
             new Container(
               width: 1.0,
               height: 100.0,

+ 2 - 2
lib/pages/BlackHousePage.dart

@@ -172,7 +172,7 @@ class BlackHousePageState extends State<BlackHousePage> {
       return new Center(
         child: new Column(
           mainAxisAlignment: MainAxisAlignment.center,
-          children: <Widget>[
+          children: [
             new Text("小黑屋中没人..."),
             new Text("长按动弹列表即可往小黑屋中加人")
           ],
@@ -188,7 +188,7 @@ class BlackHousePageState extends State<BlackHousePage> {
           color: Colors.black,
           child: new Column(
             mainAxisAlignment: MainAxisAlignment.center,
-            children: <Widget>[
+            children: [
               new Container(
                 width: 45.0,
                 height: 45.0,

+ 1 - 1
lib/pages/DiscoveryPage.dart

@@ -99,7 +99,7 @@ class DiscoveryPage extends StatelessWidget {
       var listItemContent =  new Padding(
         padding: const EdgeInsets.fromLTRB(10.0, 15.0, 10.0, 15.0),
         child: new Row(
-          children: <Widget>[
+          children: [
             getIconImage(item.icon),
             new Expanded(
                 child: new Text(item.title, style: titleTextStyle,)

+ 2 - 2
lib/pages/MyInfoPage.dart

@@ -139,7 +139,7 @@ class MyInfoPageState extends State<MyInfoPage> {
         child: new Center(
           child: new Column(
             mainAxisAlignment: MainAxisAlignment.center,
-            children: <Widget>[
+            children: [
               userAvatar == null
                   ? new Image.asset(
                       "images/ic_avatar_default.png",
@@ -194,7 +194,7 @@ class MyInfoPageState extends State<MyInfoPage> {
     var listItemContent = new Padding(
       padding: const EdgeInsets.fromLTRB(10.0, 15.0, 10.0, 15.0),
       child: new Row(
-        children: <Widget>[
+        children: [
           icons[i],
           new Expanded(
               child: new Text(

+ 5 - 5
lib/pages/NewsListPage.dart

@@ -115,14 +115,14 @@ class NewsListPageState extends State<NewsListPage> {
       return new CommonEndLine();
     }
     var titleRow = new Row(
-      children: <Widget>[
+      children: [
         new Expanded(
           child: new Text(itemData['title'], style: titleTextStyle),
         )
       ],
     );
     var timeRow = new Row(
-      children: <Widget>[
+      children: [
         new Container(
           width: 20.0,
           height: 20.0,
@@ -148,7 +148,7 @@ class NewsListPageState extends State<NewsListPage> {
           flex: 1,
           child: new Row(
             mainAxisAlignment: MainAxisAlignment.end,
-            children: <Widget>[
+            children: [
               new Text("${itemData['commCount']}", style: subtitleStyle),
               new Image.asset('./images/ic_comment.png', width: 16.0, height: 16.0),
             ],
@@ -191,13 +191,13 @@ class NewsListPageState extends State<NewsListPage> {
       );
     }
     var row = new Row(
-      children: <Widget>[
+      children: [
         new Expanded(
           flex: 1,
           child: new Padding(
             padding: const EdgeInsets.all(10.0),
             child: new Column(
-              children: <Widget>[
+              children: [
                 titleRow,
                 new Padding(
                   padding: const EdgeInsets.fromLTRB(0.0, 8.0, 0.0, 0.0),

+ 3 - 3
lib/pages/OfflineActivityPage.dart

@@ -85,7 +85,7 @@ class OfflineActivityPageState extends State<OfflineActivityPage> {
   Widget getCard(itemData) {
     return new Card(
       child: new Column(
-        children: <Widget>[
+        children: [
           new Image.network(itemData['cover'], fit: BoxFit.cover,),
           new Container(
             margin: const EdgeInsets.fromLTRB(10.0, 5.0, 10.0, 5.0),
@@ -95,7 +95,7 @@ class OfflineActivityPageState extends State<OfflineActivityPage> {
           new Container(
               margin: const EdgeInsets.fromLTRB(10.0, 0.0, 10.0, 5.0),
               child: new Row(
-                children: <Widget>[
+                children: [
                   new Expanded(child: new Text(itemData['authorName']), flex: 1,),
                   new Text(itemData['timeStr'])
                 ],
@@ -168,7 +168,7 @@ class OfflineActivityPageState extends State<OfflineActivityPage> {
               ],
             ),
             body: new TabBarView(
-              children: <Widget>[
+              children: [
                 getRecBody(),
                 getLatestBody(),
                 getYchBody()

+ 1 - 1
lib/pages/PublishTweetPage.dart

@@ -125,7 +125,7 @@ class PublishTweetPageState extends State<PublishTweetPage> {
       child: new Padding(
         padding: const EdgeInsets.fromLTRB(0.0, 30.0, 0.0, 30.0),
         child: new Column(
-          children: <Widget>[
+          children: [
             _renderBottomMenuItem("相机拍照", ImageSource.camera),
             new Divider(height: 2.0,),
             _renderBottomMenuItem("图库选择照片", ImageSource.gallery)

+ 1 - 1
lib/pages/SettingsPage.dart

@@ -73,7 +73,7 @@ class SettingsPage extends StatelessWidget {
       var listItemContent = new Padding(
         padding: const EdgeInsets.fromLTRB(10.0, 15.0, 10.0, 15.0),
         child: new Row(
-          children: <Widget>[
+          children: [
             getIconImage(item.icon),
             new Expanded(
                 child: new Text(

+ 1 - 1
lib/pages/TestPage.dart

@@ -13,7 +13,7 @@ class TestPage extends StatelessWidget {
         body: new Center(
           child: new Column(
             mainAxisAlignment: MainAxisAlignment.center,
-            children: <Widget>[
+            children: [
               new Text("hello"),
               new Text("world")
             ],

+ 11 - 11
lib/pages/TweetDetailPage.dart

@@ -145,7 +145,7 @@ class TweetDetailPageState extends State<TweetDetailPage> {
     String content = listItem['content'];
     content = clearHtmlContent(content);
     var row = new Row(
-      children: <Widget>[
+      children: [
         new Padding(
           padding: const EdgeInsets.all(10.0),
           child: new Image.network(avatar, width: 35.0, height: 35.0,)
@@ -154,9 +154,9 @@ class TweetDetailPageState extends State<TweetDetailPage> {
           child: new Container(
             margin: const EdgeInsets.fromLTRB(0.0, 5.0, 0.0, 5.0),
             child: new Column(
-              children: <Widget>[
+              children: [
                 new Row(
-                  children: <Widget>[
+                  children: [
                     new Expanded(
                       child: new Text(author, style: new TextStyle(color: const Color(0xFF63CA6C)),),
                     ),
@@ -169,7 +169,7 @@ class TweetDetailPageState extends State<TweetDetailPage> {
                 new Padding(
                     padding: const EdgeInsets.fromLTRB(0.0, 0.0, 10.0, 0.0),
                     child: new Row(
-                      children: <Widget>[
+                      children: [
                         new Expanded(
                             child: new Text(content, style: contentStyle,)
                         )
@@ -212,9 +212,9 @@ class TweetDetailPageState extends State<TweetDetailPage> {
           height: 230.0,
           padding: const EdgeInsets.all(20.0),
           child: new Column(
-            children: <Widget>[
+            children: [
               new Row(
-                children: <Widget>[
+                children: [
                   new Text(isMainFloor ? "回复楼主" : "回复"),
                   new Expanded(child: new Text(title, style: new TextStyle(color: const Color(0xFF63CA6C)),)),
                   new InkWell(
@@ -296,7 +296,7 @@ class TweetDetailPageState extends State<TweetDetailPage> {
 
   Widget getTweetView(Map<String, dynamic> listItem) {
     var authorRow = new Row(
-      children: <Widget>[
+      children: [
         new Container(
           width: 35.0,
           height: 35.0,
@@ -322,7 +322,7 @@ class TweetDetailPageState extends State<TweetDetailPage> {
         new Expanded(
           child: new Row(
             mainAxisAlignment: MainAxisAlignment.end,
-            children: <Widget>[
+            children: [
               new Text('${listItem['commentCount']}', style: subtitleStyle,),
               new Image.asset('./images/ic_comment.png', width: 20.0, height: 20.0,)
             ],
@@ -333,13 +333,13 @@ class TweetDetailPageState extends State<TweetDetailPage> {
     var _body = listItem['body'];
     _body = clearHtmlContent(_body);
     var contentRow = new Row(
-      children: <Widget>[
+      children: [
         new Expanded(child: new Text(_body),)
       ],
     );
     var timeRow = new Row(
       mainAxisAlignment: MainAxisAlignment.start,
-      children: <Widget>[
+      children: [
         new Text(listItem['pubDate'], style: subtitleStyle,)
       ],
     );
@@ -403,7 +403,7 @@ class TweetDetailPageState extends State<TweetDetailPage> {
     columns.add(new Container(
       margin: const EdgeInsets.fromLTRB(0.0, 6.0, 0.0, 0.0),
       child: new Row(
-        children: <Widget>[
+        children: [
           new Container(
             width: 4.0,
             height: 20.0,

+ 7 - 7
lib/pages/TweetsListPage.dart

@@ -156,7 +156,7 @@ class TweetsListPageState extends State<TweetsListPage> {
 
   Widget getRowWidget(Map<String, dynamic> listItem) {
     var authorRow = new Row(
-      children: <Widget>[
+      children: [
         new Container(
           width: 35.0,
           height: 35.0,
@@ -181,7 +181,7 @@ class TweetsListPageState extends State<TweetsListPage> {
         new Expanded(
           child: new Row(
             mainAxisAlignment: MainAxisAlignment.end,
-            children: <Widget>[
+            children: [
               new Text(
                 '${listItem['commentCount']}',
                 style: subtitleStyle,
@@ -199,7 +199,7 @@ class TweetsListPageState extends State<TweetsListPage> {
     var _body = listItem['body'];
     _body = clearHtmlContent(_body);
     var contentRow = new Row(
-      children: <Widget>[
+      children: [
         new Expanded(
           child: new Text(_body),
         )
@@ -207,7 +207,7 @@ class TweetsListPageState extends State<TweetsListPage> {
     );
     var timeRow = new Row(
       mainAxisAlignment: MainAxisAlignment.end,
-      children: <Widget>[
+      children: [
         new Text(
           listItem['pubDate'],
           style: subtitleStyle,
@@ -454,12 +454,12 @@ class TweetsListPageState extends State<TweetsListPage> {
       return new Center(
         child: new Column(
           mainAxisAlignment: MainAxisAlignment.center,
-          children: <Widget>[
+          children: [
             new Container(
               padding: const EdgeInsets.all(10.0),
               child: new Center(
                 child: new Column(
-                  children: <Widget>[
+                  children: [
                     new Text("由于OSC的openapi限制"),
                     new Text("必须登录后才能获取动弹信息")
                   ],
@@ -503,7 +503,7 @@ class TweetsListPageState extends State<TweetsListPage> {
           ],
         ),
         body: new TabBarView(
-          children: <Widget>[getNormalListView(), getHotListView()],
+          children: [getNormalListView(), getHotListView()],
         )),
     );
   }

+ 1 - 1
lib/widgets/CommonEndLine.dart

@@ -7,7 +7,7 @@ class CommonEndLine extends StatelessWidget {
       color: const Color(0xFFEEEEEE),
       padding: const EdgeInsets.fromLTRB(5.0, 15.0, 5.0, 15.0),
       child: new Row(
-        children: <Widget>[
+        children: [
           new Expanded(
             child: new Divider(height: 10.0,),
             flex: 1,

+ 1 - 1
lib/widgets/MyDrawer.dart

@@ -62,7 +62,7 @@ class MyDrawer extends StatelessWidget {
     var listItemContent =  new Padding(
       padding: const EdgeInsets.fromLTRB(10.0, 15.0, 10.0, 15.0),
       child: new Row(
-        children: <Widget>[
+        children: [
           getIconImage(menuIcons[index]),
           new Expanded(
               child: new Text(menuTitles[index], style: menuStyle,)

+ 1 - 1
lib/widgets/SlideView.dart

@@ -58,7 +58,7 @@ class SlideViewState extends State<SlideView> with SingleTickerProviderStateMixi
             ));
           },
           child: new Stack(
-            children: <Widget>[
+            children: [
               new Image.network(imgUrl),
               new Container(
                 width: MediaQuery.of(context).size.width,