(Recommended) Fork and depend of your fork instead using this one. This is a really unstable installation since it's not from pub.dev.
dependencies:
# ...
flutter_shared_tools:
git:
url: https://github.com/zaidmukaddam/flutter-shared-tools
ref: main
# ...
And use as:
import 'package:flutter_shared_tools/flutter_shared_tools.dart';
Check out full list of features.
MediaQueryAlias
.
// Allow usage of:
context.width; // Alias for MediaQuery.of(context).size.width;
context.height; // Alias for MediaQuery.of(context).size.height;
// Many others, check [MediaQueryAlias] extension for full list of alias
NavigatorAlias
.
// Use context to manage routes:
context.push(...);
context.pop(...);
context.maybePop(...);
// Instead of:
Navigator.of(context).push(...);
Navigator.of(context).pop(...);
Navigator.of(context).maybePop(...);
ScrollControllerUtils
.
// Use to build an infinite scroll
scrollController.addOffsetListener(
() {
loadMoreItemFromApi(); // Will be called everytime scroll reaches the bottom
},
context.height / 2, // Optionally set an offset from the bottom to load before it reaches the real bottom
);
ThemeAlias
.
if (context.isDark) { /* ... */ }
context.primaryColor; // ...
context.colorScheme; // ...
context.onPrimary; // ...
// ...etc. See full list at [ThemeAlias] extension.
See primer.style/primitives/colors, the official website of color scheme of GitHub theme.
This module allows you use it inside Flutter.
// Object with all colors of the GitHub Light theme
const kGitHubLight = GitHubLightColors();
// Object with all colors of the GitHub Dark Dimmed theme
const kGitHubDarkDimmed = GitHubDarkDimmedColors();
// Object with all colors of the GitHub Dark theme
const kGitHubDark = GitHubDarkColors();
// Object with all colors of the GitHub Light Colorblind theme
const kGitHubLightColorblind = GitHubLightColorblindColors();
SkeletonAnimation
. Useful to display as loading indicators rather than theCircularProgressIndicator()
.
Container(
child: SkeletonAnimation(
child: SizedBox(width: 100, height: 25), // Define Skeleton size
),
);
- Border Radius constants.
const BorderRadius kBRadius8 = BorderRadius.all(kRadius8);
const BorderRadius kBRadius4 = BorderRadius.all(kRadius4);
const BorderRadius kBRadius2 = BorderRadius.all(kRadius2);
- Radius constants.
const Radius kRadius8 = Radius.circular(8);
const Radius kRadius4 = Radius.circular(4);
const Radius kRadius2 = Radius.circular(2);
Copyright © 2022-present, Zaid Mukaddam.
Flutter Shared Tools is MIT licensed 💖