build method
- BuildContext context
override
Builds the Landing widget.
The method returns a Stack widget with two children:
The Stack widget is used to position the text at the center of the screen, both horizontally and vertically.
Implementation
@override
/// Builds the [Landing] widget.
///
/// The method returns a [Stack] widget with two children:
/// 1. An [Image] widget that displays the GIF background.
/// 2. A [Text] widget that displays the welcome message.
///
/// The [Stack] widget is used to position the text at the center of the
/// screen, both horizontally and vertically.
Widget build(BuildContext context) {
final tr = AppLocalizations.of(context)!;
return Stack(
// Set the alignment of the stack to center.
alignment: Alignment.center,
// The stack has two children: an image and a text.
children: [
// The image is the GIF background.
Image.asset(
// The path to the GIF asset.
AppConstants.landHomeGif,
// Fit the image to cover the entire screen.
fit: BoxFit.cover,
// Set the width of the image to infinity to ensure it takes up
// the entire width of the screen.
width: double.infinity,
),
// The text is a welcome message.
Text(
// The text to display.
tr.creativeSaudiHands,
// The style of the text: bold, white, and font size 16.
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
color: CupertinoColors.white,
),
),
],
);
}