Skip to content

Commit

Permalink
Added CrossAxesAlignment to PairWidget.
Browse files Browse the repository at this point in the history
Added "tenth" method to ShowUp and ShowDown.
Removing capitalize method (replaced by dartx library).
  • Loading branch information
shinayser committed Dec 18, 2019
1 parent 4d97a8d commit 96eb159
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ Add this to your pusbec.yaml dependencies:
```shinayser_essentials_flutter:
git:
url: https://github.com/shinayser/ShinayserEssentialsFlutter.git
ref: 1.17.1
ref: 1.17.2
```
10 changes: 10 additions & 0 deletions lib/animation/showdown.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ class ShowDown extends StatefulWidget {
}) : this.offset = 0.2,
super(key: key);

///Creates a ShowUp with a offset = 0.1 (1/10 the child's height)
ShowDown.tenth({
@required this.child,
this.delay,
this.duration,
this.animation,
Key key,
}) : this.offset = 0.1,
super(key: key);

@override
_ShowDownState createState() => _ShowDownState();
}
Expand Down
17 changes: 15 additions & 2 deletions lib/animation/showup.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ class ShowUp extends StatefulWidget {
}) : this.offset = 0.2,
super(key: key);

///Creates a ShowUp with a offset = 0.1 (1/10 the child's height)
ShowUp.tenth({
@required this.child,
this.delay,
this.duration,
this.animation,
Key key,
}) : this.offset = 0.1,
super(key: key);

@override
_ShowUpState createState() => _ShowUpState();
}
Expand All @@ -55,10 +65,13 @@ class _ShowUpState extends State<ShowUp> with SingleTickerProviderStateMixin {
super.initState();

if (widget.animation == null) {
_animController = AnimationController(vsync: this, duration: Duration(milliseconds: widget.duration ?? 500));
_animController = AnimationController(
vsync: this,
duration: Duration(milliseconds: widget.duration ?? 500));
}

final curve = CurvedAnimation(curve: Curves.ease, parent: _animController ?? widget.animation);
final curve = CurvedAnimation(
curve: Curves.ease, parent: _animController ?? widget.animation);
_animOffset = Tween<Offset>(
begin: Offset(0.0, widget.offset ?? 1.0),
end: Offset.zero,
Expand Down
2 changes: 1 addition & 1 deletion lib/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Color hexToColor(String code) {
return Color(int.parse(code, radix: 16) + 0xFF000000);
}

String capitalize(String text) => text[0].toUpperCase() + text.substring(1);
//String capitalize(String text) => text[0].toUpperCase() + text.substring(1);

Duration parseDuration(String string) {
int hours = 0;
Expand Down
4 changes: 3 additions & 1 deletion lib/widgets/lazy_stream_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ class LazyStreamBuilder<T> extends StreamBuilder<T> {
key: key,
stream: stream,
builder: builder,
initialData: (stream is BehaviorSubject) ? ((stream as BehaviorSubject).value) : null,
initialData: (stream is BehaviorSubject)
? ((stream as BehaviorSubject).value)
: null,
);

final Widget onWaiting;
Expand Down
8 changes: 6 additions & 2 deletions lib/widgets/pair_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@ class PairWidget extends StatelessWidget {
final Widget child2;
final double spacing;
final Axis direction;
final CrossAxisAlignment crossAxisAlignment;

const PairWidget({
Key key,
this.direction = Axis.horizontal,
this.child1,
this.child2,
this.spacing = 4,
this.crossAxisAlignment = CrossAxisAlignment.center,
}) : super(key: key);

const PairWidget.horizontal({
Key key,
this.child1,
this.child2,
this.spacing = 4,
this.crossAxisAlignment = CrossAxisAlignment.center,
}) : this.direction = Axis.horizontal,
super(key: key);

Expand All @@ -27,6 +30,7 @@ class PairWidget extends StatelessWidget {
this.child1,
this.child2,
this.spacing = 4,
this.crossAxisAlignment = CrossAxisAlignment.center,
}) : this.direction = Axis.vertical,
super(key: key);

Expand All @@ -35,13 +39,13 @@ class PairWidget extends StatelessWidget {
if (direction == Axis.horizontal) {
return Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: crossAxisAlignment,
children: _children(),
);
} else {
return Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
crossAxisAlignment: crossAxisAlignment,
children: _children(),
);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ packages:
name: rxdart
url: "https://pub.dartlang.org"
source: hosted
version: "0.23.0-dev.3"
version: "0.23.1"
sky_engine:
dependency: transitive
description: flutter
Expand Down
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: shinayser_essentials_flutter
description: A new Flutter project.
version: 1.17.1
version: 1.17.2
author:
homepage:

Expand All @@ -12,7 +12,7 @@ dependencies:
sdk: flutter

quiver: '>=2.0.0 <3.0.0'
rxdart: ^0.23.0-dev.3
rxdart: ^0.23.1

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 96eb159

Please sign in to comment.