Skip to content

Commit

Permalink
0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ReinBentdal committed Jun 20, 2019
1 parent 364d70e commit eacaa37
Show file tree
Hide file tree
Showing 10 changed files with 250 additions and 249 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# 0.6.1
* [Fix] `ripple` and `opacity` now works with `add` method.
* Other minor improvements and fixes

## 0.6.0
* Added `ripple` method to `StyleClass`.
* Added `opacity` method to `StyleClass`.
* Major rewrite of widget builder. Improved performance.


## 0.5.0
* Added `backgroundBlur` method to the `StyleClass`.
* Added `backgroundImage` method to `StyleClass`.
Expand Down
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,10 @@ Division(

To add a style to the `StyleClass`, use the ..[style] syntax. The two dots is used to not return [style], but the `StyleClass`.

On construction, choose to use radians or not when giving circular values. `Styleclass({bool useRadians = false})`.
On construction, choose to use radians or not when giving circular values.
```dart
Styleclass({bool useRadians = false})
```

#### Align
```dart
Expand Down Expand Up @@ -187,7 +190,7 @@ Value must not be negative.
dynamic color = const Color(0xFF000000),
BorderStyle style = BorderStyle.solid})
```
Choose between `all` or `left`, `right`, `top` and `bottom`.
Choose between `all`, `left`, `right`, `top` and `bottom`. `all` works together with the other properties.
`color` parameter supports HEX '#xxxxxx', rgb(int, int, int), rgba(int, int, int, double) and [Color].

#### Border radius
Expand Down Expand Up @@ -251,7 +254,7 @@ By default one turn equals the value 1.0. To change to radians: `StyleClass(useR
```
Material ripple effect.

The ripple effect does not work if `onTap` is defined. You may change `onTap` to `onTapDown`, `onTapUp` and `onTapCancel`.
**`onTap` does not work if `ripple` is defined.** You may use `onTapDown`, `onTapUp` or `onTapCancel` instead.

#### Animate
```dart
Expand Down
139 changes: 139 additions & 0 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
# Generated by pub
# See https://www.dartlang.org/tools/pub/glossary#lockfile
packages:
async:
dependency: transitive
description:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.2"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.14.11"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.6.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.0"
quiver:
dependency: transitive
description:
name: quiver
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.2"
sky_engine:
dependency: transitive
description: flutter
source: sdk
version: "0.0.99"
source_span:
dependency: transitive
description:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.5.5"
stack_trace:
dependency: transitive
description:
name: stack_trace
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.3"
stream_channel:
dependency: transitive
description:
name: stream_channel
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
string_scanner:
dependency: transitive
description:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.2.4"
typed_data:
dependency: transitive
description:
name: typed_data
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.6"
vector_math:
dependency: transitive
description:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.8"
sdks:
dart: ">=2.2.0 <3.0.0"
8 changes: 0 additions & 8 deletions lib/src/build.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@ class DivisionBuild extends StatelessWidget {
Widget build(BuildContext context) {
Widget current = child;

// container

if (child == null && (constraints == null || !constraints.isTight)) {
current = LimitedBox(
maxWidth: 0.0,
Expand All @@ -82,15 +80,13 @@ class DivisionBuild extends StatelessWidget {
);
}

// child alignment
if (alignmentChild != null)
current = Align(alignment: alignmentChild, child: current);

final EdgeInsetsGeometry effectivePadding = _paddingIncludingDecoration;
if (effectivePadding != null)
current = Padding(padding: effectivePadding, child: current);

// Material ripple effect
if (ripple != null && ripple?.enable == true) {
current = Material(
color: Colors.transparent,
Expand All @@ -112,7 +108,6 @@ class DivisionBuild extends StatelessWidget {

if (margin != null) current = Padding(padding: margin, child: current);

// background blur
if (backgroundBlur != null) {
current = ClipRRect(
borderRadius: decoration?.borderRadius,
Expand All @@ -126,11 +121,9 @@ class DivisionBuild extends StatelessWidget {
);
}

// widget alignment
if (alignment != null)
current = Align(alignment: alignment, child: current);

// transform
if (transform != null) {
current = Transform(
alignment: FractionalOffset.center,
Expand All @@ -139,7 +132,6 @@ class DivisionBuild extends StatelessWidget {
);
}

// opacity
if (opacity != null) current = Opacity(opacity: opacity, child: current);

return current;
Expand Down
4 changes: 4 additions & 0 deletions lib/src/format/format_color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,17 @@ Color formatColor(dynamic color, {bool acceptNull = false}) {
color[1] is int &&
color[2] is int &&
color[3] is double) {
print(
'The color format [int, int, int, double] is deprectaed. Use rgba(int, int, int, double) instead');
formattedColor = Color.fromRGBO(color[0], color[1], color[2], color[3]);
} else {
throw ('Unsupported rgba color format. Expected [int, int, int, double] but recieved $color');
}
}
if (color.length == 3) {
if (color is List<int>) {
print(
'The color format [int, int, int] is deprectaed. Use rgba(int, int, int) instead');
formattedColor = Color.fromRGBO(color[0], color[1], color[2], 1);
} else {
throw ('Unsupported rgb color format. Expected [int, int, int] but recieved $color');
Expand Down
4 changes: 2 additions & 2 deletions lib/src/function/color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'package:flutter/material.dart';

/// Returns [Color].
///
/// [r], [g] and [b] must not exceed 255
/// [r], [g] and [b] must not exceed 255.
///
/// ```dart
/// ..backgroundColor(rgb(34, 29, 189));
Expand All @@ -13,7 +13,7 @@ Color rgb(int r, int g, int b) {

/// Returns [Color].
///
/// [r], [g] and [b] must not exceed 255
/// [r], [g] and [b] must not exceed 255.
///
/// ```dart
/// ..backgroundColor(rgba(34, 29, 189, 0.7));
Expand Down
6 changes: 3 additions & 3 deletions lib/src/gesture_class.dart
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import 'package:flutter/widgets.dart';

/// Holds all the gestures for the `Division` widget
/// Responsible for all the gestures for the `Division` widget
///
/// ```dart
/// Division(
/// style: StyleClass()
/// ..width(100)
/// ..height(150)
/// ..borderRadius(all: 30.0)
/// ..backgroundColor(hex; 'eeeeee'),
/// ..backgroundColor('#eeeeee'),
/// gesture: GestureClass()
/// ..onTap(() => print('Widget pressed!'))
/// ..onLongPress(() => print('Widget pressed long!)),
/// ..onLongPress(() => print('Widget longpress)),
/// child: Text('Some text),
/// )
/// ```
Expand Down
Loading

0 comments on commit eacaa37

Please sign in to comment.