Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Migrated null-safety #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions example/ios/Flutter/flutter_export_environment.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
# This is a generated file; do not edit or check into version control.
export "FLUTTER_ROOT=c:\src\flutter"
export "FLUTTER_APPLICATION_PATH=C:\Users\Marcelo\Documents\sbsistemas\t\t\flutter_skeleton\example"
export "COCOAPODS_PARALLEL_CODE_SIGN=true"
export "FLUTTER_TARGET=lib\main.dart"
export "FLUTTER_BUILD_DIR=build"
export "SYMROOT=${SOURCE_ROOT}/../build\ios"
export "FLUTTER_BUILD_NAME=1.0.0"
export "FLUTTER_BUILD_NUMBER=1"
export "DART_OBFUSCATION=false"
export "TRACK_WIDGET_CREATION=false"
export "TREE_SHAKE_ICONS=false"
export "PACKAGE_CONFIG=.packages"
6 changes: 3 additions & 3 deletions lib/src/skeleton_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class SkeletonStyle {
final bool isCircleAvatar;
final int barCount;
final BorderRadius borderRadius;
final EdgeInsetsGeometry padding;
final List<Color> colors;
final Color backgroundColor;
final EdgeInsetsGeometry? padding;
final List<Color>? colors;
final Color? backgroundColor;
final SkeletonTheme theme;

SkeletonStyle({
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widget/card_list_skeleton.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class CardListSkeleton extends StatelessWidget {
final int length;

CardListSkeleton({
Key key,
Key? key,
this.style: const SkeletonStyle.origin(),
this.length: 10,
}) : super(key: key);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widget/card_skeleton.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class CardSkeleton extends StatelessWidget {
final SkeletonStyle style;

CardSkeleton({
Key key,
Key? key,
this.style: const SkeletonStyle.origin(),
}) : super(key: key);

Expand Down
2 changes: 1 addition & 1 deletion lib/src/widget/list_skeleton.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class ListSkeleton extends StatelessWidget {
final int length;

ListSkeleton({
Key key,
Key? key,
this.style: const SkeletonStyle.origin(),
this.length: 10,
}) : super(key: key);
Expand Down
20 changes: 10 additions & 10 deletions lib/src/widget/list_tile_skeleton.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class ListTileSkeleton extends StatefulWidget {
final SkeletonStyle style;

ListTileSkeleton({
Key key,
Key? key,
this.style: const SkeletonStyle.origin(),
}) : super(key: key);

Expand All @@ -21,7 +21,7 @@ class ListTileSkeleton extends StatefulWidget {

class _ListTileSkeletonState extends State<ListTileSkeleton>
with SingleTickerProviderStateMixin {
_SkeletonAnimation _skeletonAnimation;
_SkeletonAnimation? _skeletonAnimation;

@override
void initState() {
Expand All @@ -34,12 +34,12 @@ class _ListTileSkeletonState extends State<ListTileSkeleton>
@override
void dispose() {
if (widget.style.isAnimation) {
_skeletonAnimation.dispose();
_skeletonAnimation!.dispose();
}
super.dispose();
}

Color get _backgroundColor {
Color? get _backgroundColor {
if (widget.style.backgroundColor != null) {
return widget.style.backgroundColor;
}
Expand All @@ -49,16 +49,16 @@ class _ListTileSkeletonState extends State<ListTileSkeleton>
return lightBackgroundColor;
}

EdgeInsetsGeometry get _padding {
EdgeInsetsGeometry? get _padding {
if (widget.style.padding != null) {
return widget.style.padding;
}
return EdgeInsets.all(16.0);
}

_SkeletonDecoration _createSkeletonDecoration(bool isCircle) {
List<Color> colors = [];
if (widget.style.colors != null && widget.style.colors.length > 0) {
List<Color>? colors = [];
if (widget.style.colors != null && widget.style.colors!.length > 0) {
colors = widget.style.colors;
} else {
colors =
Expand All @@ -69,15 +69,15 @@ class _ListTileSkeletonState extends State<ListTileSkeleton>
animation: _skeletonAnimation,
isCircle: isCircle,
isAnimation: widget.style.isAnimation,
colors: colors,
colors: colors!,
);
}

@override
Widget build(BuildContext context) {
return widget.style.isAnimation
? AnimatedBuilder(
animation: _skeletonAnimation.animation,
animation: _skeletonAnimation!.animation,
builder: (context, child) {
return _renderContainer();
},
Expand Down Expand Up @@ -162,7 +162,7 @@ class _ListTileSkeletonState extends State<ListTileSkeleton>
return Offstage();
}

List<double> widths = [width * 0.7, width * 0.8, width * 0.5];
List<double?> widths = [width * 0.7, width * 0.8, width * 0.5];
List<Widget> children = [];
children.add(SizedBox(height: 20.0));
for (int i = 0; i < count; i++) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widget/skeleton_animation.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
part of 'list_tile_skeleton.dart';

class _SkeletonAnimation {
AnimationController _controller;
Animation<double> animation;
late AnimationController _controller;
late Animation<double> animation;

_SkeletonAnimation(TickerProvider provider) {
_controller =
Expand Down
6 changes: 3 additions & 3 deletions lib/src/widget/skeleton_decoration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ part of 'list_tile_skeleton.dart';

class _SkeletonDecoration extends BoxDecoration {
_SkeletonDecoration({
@required List<Color> colors,
required List<Color> colors,
isAnimation: true,
_SkeletonAnimation animation,
_SkeletonAnimation? animation,
isCircle: false,
}) : super(
shape: isCircle ? BoxShape.circle : BoxShape.rectangle,
Expand All @@ -15,7 +15,7 @@ class _SkeletonDecoration extends BoxDecoration {
end: Alignment.centerRight,
colors: colors,
stops: [
animation.animation.value - 1,
animation!.animation.value - 1,
animation.animation.value,
animation.animation.value + 1
],
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ dependencies:
sdk: flutter

environment:
sdk: ">=1.19.0 <3.0.0"
sdk: '>=2.12.0 <3.0.0'
flutter: ">=0.4.1 <2.0.0"