flutter_screwdriver 1.0.0 flutter_screwdriver: ^1.0.0 copied to clipboard
A flutter package aiming to provide useful extensions and helper functions to ease and speed up development.
Flutter Screwdriver #
A flutter package aiming to provide useful extensions and helper functions to ease and speed up development.
- ๐ Well Documented
- ๐งช Well Tested
- ๐ Follows Code Quality Guidelines
- ๐ฆพ Production Ready
- ๐น Easy to Use
To checkout all the available extensions, helper functions & classes, see documentation.
Installation #
- Add as a dependency in your project's
pub spec.yaml
dependencies:
flutter_screwdriver: ^1.X.X
- Import library into your code.
import 'package:flutter_screwdriver/flutter_screwdriver.dart';
A Glimpse of Flutter Screwdriver
'#FF4433'.toColor(); // returns Color object
context.theme; // short for Theme.of(context)
myConfirmationView.showAsDialog(context);
homeRoute.push(context); // short for Navigation.of(context).push(homeRoute);
closeApp(); // closes the app
Colors.red.hexString; // converts to hex string
Color(0xFF4433).toMaterialColor(); // converts given color to material color with standard shades
Color(0xFF4433).shade(300); // creates white based shades of given color
Colors.red.tweenTo(Colors.blue); // creates ColorTween
State and Context Extensions
Access common inherited widgets directly from state.
theme; // Short for Theme.of(context)
mediaQuery; // Short for MediaQuery.of(context)
focusScope; // Short for FocusScope.of(context)
navigator; // Short for Navigator.of(context)
hideKeyboard(); // hides soft input keyboard
context.theme;
context.mediaQuery;
context.focusScope;
context.navigator;
context.hideKeyboard();
TextEditingController
emailController.trimmed;
emailController.isBlank;
emailController.onChanged((value) => print(value));
emailController.onSelectionChanged((selection) => print(selection));
emailController.textChanges(); // Returns a Stream<String>
emailController.selectionChanges(); // Returns a Stream<TextSelection>
Routes
FadeScalePageRoute();
FadeThroughPageRoute();
SharedAxisPageRoute();
Hiding keyboard when clicked outside tap-able views
import 'package:flutter_screwdriver/flutter_screwdriver.dart';
HideKeyboard(
MaterialApp(
theme: ThemeData.light(),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: MyWidget(),
),
),
);
Clearing focus when navigation happens (mainly to close keyboard if visible)
import 'package:flutter_screwdriver/flutter_screwdriver.dart';
MaterialApp(
theme: ThemeData.light(),
debugShowCheckedModeBanner: false,
navigatorObservers: [
ClearFocusNavigatorObserver(),
],
home: Scaffold(
body: MyWidget(),
),
);
Checkout documentation
Features and bugs #
Please file feature requests and bugs at the issue tracker.
Liked Flutter Screwdriver?
Show some love and support by starring the repository.
Or You can
License #
Copyright (c) 2020, Birju Vachhani
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.