📱1. Lesson

screens


import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:travel_aspen/core/app_assets.dart';
import 'package:travel_aspen/core/app_color.dart';

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

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(
        height: double.infinity,
        width: double.infinity,
        padding: EdgeInsets.only(left: 24, right: 24, top: 93, bottom: 48),
        decoration: BoxDecoration(
          image: DecorationImage(
              image: AssetImage(AppAssets.splash), fit: BoxFit.cover),
        ),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            _title(),
            Spacer(),
            _subtitle(),
            SizedBox(
              height: 24,
            ),
            _button(),
          ],
        ),
      ),
    );
  }

  Widget _title() {
    return Center(
      child: Text(
        'Aspen',
        style: TextStyle(
            fontSize: 116,
            color: AppColors.white,
            fontFamily: GoogleFonts.roboto().fontFamily),
      ),
    );
  }

  Widget _subtitle() {
    return RichText(
      text: TextSpan(
        text: 'Plan your\n',
        style: _style(fontSize: 24, fontWeight: FontWeight.normal),
        children: [
          TextSpan(
              text: 'Luxurious\nVacations',
              style: _style(fontSize: 40, fontWeight: FontWeight.bold)),
        ],
      ),
    );
  }

  Widget _button() {
    return InkWell(
      onTap: () {},
      child: Container(
        height: 52,
        width: double.infinity,
        alignment: Alignment.center,
        decoration: BoxDecoration(
          borderRadius: BorderRadius.circular(16),
          gradient: LinearGradient(
            colors: [
              AppColors.begin,
              AppColors.end,
            ],
          ),
        ),
        child: Text(
          'Explore',
          style: _style(fontSize: 16, fontWeight: FontWeight.bold),
        ),
      ),
    );
  }

  TextStyle _style({required double fontSize, required FontWeight fontWeight}) {
    return TextStyle(
        fontSize: fontSize,
        fontWeight: fontWeight,
        color: AppColors.white,
        fontFamily: GoogleFonts.montserrat().fontFamily);
  }
}

core

// Some code

import 'package:flutter/material.dart';

class AppColors{
  static const Color white = Colors.white;
  static const Color begin = Color(0xFF176FF2);
  static const Color end = Color(0xFF196EEE);
  static const Color selectColor = Color(0xFF007AFF);
  static const Color unselectedColor = Color(0xFFB8B8B8);
}

Last updated