-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6ed1339
Showing
19 changed files
with
899 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# See https://www.dartlang.org/guides/libraries/private-files | ||
|
||
# Files and directories created by pub | ||
.dart_tool/ | ||
.packages | ||
build/ | ||
# If you're building an application, you may want to check-in your pubspec.lock | ||
pubspec.lock | ||
|
||
# Directory created by dartdoc | ||
# If you don't generate documentation locally you can remove this line. | ||
doc/api/ | ||
|
||
# Avoid committing generated Javascript files: | ||
*.dart.js | ||
*.info.json # Produced by the --dump-info flag. | ||
*.js # When generated by dart2js. Don't specify *.js if your | ||
# project includes source files written in JavaScript. | ||
*.js_ | ||
*.js.deps | ||
*.js.map |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# This file tracks properties of this Flutter project. | ||
# Used by Flutter tool to assess capabilities and perform upgrades etc. | ||
# | ||
# This file should be version controlled and should not be manually edited. | ||
|
||
version: | ||
revision: f4abaa0735eba4dfd8f33f73363911d63931fe03 | ||
channel: stable | ||
|
||
project_type: package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 0.0.1 | ||
|
||
* TODO: Describe initial release. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021 Alexandru Mariuti | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# awesome_flutter_extensions | ||
Awesome flutter extensions to remove boilerplate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include: package:very_good_analysis/analysis_options.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/lib" isTestSource="false" /> | ||
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" /> | ||
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" /> | ||
<excludeFolder url="file://$MODULE_DIR$/.idea" /> | ||
<excludeFolder url="file://$MODULE_DIR$/.pub" /> | ||
<excludeFolder url="file://$MODULE_DIR$/build" /> | ||
</content> | ||
<orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="Dart Packages" level="project" /> | ||
<orderEntry type="library" name="Dart SDK" level="project" /> | ||
<orderEntry type="library" name="Flutter Plugins" level="project" /> | ||
</component> | ||
</module> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
library awesome_flutter_extensions; | ||
|
||
export 'src/navigator_ext.dart'; | ||
export 'src/sizes_ext.dart'; | ||
export 'src/text_styles_ext.dart'; | ||
export 'src/theme_colors_ext.dart'; | ||
export 'src/themes_ext.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
/// Helper extension that allows to use a navigator like: | ||
/// `context.navigator.push(SomePage())` | ||
extension NavigatorX on BuildContext { | ||
/// All the navigator methods | ||
_Navigator get navigator => _Navigator( | ||
canPop: _navigator.canPop, | ||
maybePop: _navigator.maybePop, | ||
pop: _navigator.pop, | ||
popUntil: _navigator.popUntil, | ||
push: _navigator.push, | ||
popAndPushNamed: _navigator.popAndPushNamed, | ||
pushAndRemoveUntil: _navigator.pushAndRemoveUntil, | ||
pushNamed: _navigator.pushNamed, | ||
pushNamedAndRemoveUntil: _navigator.pushNamedAndRemoveUntil, | ||
pushReplacement: _navigator.pushReplacement, | ||
pushReplacementNamed: _navigator.pushReplacementNamed, | ||
removeRoute: _navigator.removeRoute, | ||
removeRouteBelow: _navigator.removeRouteBelow, | ||
replace: _navigator.replace, | ||
replaceRouteBelow: _navigator.replaceRouteBelow, | ||
); | ||
|
||
NavigatorState get _navigator => Navigator.of(this); | ||
} | ||
|
||
class _Navigator { | ||
_Navigator({ | ||
required this.canPop, | ||
required this.maybePop, | ||
required this.pop, | ||
required this.popUntil, | ||
required this.push, | ||
required this.popAndPushNamed, | ||
required this.pushAndRemoveUntil, | ||
required this.pushNamed, | ||
required this.pushNamedAndRemoveUntil, | ||
required this.pushReplacement, | ||
required this.pushReplacementNamed, | ||
required this.removeRoute, | ||
required this.removeRouteBelow, | ||
required this.replace, | ||
required this.replaceRouteBelow, | ||
}); | ||
|
||
/// See [NavigatorState.canPop]. | ||
final bool Function() canPop; | ||
|
||
/// See [NavigatorState.maybePop]. | ||
final Future<bool> Function<T extends Object?>([T? result]) maybePop; | ||
|
||
/// See [NavigatorState.pop]. | ||
final void Function<T extends Object?>([T? result]) pop; | ||
|
||
/// See [NavigatorState.popUntil]. | ||
final void Function(RoutePredicate predicate) popUntil; | ||
|
||
/// See [NavigatorState.push]. | ||
final Future<T?> Function<T extends Object?>(Route<T> route) push; | ||
|
||
/// See [NavigatorState.popAndPushNamed]. | ||
final Future<T?> Function<T extends Object?, TO extends Object?>( | ||
String routeName, { | ||
TO? result, | ||
Object? arguments, | ||
}) popAndPushNamed; | ||
|
||
/// See [NavigatorState.pushAndRemoveUntil]. | ||
final Future<T?> Function<T extends Object?>( | ||
Route<T> newRoute, RoutePredicate predicate) pushAndRemoveUntil; | ||
|
||
/// See [NavigatorState.pushNamed]. | ||
final Future<T?> Function<T extends Object?>( | ||
String routeName, { | ||
Object? arguments, | ||
}) pushNamed; | ||
|
||
/// See [NavigatorState.pushNamedAndRemoveUntil]. | ||
final Future<T?> Function<T extends Object?>( | ||
String newRouteName, | ||
RoutePredicate predicate, { | ||
Object? arguments, | ||
}) pushNamedAndRemoveUntil; | ||
|
||
/// See [NavigatorState.pushReplacement]. | ||
final Future<T?> Function<T extends Object?, TO extends Object?>( | ||
Route<T> newRoute, | ||
{TO? result}) pushReplacement; | ||
|
||
/// See [NavigatorState.pushReplacementNamed]. | ||
final Future<T?> Function<T extends Object?, TO extends Object?>( | ||
String routeName, | ||
{TO? result, | ||
Object? arguments}) pushReplacementNamed; | ||
|
||
/// See [NavigatorState.removeRoute]. | ||
final void Function(Route<dynamic> route) removeRoute; | ||
|
||
/// See [NavigatorState.removeRouteBelow]. | ||
final void Function(Route<dynamic> anchorRoute) removeRouteBelow; | ||
|
||
/// See [NavigatorState.replace]. | ||
final void Function<T extends Object?>( | ||
{required Route<dynamic> oldRoute, required Route<T> newRoute}) replace; | ||
|
||
/// See [NavigatorState.replaceRouteBelow]. | ||
final void Function<T extends Object?>( | ||
{required Route<dynamic> anchorRoute, | ||
required Route<T> newRoute}) replaceRouteBelow; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
/// Helper extension that allows to use a size like: | ||
/// `context.sizes.width` | ||
extension Sizes on BuildContext { | ||
/// The list of sizes available to the app | ||
_Sizes get sizes => _Sizes( | ||
width: _width, | ||
height: _height, | ||
padding: _padding, | ||
viewInsets: _viewInsets, | ||
systemGestureInsets: _systemGestureInsets, | ||
viewPadding: _viewPadding, | ||
devicePixelRatio: _devicePixelRatio, | ||
textScaleFactor: _textScaleFactor, | ||
); | ||
|
||
MediaQueryData get _mediaQuery => MediaQuery.of(this); | ||
|
||
double get _width => _mediaQuery.size.width; | ||
double get _height => _mediaQuery.size.height; | ||
EdgeInsets get _padding => _mediaQuery.padding; | ||
EdgeInsets get _viewInsets => _mediaQuery.viewInsets; | ||
EdgeInsets get _systemGestureInsets => _mediaQuery.systemGestureInsets; | ||
EdgeInsets get _viewPadding => _mediaQuery.viewPadding; | ||
double get _devicePixelRatio => _mediaQuery.devicePixelRatio; | ||
double get _textScaleFactor => _mediaQuery.textScaleFactor; | ||
} | ||
|
||
class _Sizes { | ||
_Sizes({ | ||
required this.width, | ||
required this.height, | ||
required this.padding, | ||
required this.viewInsets, | ||
required this.systemGestureInsets, | ||
required this.viewPadding, | ||
required this.devicePixelRatio, | ||
required this.textScaleFactor, | ||
}); | ||
|
||
/// See [Size.width]. | ||
final double width; | ||
|
||
/// See [Size.height]. | ||
final double height; | ||
|
||
/// See [MediaQueryData.padding]. | ||
final EdgeInsets padding; | ||
|
||
/// See [MediaQueryData.viewInsets]. | ||
final EdgeInsets viewInsets; | ||
|
||
/// See [MediaQueryData.systemGestureInsets]. | ||
final EdgeInsets systemGestureInsets; | ||
|
||
/// See [MediaQueryData.viewPadding]. | ||
final EdgeInsets viewPadding; | ||
|
||
/// See [MediaQueryData.devicePixelRatio]. | ||
final double devicePixelRatio; | ||
|
||
/// See [MediaQueryData.devicePixelRatio]. | ||
final double textScaleFactor; | ||
} |
Oops, something went wrong.