Various extensions on BuildContext to access inherited widget's state

Overview

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
You might also like...

Awesome Flutter extensions to remove boilerplate

Awesome Flutter Extensions Awesome flutter extensions to remove boilerplate Installation Install using the Terminal: flutter pub add awesome_flutter_e

Aug 20, 2022

The Reactive Extensions for Dart

RxDart About RxDart extends the capabilities of Dart Streams and StreamControllers. Dart comes with a very decent Streams API out-of-the-box; rather t

Dec 20, 2022

Functional extensions to Dart collections.

collection_ext A set of extension methods for Dart collections, designed for the purpose of making it easier to write concise, functional-programming-

Nov 21, 2022

Enum extendable - Dart code generator. Generates enum extensions code.

Generates code for the extension on an enum. Overview Being able to add fields and methods to an enum. Let's say we have the following enum: enum Math

Jan 10, 2022

Extensions and principles for modern Dart development.

neodart Neo-Dart, or "new" Dart, is a series of recommended packages and principles that break out of classic conventions ("we've always done it that

Dec 6, 2022

Fluter-json - App Demonstrating JSON Data Parsing with various flutter widgets

Fluter-json - App Demonstrating JSON Data Parsing with various flutter widgets

users_list Flutter App to Demonstrate JSON Parsing Getting Started This project is a starting point for a Flutter application. A few resources to get

Jul 10, 2021

An extension to the bloc state management library which lets you create State Machine using a declarative API

An extension to the bloc state management library which lets you create State Machine using a declarative API

Nov 28, 2022

A powerful state machine for MobX management, that can be used in almost any application state.

A powerful state machine for MobX management, which can be used in almost any application state. It has 3 states - loading, success, error - and is pe

Oct 31, 2022
Owner
Ali Ghanbari
Software engineering student at Persian Gulf University
Ali Ghanbari
Behruz Hurramov 0 Dec 29, 2021
A simple state management solution that combine the power of inherited widget and rxdart

Inherited RxDart is a state management library that combine the power of InheritedWidget and RxDart, a simple and elegant state management solution for apps of any scale

Nguyễn Ngọc Phước 14 Oct 26, 2022
Flutter code extension that provides MediaQuery sizing info directly on the BuildContext instance

Flutter code extension that provides MediaQuery sizing info directly on the BuildContext instance. Also adds some helper methods for sizing and layout.

gskinner team 87 Dec 6, 2022
Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Flutter plugin that leverages Storage Access Framework (SAF) API to get access and perform the operations on files and folders.

Vehement 8 Nov 26, 2022
Material io ext - A collection of extensions for creating widgets following material.io guidelines

material_io_ext It is a collection of extensions for creating widgets following

BetterX.io 3 Jan 28, 2022
Package provides light widgets [for Linkify, Clean] and extensions for strings that contain bad words/URLs/links/emails/phone numbers

Package provides light widgets [for Linkify, Clean] and extensions for strings that contain bad words/URLs/links/emails/phone numbers

BetterX.io 4 Oct 2, 2022
ABC of Flutter widgets. Intended for super beginners at Flutter. Play with 35+ examples in DartPad directly and get familiar with various basic widgets in Flutter

Basic Widgets Examples This is aimed for complete beginners in Flutter, to get them acquainted with the various basic widgets in Flutter. Run this pro

Pooja Bhaumik 815 Jan 3, 2023
State Persistence - Persist state across app launches. By default this library store state as a local JSON file called `data.json` in the applications data directory. Maintainer: @slightfoot

State Persistence Persist state across app launches. By default this library store state as a local JSON file called data.json in the applications dat

Flutter Community 70 Sep 28, 2022
Access app version and git informations from auto-generated and configurable widgets

This is a proof of concept and WIP Feedback and ideas welcome !! Access your pubspec and git commit informations like versions and commit status from

Robert Felker 15 Jul 7, 2021
Arisprovider - A mixture between dependency injection (DI) and state management, built with widgets for widgets

A mixture between dependency injection (DI) and state management, built with wid

Behruz Hurramov 1 Jan 9, 2022