Bladeren bron

[feat]键盘,更换悬浮窗图标,引导页UI调整

hezihao 7 maanden geleden
bovenliggende
commit
09e4e7a80f

+ 14 - 15
lib/module/keyboard_guide/keyboard_guide_page.dart

@@ -348,6 +348,7 @@ class KeyboardGuidePage extends BasePage<KeyboardGuidePageController> {
           children: [
             // 聊天气泡
             _buildMsgBubble(msg),
+            SizedBox(width: 9.w),
             // 头像
             _buildAvatar(msg),
           ],
@@ -362,6 +363,7 @@ class KeyboardGuidePage extends BasePage<KeyboardGuidePageController> {
           children: [
             // 头像
             _buildAvatar(msg),
+            SizedBox(width: 9.w),
             // 聊天气泡
             _buildMsgBubble(msg),
           ],
@@ -383,21 +385,18 @@ class KeyboardGuidePage extends BasePage<KeyboardGuidePageController> {
   /// 构建头像
   Widget _buildAvatar(KeyboardGuideMsg msg) {
     double avatarSize = 36.0;
-    return Container(
-      margin: const EdgeInsets.only(right: 9.0),
-      child: CircleAvatar(
-        radius: 20,
-        child:
-            msg.isMe
-                ? Assets.images.iconDefaultAvatar.image(
-                  height: avatarSize,
-                  width: avatarSize,
-                )
-                : Assets.images.iconTaAvatar.image(
-                  height: avatarSize,
-                  width: avatarSize,
-                ),
-      ),
+    return CircleAvatar(
+      radius: 20,
+      child:
+          msg.isMe
+              ? Assets.images.iconDefaultAvatar.image(
+                height: avatarSize,
+                width: avatarSize,
+              )
+              : Assets.images.iconTaAvatar.image(
+                height: avatarSize,
+                width: avatarSize,
+              ),
     );
   }
 }

+ 11 - 0
lib/plugins/keyboard_android_platform.dart

@@ -27,6 +27,17 @@ class KeyboardAndroidPlatform {
     await initPlugin();
     // 默认键盘切换监听器
     DefaultKeyboardMonitor.init();
+    startFlowingBall();
+  }
+
+  /// 开启悬浮球
+  static Future<void> startFlowingBall() async {
+    bool hasFloatingWindowPermission =
+        await KeyboardAndroidPlatform.hasFloatingWindowPermission();
+    // 已有权限,则显示悬浮球
+    if (hasFloatingWindowPermission) {
+      KeyboardAndroidPlatform.enableFloatingWindow(true);
+    }
   }
 
   static Future<void> sendDynamicTextRequest(

+ 7 - 7
plugins/keyboard_android/android/src/main/res/layout/floating_button_layout.xml

@@ -1,15 +1,15 @@
 <?xml version="1.0" encoding="utf-8"?>
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:tools="http://schemas.android.com/tools"
     android:layout_width="wrap_content"
-    android:layout_height="wrap_content">
+    android:layout_height="wrap_content"
+    tools:background="@android:color/holo_blue_dark">
 
     <ImageView
         android:id="@+id/floating_button"
-        android:layout_width="40dp"
-        android:layout_height="40dp"
-        android:padding="10dp"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:padding="5dp"
         android:scaleType="centerInside"
-        android:scaleX="1.8"
-        android:scaleY="1.8"
-        android:src="@mipmap/ic_keyboard_icon" />
+        android:src="@mipmap/ic_floating_ball" />
 </FrameLayout>

BIN
plugins/keyboard_android/android/src/main/res/mipmap-xxxhdpi/ic_floating_ball.webp


+ 8 - 0
pubspec.lock

@@ -368,6 +368,14 @@ packages:
       url: "https://pub.dev"
     source: hosted
     version: "2.1.0"
+  dropdown_button2:
+    dependency: "direct main"
+    description:
+      name: dropdown_button2
+      sha256: "95f5fa6f33e3ac3e3a9150be024101d7a82ff808210009a8f700255045b9429e"
+      url: "https://pub.dev"
+    source: hosted
+    version: "3.0.0-beta.22"
   easy_refresh:
     dependency: "direct main"
     description: