Skip to content

ali2236/context_extentions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

context_extentions

Getting inherited widget's state

 var themeData = context.theme;

 var scaffold = context.scaffold;
 
 var navigator = context.navigator;
 
 var overlay = context.overlay;
 
 var mediaQuery = context.mediaQuery;

Theme properties

var textTheme = context.textTheme;

var colorPrimary = context.primaryColor;

var colorAccent = context.accentColor;

var colorCanvas = context.canvasColor;

var colorBackground = context.BackgroundColor;

Navigator helpers

context.push((c) => NaxtPage());

context.pop();

MediaQuery properties

var screenSize = context.screenSize;

var screenPadding = context.screenPadding;

Scaffold helpers

context.showSnackBar(SnackBar(content: Tex('text')));

Overlay helpers

var overlayEntry = context.addOverlay((context){
  return Align(
    alignment: AlignmentDirectional.bottomStart,
    child: Padding(
      padding: const EdgeInsets.all(8.0),
      child: Text('overlay'),
    ),
  );
});

Action helper

context.invokeAction(intent);

Form helper

if(context.form.validate()){
  /* ... */
} else {
  /* ... */
}

Localization helper

var locale = context.locale

About

Various extensions on BuildContext to access inherited widget's state

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages