Skip to content

Conversation

@SiyrisSoul
Copy link
Contributor

@SiyrisSoul SiyrisSoul commented Aug 6, 2020

Added RefinedLayoutBuilder which supports small, normal, large and extraLarge layouts for each device type. Also added getValueForRefinedSize. Haven't updated example, readme or changelog.

You can use RefinedLayoutBuilder like this:

ScreenTypeLayout.builder(
  mobile: (context) => RefinedLayoutBuilder(
     small:  (context) => HomeMobileSmall(),
     normal: (context) => HomeMobileNormal(),
     large: (context) => HomeMobileLarge(),
     extraLarge: (context) => HomeMobileExtraLarge()
  ),
);

You can use getValueForRefinedSize like this:

getValueForScreenType<double>(
  context: context,  
  mobile: getValueForRefinedSize<double>( 
     context: context, 
     small: 10,
     normal: 15,
     large: 30,
  ),
);

You can set refinedBreakpoints globally like this:
If any breakpoints aren't set then defaults will be used. This makes it easy to just edit one platform without worrying about 12 different breakpoints.

void main() {
  ResponsiveSizingConfig.instance.setCustomBreakpoints(
    ScreenBreakpoints(desktop: 800, tablet: 550, watch: 200),
    customRefinedBreakpoints: RefinedBreakpoints(desktopSmall: 950, desktopNormal: 1920, desktopLarge: 3840, desktopExtraLarge: 4096),
  );
  runApp(MyApp());
}

Adam Bahr added 2 commits August 6, 2020 08:00
Added an optional parameter to setCustomBreakpoints to set refinedBreakpoints. It's optional to avoid any breaking changes.
@FilledStacks FilledStacks merged commit 2778652 into FilledStacks:master Aug 7, 2020
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

Successfully merging this pull request may close these issues.

2 participants