easy_context 1.0.1 copy "easy_context: ^1.0.1" to clipboard
easy_context: ^1.0.1 copied to clipboard

This package provides extenstion over BuildContext class and provide easy access for the most used properties and functions to keep your code clean and simple

EasyContext #


A package that simplifies the access most of used properties/fuctions right in the BuildContext. It utilizes the dart extension feature and reduce the boilerplate for commonly used statements.

To learn more, check out this medium article on dart extenstions.

Extensions #


  • currently availabe extensions in the latest version
MediaQuery.of(context) :
  • context.size
  • context.width
  • context.height
  • context.statusBarHeight
  • context.push
  • context.pop
  • context.canPop
  • context.pushAndRemoveUntil
  • context.pushNamedAndRemoveUntil
  • context.popUntil
  • context.pushNamed

Install #


Add the dependency in your pubspec.yaml:

dependencies:
  easy_context: ^1.0.0

Import it in the file you want to use it e.g, in widgets.dart file

import "package:easy_context/easy_context.dart"

Usage #


Here is a usage example:

import 'package:flutter/material.dart';
import "package:build_context/build_context.dart";

class MyHomePage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: Center(
        child: GestureDetector(
          onTap: () => context.pushNamed('/detailsPage'), 
          child: Text(
            'Press Me',
          ),
        ),
      ),
    );
  }
}

Support #


You liked this package? then hit a like. I don't want to buy you a coffee. Just use this package if you feel the need. And if you need a feel... contribute and let's make something better together.

  • Start this repository
  • Create a Pull Request with new features
  • Share this package
  • Create issues if you find a Bug or want to suggest something
1
likes
140
pub points
0%
popularity

Publisher

unverified uploader

This package provides extenstion over BuildContext class and provide easy access for the most used properties and functions to keep your code clean and simple

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on easy_context