The SnackBar demo is a cross-platform application that features a button that fires a FloatAnimation for opening a message notification that scrolls in from the bottom of the screen. It is built in Delphi using a single code base and single UI for Android, iOS, macOS, Windows, and Linux.
With the SnackBar demo, you’ll be able to quickly and easily create engaging, persuasive, and creative marketing materials that will grab attention and drive results. From simple one-off notifications to complex multi-step campaigns, SnackBar has you covered. And because it’s built on the cross-platform Delphi framework, you can be sure that your campaigns will look great and work flawlessly on any device.
Download the full cross-platform SnackBar Demo source code on Github.
This demo is part of over 100 cross-platform demos with everything from camera demos to emoji demos and painting demos.
Table of Contents
What is a snackbar in software development?
A snackbar is a small, temporary message that appears at the bottom of the screen. It’s used to give feedback about an operation or to display a simple message. Snackbars can contain an action. Snackbars provide brief messages about app processes, such as “saved” or “contact added.” They appear at the bottom of the screen and only stay visible for a short time before disappearing. If you need to provide more information than what a snackbar can hold, use a toast instead. Snackbars can be swiped away. Snackbars appear above the bottom navigation and take over the drawer’s space while they are visible. They’re light-weight and unobtrusive. Snackbars automatically disappear after a timeout unless they have an action associated with them. When using an action, make sure that it doesn’t require input from the user because snackbars are transient and users might not see the snackbar before it disappears. Consider using a persistent bottom sheet if you need more control over when and how your users interact with your content.
Screenshot
What does the SnackBar demo source code look like?
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
unit Unit1; interface uses System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants, FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls, FMX.Effects, FMX.Controls.Presentation, FMX.Ani, FMX.Objects, FMX.Layouts; type TForm1 = class(TForm) MaterialOxfordBlueSB: TStyleBook; ToolBar1: TToolBar; ShadowEffect4: TShadowEffect; Label1: TLabel; Layout1: TLayout; <strong> Rectangle1: TRectangle;</strong> Button1: TButton; Label2: TLabel; <strong> FloatAnimation1: TFloatAnimation; SnackButton: TButton; procedure SnackButtonClick(Sender: TObject); procedure FloatAnimation1Finish(Sender: TObject); procedure Button1Click(Sender: TObject);</strong> private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.fmx} <strong>procedure TForm1.Button1Click(Sender: TObject); begin Layout1.Visible := False; end; procedure TForm1.FloatAnimation1Finish(Sender: TObject); begin FloatAnimation1.Enabled := False; end; procedure TForm1.SnackButtonClick(Sender: TObject); begin Rectangle1.Height := 0; Layout1.Visible := True; FloatAnimation1.Enabled := True; end;</strong> end. |
Ready to learn how to program cross-platform apps like this?
Sign up for the Coding Boot Camp 2022 to learn to program. Topics include: Games, JavaScript, Web, Python, SQL, Databases, iOS, MacOS, Android, Mobile, Linux, Windows, Desktop, Server, and Arduino.
Design. Code. Compile. Deploy.
Start Free TrialUpgrade Today
Free Delphi Community EditionFree C++Builder Community Edition