Skip to content

Instantly share code, notes, and snippets.

@Oshinowo
Created October 23, 2021 01:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Oshinowo/244b8fd9311b5305c4fc746ee9f5c612 to your computer and use it in GitHub Desktop.
Save Oshinowo/244b8fd9311b5305c4fc746ee9f5c612 to your computer and use it in GitHub Desktop.
Custom page model for Onboarding screens
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_banking_app/constants/app_constants.dart';
class CustomOnboardingPageViewModel extends StatelessWidget {
const CustomOnboardingPageViewModel({
Key? key,
required this.imageUrl,
required this.modelTitle,
required this.modelDescription,
}) : super(key: key);
final String imageUrl, modelTitle, modelDescription;
@override
Widget build(BuildContext context) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: kDefaultPadding * 2),
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(imageUrl),
fit: BoxFit.cover,
colorFilter:
const ColorFilter.mode(Color(0xff7A7A7A), BlendMode.modulate),
),
),
child: Container(
margin: EdgeInsets.only(bottom: kDefaultPadding.h * 5),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
modelTitle,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 25.0.sp,
fontWeight: FontWeight.w600,
),
),
SizedBox(
height: kDefaultPadding.h / 2,
),
Text(
modelDescription,
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 18.0.sp,
),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment