Flutter GearBox
Flutter Package contains common utility functions(logger, appRouter, snackBar, NetworkUtils, custom extension, UrlLauncher, Custom TextFields and ect... ) published on Pub dev.
Supported Devices
- Android
- IOS
- Linux
- Windows
- Macos
Installation
- Add the latest version of package to your pubspec.yaml (and run
dart pub get
):
dependencies:
flutter_gearbox:
- Import the package and use it in your Flutter App.
import 'package:flutter_gearbox/flutter_gearbox.dart';
- Add Keys in Material App for routing and display snackbar without BuiltContext
MaterialApp(
scaffoldMessengerKey: snackbarKey,
navigatorKey: navigatorKey,
...
)
Features
-
Custom Logger
- info
- verbose
- wtf
- debug
- warning
- error
-
Custom appRouter without BuiltContext
- push
- pushOFFAll
- pushNamed
- pop
-
ShowSnackBar without BuildContext
- showSnackBar
-
Spaces
- VerticalSpace
- HorizontalSpace
-
NetworkUtils
- isConnectionAvailable
- performAction
- listenConnectionStream
-
CustomTextField
- NameTextField
- SearchTextField
- EmailTextField
- PasswordTextField
- PhoneNumberTextField
-
Status Codes
- statusOk
- statusNotFound
- statusInvalidRequest
- statusInternalServerError
-
UrlLauncher
- launchURL
-
Extension
- string_extension --> capitalize
-
Custom Variables
- isInProduction
- isDebugMode
-
Custom Screens
- NoInterNetScreen
Example
Logger
logger.error("My Error Print");
AppRouter without BuildContext
appRouter.push(HomeScreen());
ShowSnackBar without BuildContext
showSnackBar(msg: "MOM ❤");
Spacer VerticalSpace
VerticalSpace(height: 10);
Spacer HorizontalSpace
HorizontalSpace(width: 10);
NetworkUtils
final connectionStatus = await networkUtils.isConnectionAvailable();
await networkUtils.performAction();
await networkUtils.listenConnectionStream();
CustomTextField
CustomTextField(text: "Enter your name");
Status Code
if(res.status == statusOk) {
....
}
UrlLauncher
await launchURL("google.com")
String Extension
String name = username.toString().capitalize;
Custom Debug Variables
if(isInProduction){
...Report to crash analysis
}
if(isDebugMode) {
print("HELLO WORLD");
}
NoInterNetScreen
NoInterNetScreen();
Next Goals
- Added Utility functions(extensions, logger, navigator, network, custom screen, snackbar, spaces, status_code, custom_text_field, url_launcher)
- More functions to add
Contributions
If you find a bug or want a feature, but don't know how to fix/implement it, please fill an issue.
If you fixed a bug or implemented a feature, please send a pull request.