繁体   English   中英

带有两个徽标的 Flutter(Android) 启动画面

[英]Flutter(Android) splash screen with two logos

我想为使用 flutter 创建的应用程序创建启动画面。 我已经尝试过flutter_native_splash package,但问题是我需要在splash中有两个徽标。

第一个应该居中,它将是应用程序的原始徽标,而第二个将是诸如Powered by someone之类的 Text 。

你可以在这里看到一个例子:

在此处输入图像描述

我知道我可以将整个图像创建为启动画面,但我不认为它是最合适的方法。

有什么想法吗?

您可以像这样轻松创建启动画面,无需任何软件包

    import 'package:flutter/material.dart';
    import 'package:hive_flutter/hive_flutter.dart';
    
    class WelcomePage extends StatefulWidget {
      const WelcomePage({Key? key}) : super(key: key);
    
      @override
      State<WelcomePage> createState() => _WelcomePageState();
    }
    
    class _WelcomePageState extends State<WelcomePage> {
      @override
      void initState() {

       //here the delayed time is 3 seconds you can edit it 
      
        Future.delayed(const Duration(seconds: 3), () {

       // after that the user will be automatically redirected to the Home S 
       //Screen
       
            runApp(const MaterialApp(home: Home()));
          
        });
        super.initState();
      }
    
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          body: Column(
            children: [

            // here put your widget as normal as possible 
            //  your logo and your text 
             
            ],
          ),
        );
      }
    }

尝试这个

 Stack( children: [ Container( height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, child: //background image, ), Align( alignment: Alignment.center, child: //first logo, ), Positioned( left: 0, right: 0, bottom: 50.0, child: //second logo, ) ], )

闪屏自然是在原生端实现的,所以也会在原生端进行修改。

iOS / 苹果

提交到 Apple App Store 的所有应用程序必须使用 Xcode storyboard 来提供应用程序的启动屏幕。

Android

默认的 Flutter 项目模板包括启动主题和启动背景的定义。 您可以通过编辑 xml 来自定义它。

有关详细信息,请参阅 向您的移动应用程序添加启动画面

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM