Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to build a widget instead of the final pageList? #31

Closed
NestorDevs opened this issue Apr 29, 2020 · 1 comment
Closed

How to build a widget instead of the final pageList? #31

NestorDevs opened this issue Apr 29, 2020 · 1 comment

Comments

@NestorDevs
Copy link

I am using the plugins for an app but it has two languages ​​and I use the context property to be able to translate the string of the title and the body of the pageModel however I have an error because I don't have a context for that ... how could I create a widget that allow to use buildcontext and in this way use languages?

my code:
final pageList = [
PageModel(
color: dBlueSkyColor,
heroAssetPath: 'assets/images/delivery1.png',
title: Text('SAVE MONEY',
style: GoogleFonts.montserrat(
fontWeight: FontWeight.w800,
color: dOrangeColor,
fontSize: 30.0,
)),
body: Text(
'Weekly best deals picked by our price comparison team',
textAlign: TextAlign.center,
style: GoogleFonts.montserrat(
color: dOrangeColor,
fontSize: 15.0,
),
),
iconAssetPath: 'assets/icons/postal.png',
),
PageModel(
color: const Color(0xFF65B0B4),
heroAssetPath: 'assets/images/delivery2.png',
title: Text('SAVE TIME',
style: GoogleFonts.montserrat(
fontWeight: FontWeight.w800,
color: Colors.white,
fontSize: 30.0,
)),
body: Text(
'Shop from over 1200 local stores at your fingertips',
textAlign: TextAlign.center,
style: GoogleFonts.montserrat(
color: Colors.white,
fontSize: 15.0,
),
),
iconAssetPath: 'assets/icons/business.png',
),
PageModel(
color: const Color(0xFF9B90BC),
heroAssetPath: 'assets/images/delivery3.png',
title: Text('HOME DELIVERY',
style: GoogleFonts.montserrat(
fontWeight: FontWeight.w800,
color: Colors.white,
fontSize: 30.0,
)),
body:
Text("You get everything you'd want from your local store to your door",
textAlign: TextAlign.center,
style: GoogleFonts.montserrat(
color: Colors.white,
fontSize: 15.0,
)),
iconAssetPath: 'assets/icons/over.png',
),
];

instead of using plain text use
S.of(context).simpleText
with error in context

@xsahil03x
Copy link
Owner

You can create a function that takes the context as the parameter and return you a list of pages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants