Splash Screen

Splash Screen is the first screen or page shown to users during the launch of a mobile application. When I started working on Flutter, the first thing that came to my mind while examining sample applications or thinking about the mobile applications I use myself was the splash screen. That’s why I care about it and that’s why I wanted to write about it.

I think it is very important in terms of creating a first impression for users. Because this screen is the first thing the user sees when they launch the application. The brand logo can be used here, a picture can be shown, an inspirational phrase can be placed, music can start while this screen is displayed, etc. Also, showing users this screen when launching the app provides feedback that the app is loading or preparing. This can help users see that the app is working and responding, improving the user experience. Now let’s move on to creating this.


Creating a basic Splash Screen in Flutter is quite simple. We design a simple splash screen using basic widgets like Scaffold and Center.

class SplashScreen extends StatelessWidget {
const SplashScreen({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.cyan[200], // Splash Screen background color
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/english.png', // Splash Screen image
width: 400,
height: 600,
),
const SizedBox(height: 20),
Text(
'My Splash Screen App', // Title text
style: TextStyle(
fontSize: 24,
color: Colors.blueGrey[700],
),
),
],
),
),
);
}
}

The code above uses the Scaffold widget to create a Splash Screen with a background color and images and text in a column in the center.


In my self-developed application linked below, there is a simple Splash Screen example:

class SplashScreen extends StatelessWidget {
const SplashScreen({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0XFFFFD72D),
body: Center(
child: Image.asset('assets/icons/animated_logo.gif')
),
);
}
}


The result is as follows:


FlashCards Application link:

https://play.google.com/store/apps/details?id=com.cemnamak.flash_cards

The examples I’ve given so far are about creating simple Splash Screen with Flutter’s own widgets. When I want to use a package from pub.dev, the things I usually look for are its popularity, who developed it (the ones developed by Flutter’s own team are more reliable when it comes to updates etc.) and whether it is compatible with the latest Dart version.
At this point, we can easily create splash screens with the splash_view package, which has 90% popularity. Let’s see how we can do it.

First we install the package in our project by typing the following command in the terminal.

flutter pub add splash_view

At the beginning of the project, we introduce the package to our project file by importing it as follows.

import 'package:splash_view/splash_view.dart';

Then we write our codes according to the package content.

class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: SplashView(
backgroundColor: Colors.blue[100],
loadingIndicator: const RefreshProgressIndicator(),
logo: const FlutterLogo(
size: 102.0,
),
),
);
}
}

The result is as follows:


Finally, I end my article by talking about the points we should pay attention to when creating Splash Screen.

The first thing we need to pay attention to is visual design and brand harmony. Since this screen creates the first impression of our application, it is very important to choose colors, fonts and images that are compatible with the theme of our application and reflect the brand identity.

The duration of the Splash Screen should not be too long to bore the user or too short to see the item on the screen. It directly affects the user experience. Unnecessary loads should also not be included.

By adding transition effects and animations, we can provide a more immersive experience. Especially while the application is loading or preparing, such effects can provide feedback to the user and make the wait more pleasant.

To ensure that the Splash Screen displays properly on different screen sizes and resolutions, we need to create it in accordance with responsive design principles. This can result in unpleasant, unexpected images on different devices and screen ratios. Therefore, we should not forget to test it on different devices.

In conclusion, Splash Screen is an important element that improves the user experience of our app and promotes our brand identity. This screen, which is the first thing users see when they open our app, is often the first impression of the rest of the app’s experience, so we need to design it carefully. I hope I have been useful.

Have a good work.

Selin.


Splash Screen

Splash Screen, bir mobil uygulamanın başlatılması sırasında kullanıcılara gösterilen ilk ekran veya sayfa. Flutter çalışmaya başladığımda örnek uygulama incelerken ya da kendi kullandığım mobil uygulamaları düşündüğümde ilk aklıma gelen baştaki açılış sayfası olmuştu. O yüzden bunu önemsiyorum. Bu yüzden bunun üzerine yazmak istedim.

Kullanıcılara ilk izlenim oluşturması açısından çok önemli bence. Çünkü kullanıcının uygulamayı başlattığında ilk gördüğü şey bu ekran. Burada marka logosu kullanılabilir, bir resim gösterilebilir, ilham verici bir cümle konabilir, bu ekran görüntülenirken müzik başlayabilir vb. Ayrıca uygulama başlatılırken kullanıcılara bu ekranın gösterilmesi, uygulamanın yüklendiği veya hazırlandığına dair bir geri bildirim sağlar. Bu, kullanıcıların uygulamanın çalıştığını ve yanıt verdiğini görmelerine yardımcı olarak, kullanıcı deneyimini iyileştirebilir. Artık bunu oluşturmaya geçelim.

Flutter’da temel bir Splash Screen oluşturmak oldukça basit. Scaffold ve Center gibi temel widget’ları kullanarak basit bir başlangıç ekranı tasarlıyoruz.

class SplashScreen extends StatelessWidget {
const SplashScreen({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.cyan[200], // Splash Screen background color
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Image.asset(
'assets/english.png', // Splash Screen image
width: 400,
height: 600,
),
const SizedBox(height: 20),
Text(
'My Splash Screen App', // Title text
style: TextStyle(
fontSize: 24,
color: Colors.blueGrey[700],
),
),
],
),
),
);
}
}

Yukarıdaki kod, Scaffold widget’ını kullanarak bir arkaplan rengi ve merkezde bir sütun içinde görsel ve metin içeren bir Splash Screen oluşturuyor.


Aşağıda linki bulunan kendi geliştirdiğim uygulamamda ise şöyle bir basit Splash Screen örneği mevcut:

class SplashScreen extends StatelessWidget {
const SplashScreen({super.key});

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: const Color(0XFFFFD72D),
body: Center(
child: Image.asset('assets/icons/animated_logo.gif')
),
);
}
}

Sonuç ise şu şekilde:


FlashCards Uygulama linki:

https://play.google.com/store/apps/details?id=com.cemnamak.flash_cards

Buraya kadar verdiğim örnekler Flutter’ın kendi widgetları ile basit Splash Screen oluşturmak üzerineydi. Bir de bunun package ile yapılan versiyonu var. pub.dev adresinden package kullanmak istediğimde baktığım şeyler genellikle popülaritesi, kimin tarafından geliştirildiği (flutter’ın kendi ekibi tarafından geliştirilenler güncellemeler vs söz konusu olduğunda daha güvenilir oluyor) ve son Dart versiyonu ile uyumlu olup olmadığı oluyor.

Bu noktada %90 popülariteye sahip splash_view paketi ile de kolayca splash screen oluşturabiliyoruz. Gelelim nasıl yapabileceğimize.

Terminale aşağıdaki komutu yazarak package’ı projemize yüklüyoruz.

flutter pub add splash_view

Projenin başında aşağıdaki gibi import ederek package’ı proje dosyamıza tanıtıyoruz.

import 'package:splash_view/splash_view.dart';

Sonrasında ise package içeriğine uygun olarak kodlarımızı yazıyoruz. Örneğin;

class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: SplashView(
backgroundColor: Colors.blue[100],
loadingIndicator: const RefreshProgressIndicator(),
logo: const FlutterLogo(
size: 102.0,
),
),
);
}
}

Sonuç şu şekilde:


Son olarak Splash Screen oluştururken dikkat etmemiz gereken noktalardan da bahsederek makalemi noktalıyorum.

İlk dikkat etmemiz gereken şey görsel tasarım ve marka uyumu. Bu ekran uygulamamızın ilk izlenimini oluşturduğundan uygulamamızın temasıyla uyumlu renkler, fontlar ve görseller seçmek ve marka kimliğini yansıtmak çok önemli.

Splash Screen’in gösterilme süresi kullanıcıyı sıkacak kadar uzun ya da ekranda yer alan ögeyi göremeyecek kadar kısa olmamalı. Direkt kullanıcı deneyimini etkiler. Gereksiz yüklenmelere de yer verilmemeli.

Geçiş efektleri ve animasyonlar ekleyerek daha etkileyici bir deneyim sunabiliriz. Özellikle uygulama yüklenirken veya hazırlanırken bu tür efektler kullanıcıya geri bildirim sağlayarak beklemeyi daha hoş hale getirebilir.

Splash Screen’in farklı ekran boyutlarında ve çözünürlüklerinde düzgün görüntülenmesini sağlamak için responsive tasarım prensiplerine uygun olarak oluşturmamız gerekiyor. Bu, farklı cihazlarda ve ekran oranlarında hoş olmayan, beklenmedik görüntüler ortaya çıkabilir. Bu yüzden farklı cihazlarda da test etmeyi unutmamak gerek.

Sonuç olarak, Splash Screen uygulamamızın kullanıcı deneyimini iyileştiren ve marka kimliğimizi tanıtan önemli bir unsur. Kullanıcıların uygulamamızı ilk açtıklarında karşılaştıkları bu ekran, genellikle uygulamanın geri kalan deneyimi için bir ön izlenim oluşturuyor ve bu nedenle dikkatli bir şekilde tasarlamamız gerekiyor. Umarım faydalı olmuşumdur.

İyi çalışmalar.

Selin.

Stack Widget in Flutter


 

Hello everyone. I wanted to write about a widget that I found complicated during my Flutter learning process but is almost essential for creating remarkable interfaces: Stack.

When creating complex user interfaces, it’s really important to combine different widgets together to create flexible and beautiful designs. In this context, the Stack widget is an important tool. The Stack widget is used to place widgets on top of one another, making it ideal for creating rich and layered UIs.

What is a Stack Widget?

Stack is a collection of widgets that contains different widgets stacked on top of each other. These widgets appear at the top of the screen and can be related to each other. For example, a Stack widget can contain an image, text and a button; these widgets can be arranged on top of each other on the screen.

Basic Use of the Stack Widget

The Stack widget is used to place different widgets on top of one another. The basic usage is that the widgets added in a Stack widget overlap in the order they were added.

For example, we can add an image and a text widget to a Stack and place them on top of each other on the screen. The widget added first will appear at the bottom and the widget added last will appear at the top.

Stack(
children: <Widget>[
// Widget to appear at bottom
Container(
color: Colors.blue,
width: 200,
height: 200,
),
// Widget to appear on top
Positioned(
top: 50,
left: 50,
child: Text(
'Hello, Flutter',
style: TextStyle(fontSize: 20),
),
),
],
)

Working with Positioned Widget

In Flutter, the Positioned widget is used to determine the position of widgets in the Stack. This widget is used to place other widgets in the Stack in a specific position. The Positioned widget gives you the flexibility to specify a particular position and size when placing widgets in the Stack.
For example, we can use the Positioned widget to place a Container widget in the top right corner of the Stack:

Stack(
children: <Widget>[
Positioned(
top: 0,
right: 0,
child: Container(
width: 100,
height: 100,
color: Colors.red,
),
),
// Other widgets can be added here
],
)

Another important point to be aware of when using the Positioned widget is that the position and size values must remain within the boundaries of the Stack widget. Otherwise, widgets may overflow from the screen or undesired results may occur.

Stack and Z-Index Management

Z-Index allows a widget to rise above other widgets. The larger the Z-Index value, the higher the widget will appear. We can specify Z-Index values using the Positioned widgets inside the Stack widget.

For example, in the code snippet below, there is an image and some text inside a Stack. However, we want the text to appear above the image. To achieve this, we can use the z-index property of the Positioned widget:

Stack(
children: <Widget>[
// Background image
Image.network(
'https://example.com/background-image.jpg',
width: 300,
height: 300,
fit: BoxFit.cover,
),
// Text Above
Positioned(
top: 50,
left: 50,
child: Text(
'Text Above',
style: TextStyle(fontSize: 20),
),
// Z-Index determination
zIndex: 1,
),
],
)

Considerations and Common Mistakes When Using the Stack Widget

  1. Position Calculation Errors: We need to be careful when determining the position of widgets in the stack. If we set the wrong position values, widgets can appear in unwanted places or overlap each other.
  2. Z-Index Conflict: Since the Z-Index values of the widgets in the stack determine which widget will be on top of the other, we must carefully determine the Z-Index values; otherwise, widgets may overlap in unwanted ways.
  3. Stack Overflow Issues: This topic is not related to the site that we all help :) It makes no sense to use Stack within Stack. Also, adding too many widgets into it can cause widgets to overflow beyond the screen limits or cause errors.
  4. Performance Issues: Using too many widgets inside a Stack widget can cause performance issues. Especially when used with animations and complex widgets, performance losses can occur.
  5. Missing or Over Positioned Widgets: We use the Positioned widget to determine the position of widgets in the Stack, but adding missing or excessive Positioned widgets can lead to undesirable results. We need to make sure that we have the right number and positioned Positioned widgets for each widget in the stack.
  6. Sizing Issues: We need to pay close attention to the size of the widgets in the Stack. Especially, if the sizes of the widgets in the Stack are different from each other, widgets can overflow from the screen or unexpected errors can be received.
  7. Hierarchy of Widgets: The hierarchy of widgets in the Stack is also very important. In some cases, if the relationship between multiple widgets in the Stack is unclear, it can lead to unexpected results. Therefore, we should carefully plan the hierarchical relationship of widgets.

The Stack widget that we will create by paying attention to these points is a very important tool for us to create more robust and stable user interfaces.

I hope my article was useful for everyone.

Have a good work.

Selin.

Flutter’da Stack Widget’ı

 


Herkese merhaba. Flutter öğrenme sürecimde karmaşık bulduğum ancak dikkat çekici arayüzler oluşturabilmek için neredeyse şart olan bir widget hakkında yazmak istedim: Stack.

Karmaşık kullanıcı arayüzleri oluştururken farklı widget’ları bir araya getirerek esnek ve güzel tasarımlar elde etmek gerçekten önemli. Bu bağlamda, Stack widget’ı önemli bir araç. Stack widget’ı, widget’ları diğerlerinin üzerine yerleştirmek için kullanılıyor ve böylece zengin ve katmanlı kullanıcı arayüzleri oluşturmak için çok ideal.

Stack Widget’ı nedir?

Stack birbirinin üzerine istiflenmiş farklı widget’ları içeren bir widget’lar koleksiyonu. Bu widget’lar, ekranın üst kısmında gözükürler ve birbirleriyle ilişkili olabilirler. Örneğin, bir Stack widget’ı içinde bir resim, bir metin ve bir düğme olabilir; bu widget’lar ekranda üst üste gelecek şekilde düzenlenebilirler.

Stack Widget’ının Temel Kullanımı

Stack widget’ı, farklı widget’ları diğerlerinin üzerine yerleştirmek için kullanılır. Temel kullanımı, Stack widget’ı içine eklenen widget’ların eklenme sırasına göre üst üste gelmesidir.

Örneğin, bir Stack içerisine bir resim ve bir metin widget’ı ekleyerek bunları ekran üzerinde üst üste yerleştirebiliriz. İlk olarak eklenen widget en altta, en son eklenen widget ise en üstte görünecektir.

Stack(
children: <Widget>[
// Altta gözükecek widget
Container(
color: Colors.blue,
width: 200,
height: 200,
),
// Üstte gözükecek widget
Positioned(
top: 50,
left: 50,
child: Text(
'Merhaba, Flutter',
style: TextStyle(fontSize: 20),
),
),
],
)

Positioned Widget’ı ile Çalışma

Flutter’da, Stack içindeki widget’ların pozisyonlarını belirlemek için Positioned widget’ı kullanılır. Bu widget, Stack içindeki diğer widget’ları belirli bir pozisyona yerleştirmek için kullanılır. Positioned widget’ı, Stack içinde yer alırken belirli bir pozisyon ve boyut belirleme esnekliği sağlar.

Örneğin, Stack içinde yer alan bir Container widget’ını sağ üst köşeye yerleştirmek için Positioned widget’ı kullanabiliriz:

Stack(
children: <Widget>[
Positioned(
top: 0,
right: 0,
child: Container(
width: 100,
height: 100,
color: Colors.red,
),
),
// Diğer widget'lar buraya eklenebilir
],
)

Positioned widget’ı kullanırken dikkat edilmesi gereken bir diğer önemli nokta, belirlenen pozisyon ve boyut değerlerinin Stack widget’ının sınırları içinde kalmasıdır. Aksi takdirde, widget’lar ekrandan taşabilir veya istenmeyen sonuçlar ortaya çıkabilir.

Stack ve Z-Index Yönetimi

Z-Index, bir widget’ın diğer widget’ların üzerine çıkmasını sağlar. Z-Index değeri ne kadar büyükse, widget o kadar üstte görünecektir. Stack widget’ı içindeki Positioned widget’ları kullanarak Z-Index değerlerini belirleyebiliriz.

Örneğin, aşağıdaki kod parçasında bir Stack içinde bir resim ve bir metin yer alıyor. Ancak, metnin resmin üzerinde görünmesini istiyoruz. Bu durumu sağlamak için Positioned widget’ının z-index özelliğini kullanabiliriz:

Stack(
children: <Widget>[
// Arka plan resmi
Image.network(
'https://example.com/background-image.jpg',
width: 300,
height: 300,
fit: BoxFit.cover,
),
// Üstteki metin
Positioned(
top: 50,
left: 50,
child: Text(
'Üstteki Metin',
style: TextStyle(fontSize: 20),
),
// Z-Index belirleme
zIndex: 1,
),
],
)

Stack Widget’ını Kullanırken Dikkat Edilmesi Gerekenler ve Sık Yapılan Hatalar

  1. Pozisyon Hesaplama Hataları: Stack içindeki widget’ların pozisyonlarını belirlerken dikkatli olmamız gerekiyor. Yanlış pozisyon değerleri belirlersek, widget’lar istenmeyen yerlerde görünebiliyor veya birbirlerini örtük hale getirebiliyor.
  2. Z-Index Çakışması: Stack içindeki widget’ların Z-Index değerleri, hangi widget’ın diğerinin üzerinde olacağını belirlediğinden Z-Index değerlerini dikkatlice belirlemeliyiz; aksi halde widget’lar istenmeyen şekillerde örtüşebilir.
  3. Stack Overflow Sorunları: Bu başlık hepimizin yardımcısı malum site ile ilgili değil :) Stack içinde Stack kullanmak hiç mantıklı değil. Ayrıca içine çok fazla widget eklemek de, widget’ların ekran sınırlarını aşarak taşmasına veya hata vermesine neden olabiliyor.
  4. Performans Sorunları: Stack widget’ı içinde çok sayıda widget kullanmak, performans sorunlarına neden olabilir. Özellikle, animasyonlar ve karmaşık widget’larla birlikte kullanıldığında, performans kayıpları yaşanabilir.
  5. Eksik veya Fazla Positioned Widget’ları: Stack içindeki widget’ların pozisyonlarını belirlemek için Positioned widget’ını kullanıyoruz ancak, eksik veya fazla Positioned widget’ları eklemek, istenmeyen sonuçlara yol açabilir. Stack içindeki her widget için doğru sayıda ve konumlandırılmış Positioned widget’larına dikkat etmemiz gerekiyor.
  6. Boyut Belirleme Sorunları: Stack içindeki widget’ların boyutlarına çok dikkat etmemiz gerekiyor. Özellikle, Stack içindeki widget’ların boyutları birbirinden farklı ise widget’lar ekrandan taşabiliyor ya da beklenmedik hatalar alınabiliyor.
  7. Widget’ların Hiyerarşisi: Stack içindeki widget’ların hiyerarşisi de çok önemli. Bazı durumlarda, Stack içinde birden fazla widget arasındaki ilişki belirsiz ise beklenmeyen sonuçlara yol açabilir. Bu yüzden widget’ların hiyerarşik ilişkisini dikkatlice planlamalıyız.

Bu noktalara dikkat ederek oluşturacağımız Stack widget’ı daha sağlam ve istikrarlı kullanıcı arayüzleri oluşturmamız için çok önemli bir araç.

Umarım makalem herkes için faydalı olmuştur.

İyi çalışmalar.

Selin.