Flutter+WebRTC开发点对点加密即时通讯APP--SplashScreen启动屏实现

Flutter+WebRTC开发点对点加密即时通讯APP--SplashScreen启动屏实现

开篇

基于Flutter+WebRTC,开发一款点对点加密、跨端、即时通讯APP,实现文字、音视频通话聊天,同时支持图片、短视频等文件传输功能,计划支持Windows、Android平台。我准备将自己的学习和实践过程记录下来,同时分享给大家,欢迎大家一起研讨交流。这个工程是利用自己的业余时间来实现的,不定时更新。本篇文章实现APP的SplashScreen启动屏。

SplashScreen启动屏

APP展示给用户的第一个界面就是SplashScreen启动屏界面(闪屏),目前国内APP的启动屏都很丑陋,广告图片满天飞,看得我很是心烦,不想使用一下,所以我不能这样。我们也要给自己的APP来实现一个SplashScreen启动屏界面,必须要美观一点。我们在启动屏放置一个加载可爱动画,来缓解用户等待启动时的焦急心理。我前边的文章《flutter Android SplashScreen 看我如何实现安卓精美的启动页(闪屏)》有详细的设置说明,有兴趣的可以去我主页翻看这篇文章。

我们的思路是先找一个现成lottie动画文件下载下来,然后将动画文件利用AE的插件Bodymovin导入AE中对其进行编辑修改,修改完成后再使用AE的Bodymovin插件将动画文件导出成(AVD) XML文件,最后将(AVD) XML文件导入到flutter的Android的android\app\src\main\res\drawable目录中使用,完成启动屏设置。

动画文件制作

lottie动画文件下载完成后,点击"窗口">"扩展">"Bodymovin"菜单项,使用Bodymovin插件将其导入到AE中:

导入完成后,对其进行编辑和再加工,修改完成后我们再使用Bodymovin插件将其导出成(AVD) XML文件,点击最右边的三个点,选择导出的路径,再点击设置按钮,找到AVD选项,选择并保存,最后点击Render按钮,就可以导出(AVD) XML文件了:

android下的SplashScreen启动屏设置

我们将导出的(AVD) XML文件放入android\app\src\main\res\drawabledrawable-v21目录中:

接着修改android\app\src\main\res\values\styles.xml对闪屏样式进行设置:

xml 复制代码
<?xml version="1.0" encoding="utf-8"?>
<resources>
    <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
    <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             the Flutter engine draws its first frame -->
             <!--<item name="android:windowBackground">@drawable/launch_background</item>-->
             <!-- 启动画面中间显示的图标,默认使用应用图标 -->
             <item name="android:windowSplashScreenAnimatedIcon">@drawable/launch_background</item>
              <!-- 启动画面底部的图片。 -->
             <!--<item name="android:windowSplashScreenBrandingImage">@drawable/launch_background</item>-->
         <!-- 启动画面背景色。 -->
             <!--<item name="android:windowSplashScreenBackground">@android:color/black</item>-->
         <!-- 启动画面在关闭之前显示的时长。最长时间为 1000 毫秒。 -->
             <!--<item name="android:windowSplashScreenAnimationDuration">1000</item> -->
            </style>
    <!-- Theme applied to the Android Window as soon as the process has started.
         This theme determines the color of the Android Window while your
         Flutter UI initializes, as well as behind your Flutter UI while its
         running.
         This Theme is only used starting with V2 of Flutter's Android embedding. -->
    <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
        <item name="android:windowBackground">?android:colorBackground</item>
    </style>
</resources>

完成上述设置后,启动APP,就可以看到效果图了:

相关推荐
500了2 小时前
Kotlin基本知识
android·开发语言·kotlin
人工智能的苟富贵3 小时前
Android Debug Bridge(ADB)完全指南
android·adb
Мартин.3 小时前
[Meachines] [Easy] Sea WonderCMS-XSS-RCE+System Monitor 命令注入
前端·xss
昨天;明天。今天。4 小时前
案例-表白墙简单实现
前端·javascript·css
数云界4 小时前
如何在 DAX 中计算多个周期的移动平均线
java·服务器·前端
风清扬_jd4 小时前
Chromium 如何定义一个chrome.settingsPrivate接口给前端调用c++
前端·c++·chrome
安冬的码畜日常4 小时前
【玩转 JS 函数式编程_006】2.2 小试牛刀:用函数式编程(FP)实现事件只触发一次
开发语言·前端·javascript·函数式编程·tdd·fp·jasmine
ChinaDragonDreamer4 小时前
Vite:为什么选 Vite
前端
小御姐@stella4 小时前
Vue 之组件插槽Slot用法(组件间通信一种方式)
前端·javascript·vue.js
GISer_Jing4 小时前
【React】增量传输与渲染
前端·javascript·面试