context_extensions_codespark 0.0.1 copy "context_extensions_codespark: ^0.0.1" to clipboard
context_extensions_codespark: ^0.0.1 copied to clipboard

Powerful and lightweight BuildContext extensions for Flutter. Simplify navigation, responsive layouts, theme access, dialogs, snackbars, and more.

context_extensions_codespark #

A lightweight Flutter package that provides powerful and convenient BuildContext extensions to reduce boilerplate and improve developer productivity.

Built for Flutter developers who want cleaner, more readable code.


Features #

  • Screen & MediaQuery utilities
  • Theme & Color shortcuts
  • Typography helpers
  • Responsive sizing utilities
  • Navigation extensions
  • Snackbar helpers
  • Dialog utilities
  • Focus management
  • Orientation helpers
  • Post-frame callbacks

Installation #

Add the dependency:

dependencies:
  context_extensions_codespark: latest

Install packages:

flutter pub get

Import:

import 'package:context_extensions_codespark/context_extensions_codespark.dart';

Screen Utilities #

context.screenWidth;
context.screenHeight;

context.isPortrait;
context.isLandscape;

context.isMobile;
context.isTablet;
context.isDesktop;

Responsive Helpers #

context.wp(0.8); // 80% width
context.hp(0.5); // 50% height

Theme Helpers #

context.theme;
context.colorScheme;
context.textTheme;

context.isDarkMode;
context.isLightMode;

context.primaryColor;
context.surfaceColor;
context.backgroundColor;

Typography Helpers #

context.titleLarge;
context.bodyMedium;
context.labelSmall;

context.push(HomePage());

context.pushNamed('/home');

context.pushReplacement(HomePage());

context.pushAndRemoveUntil(HomePage());

context.pop();

context.maybePop();

final result = await context.pushForResult<String>(
  DetailsPage(),
);

Snackbars #

context.showSnackBar('Hello');

context.showSuccess('Saved successfully');

context.showError('Something went wrong');

context.showInfo('Profile updated');

Dialogs #

await context.showAlertDialog(
  title: 'Notice',
  message: 'Changes saved successfully',
);

Confirmation dialog:

final confirmed = await context.showConfirmDialog(
  title: 'Delete',
  message: 'Are you sure?',
);

Focus Utilities #

context.unfocus();

Post Frame Callback #

context.onPostFrame(() {
  // Execute after build
});

Orientation Helpers #

context.valueByOrientation(
  portrait: 16.0,
  landscape: 24.0,
);

About #

Maintained by K Sai Kiran.

Website: https://ksaikiran.dev

Explore more Flutter packages and developer tools at ksaikiran.dev.


8
likes
0
points
120
downloads

Publisher

verified publisherksaikiran.dev

Weekly Downloads

Powerful and lightweight BuildContext extensions for Flutter. Simplify navigation, responsive layouts, theme access, dialogs, snackbars, and more.

Homepage
Repository (GitHub)
View/report issues

Topics

#flutter #extensions #buildcontext #responsive #navigation

License

unknown (license)

Dependencies

flutter

More

Packages that depend on context_extensions_codespark