Skip to content

Commit

Permalink
add public api lint rule for ci builder
Browse files Browse the repository at this point in the history
  • Loading branch information
avenwu committed Feb 28, 2020
1 parent 4d8952b commit c268075
Show file tree
Hide file tree
Showing 24 changed files with 48 additions and 26 deletions.
7 changes: 3 additions & 4 deletions ci
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,12 @@ info "Step 1 Evaluate with panahtml"
panahtml --strict --no-web

info "Step 2 Run linter for lib only"
dartanalyzer lib --options ci-analysis_options.yaml > build/lint-result.txt
dartanalyzer lib --options ci-analysis_options.yaml >build/lint-result.txt
# n lints found. => issue found, No issues found! => success
count=$(grep -c 'lints found.' < build/lint-result.txt)
count=$(grep -c 'lints found.' <build/lint-result.txt)
if [ "$count" = "0" ]; then
info "Lint check passed."
else
warning "Issues list:\n$(grep 'lint' < build/lint-result.txt)"
warning "Issues list:\n$(grep 'lint' <build/lint-result.txt)"
die "Failed to passs Lint rules, check lint result at build/lint-result.txt"
fi

19 changes: 7 additions & 12 deletions deploy
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ die() {
}

confirm() {
read -p "Looks great! Are you ready to continue (y/n)? " input
if [[ $input != 'y' ]] ; then
read -r -p "Looks great! Are you ready to continue (y/n)? " input
if [[ $input != 'y' ]]; then
die "Workflow terminated"
fi
}
Expand All @@ -42,9 +42,9 @@ confirm() {
countdown() {
secs=$1
shift
msg=$@
while [ $secs -gt 0 ]
do
msg=$*
# shellcheck disable=SC2086
while [ $secs -gt 0 ]; do
printf "\r\033[K$msg in %.d seconds" $((secs--))
sleep 1
done
Expand All @@ -55,15 +55,14 @@ info "Start process workflow"
info "Step 1 Run test case with code coverage"

flutter pub get
flutter test --coverage && genhtml coverage/lcov.info --output=coverage
if [ ! $? = 0 ]; then
if ! flutter test --coverage; then
die "Test failed"
fi
genhtml coverage/lcov.info --output=coverage

info "Step 2 Review code coverage report"
countdown 3 "Will open browser"
open coverage/index.html

confirm

info "Step 3 Evaluate with panahtml"
Expand All @@ -76,7 +75,3 @@ confirm

info "Step 5 Publish to pub.dev"
flutter pub publish
if [ ! $? = 0 ]; then
die "Test failed"
fi
info "Done!"
2 changes: 1 addition & 1 deletion example/lib/components/heading.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Heading extends StatelessWidget {
alignment: AlignmentDirectional.centerStart,
child: Text(
text,
style: theme.textTheme.body1.copyWith(
style: theme.textTheme.bodyText2.copyWith(
color: theme.primaryColor,
),
),
Expand Down
2 changes: 1 addition & 1 deletion example/lib/components/radio_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class RadioItem<T> extends StatelessWidget {
},
child: Text(
value.title,
style: theme.textTheme.subhead,
style: theme.textTheme.subtitle1,
),
),
),
Expand Down
2 changes: 1 addition & 1 deletion example/lib/custom_appbar_sample.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class _State extends State<CustomAppBarDemo>
: Center(
child: Text(
'<\t\t${i.title}\t\t>',
style: Theme.of(context).textTheme.display1,
style: Theme.of(context).textTheme.headline4,
)))
.toList(growable: false),
),
Expand Down
10 changes: 5 additions & 5 deletions example/lib/data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,11 @@ class Data {
];
}
return [
const TabItem<IconData>(icon: Icons.home, title: 'Home'),
const TabItem<IconData>(icon: Icons.map, title: "Discovery"),
const TabItem<IconData>(icon: Icons.publish, title: "Publish"),
const TabItem<IconData>(icon: Icons.message, title: 'Message'),
const TabItem<IconData>(icon: Icons.people, title: 'Profile'),
TabItem<IconData>(icon: Icons.home, title: 'Home'),
TabItem<IconData>(icon: Icons.map, title: "Discovery"),
TabItem<IconData>(icon: Icons.publish, title: "Publish"),
TabItem<IconData>(icon: Icons.message, title: 'Message'),
TabItem<IconData>(icon: Icons.people, title: 'Profile'),
];
}
}
3 changes: 1 addition & 2 deletions example/lib/default_appbar_demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ class DefaultAppBarDemo extends StatefulWidget {

class _State extends State<DefaultAppBarDemo>
with SingleTickerProviderStateMixin {
static const INDEX_PUBLISH = 2;
static const kStyles = [
ChoiceValue<TabStyle>(
title: 'TabStyle.react',
Expand Down Expand Up @@ -134,7 +133,7 @@ class _State extends State<DefaultAppBarDemo>
: Center(
child: Text(
'${i.title}',
style: Theme.of(context).textTheme.display1,
style: Theme.of(context).textTheme.headline4,
)))
.toList(growable: false)),
bottomNavigationBar: _badge == null
Expand Down
1 change: 1 addition & 0 deletions lib/src/chip_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class DefaultChipBuilder extends ChipBuilder {
/// Radius corner for badge.
final double borderRadius;

/// Create a chip builder
DefaultChipBuilder(
this.chips, {
this.textColor,
Expand Down
1 change: 1 addition & 0 deletions lib/src/convex_shape.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import 'dart:math' as math;
///
/// * [CircularNotchedRectangle], a rectangle with a smooth circular notch.
class ConvexNotchedRectangle extends NotchedShape {
/// Create Shape instance
const ConvexNotchedRectangle();

@override
Expand Down
1 change: 1 addition & 0 deletions lib/src/item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class TabItem<T> {
/// Whether icon should blend with color.
final bool blend;

/// Create item
const TabItem({
this.title,
@required this.icon,
Expand Down
1 change: 1 addition & 0 deletions lib/src/painter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class ConvexPainter extends CustomPainter {
/// Position in horizontal which describe the offset of shape.
final Animation<double> leftPercent;

/// Create painter
ConvexPainter({
this.top,
this.width,
Expand Down
1 change: 1 addition & 0 deletions lib/src/reused_gradient.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ class ReusedGradient {
Shader _shader;
Rect _size;

/// Create gradient
ReusedGradient();

/// Setter to reset the [Gradient] instance
Expand Down
1 change: 1 addition & 0 deletions lib/src/stack.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:flutter/widgets.dart' as widget;
/// the size checking when teh Stack instance is overflow enable.
///
class Stack extends widget.Stack {
/// Create stack instance
Stack({
widget.Key key,
AlignmentGeometry alignment = AlignmentDirectional.topStart,
Expand Down
1 change: 1 addition & 0 deletions lib/src/style/blend_image_icon.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/material.dart';

/// Decorate the provided [Image] or [IconData].
class BlendImageIcon<T> extends StatelessWidget {
/// Create image widget
const BlendImageIcon(this.image, {Key key, this.color, this.size})
: assert(image is Widget || image is IconData,
'image must be IconData or Widget'),
Expand Down
1 change: 1 addition & 0 deletions lib/src/style/fixed_circle_tab_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class FixedCircleTabStyle extends InnerBuilder {
/// Margin of tab.
final margin = (ACTION_LAYOUT_SIZE - ACTION_INNER_BUTTON_SIZE) / 4;

/// Create style builder
FixedCircleTabStyle(
{List<TabItem> items,
Color activeColor,
Expand Down
1 change: 1 addition & 0 deletions lib/src/style/fixed_tab_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class FixedTabStyle extends InnerBuilder {
/// Index of the centered convex shape.
final int convexIndex;

/// Create style builder.
FixedTabStyle({
List<TabItem> items,
Color activeColor,
Expand Down
1 change: 1 addition & 0 deletions lib/src/style/flip_tab_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class FlipTabStyle extends InnerBuilder {
/// Curve for flip transition.
final Curve curve;

/// Create style builder.
FlipTabStyle({
List<TabItem> items,
Color activeColor,
Expand Down
1 change: 1 addition & 0 deletions lib/src/style/inner_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ abstract class InnerBuilder extends DelegateBuilder {
/// Color used for tab.
final Color color;

/// Create style builder.
InnerBuilder({this.items, this.activeColor, this.color});
}
1 change: 1 addition & 0 deletions lib/src/style/react_circle_tab_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class ReactCircleTabStyle extends InnerBuilder {
/// Margin of tab.
final margin = (ACTION_LAYOUT_SIZE - ACTION_INNER_BUTTON_SIZE) / 4;

/// Create style builder.
ReactCircleTabStyle({
List<TabItem> items,
Color activeColor,
Expand Down
1 change: 1 addition & 0 deletions lib/src/style/react_tab_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ReactTabStyle extends InnerBuilder {
/// Curve for tab transition.
final Curve curve;

/// Create style builder.
ReactTabStyle({
List<TabItem> items,
Color activeColor,
Expand Down
1 change: 1 addition & 0 deletions lib/src/style/textin_tab_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class TextInTabStyle extends InnerBuilder {
/// Curve for tab transition.
final Curve curve;

/// Create style builder.
TextInTabStyle({
List<TabItem> items,
Color activeColor,
Expand Down
1 change: 1 addition & 0 deletions lib/src/style/titled_tab_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class TitledTabStyle extends InnerBuilder {
/// Margin of tab.
final margin = (ACTION_LAYOUT_SIZE - ACTION_INNER_BUTTON_SIZE) / 4;

/// Create style builder.
TitledTabStyle({
List<TabItem> items,
Color activeColor,
Expand Down
1 change: 1 addition & 0 deletions lib/src/style/transition_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class TransitionContainer extends StatefulWidget {
/// Control whether the animation should be skipped when widget change.
final bool disableAnimateWhenUpdate;

/// Create transition with builder.
TransitionContainer(
{this.builder, this.duration, this.disableAnimateWhenUpdate})
: assert(builder != null);
Expand Down
13 changes: 13 additions & 0 deletions lib/src/style/transition_container_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ abstract class TransitionContainerBuilder {
/// Curve for animation.
final Curve curve;

/// Create style builder.
TransitionContainerBuilder(this.curve);

/// Animation used for widget.
Expand All @@ -21,6 +22,7 @@ abstract class TransitionContainerBuilder {

/// Scale transition builder.
class ScaleBuilder extends TransitionContainerBuilder {
/// The target widget to scale with.
Widget child;

@override
Expand All @@ -33,14 +35,19 @@ class ScaleBuilder extends TransitionContainerBuilder {
return ScaleTransition(scale: animation, child: child);
}

/// Create scale builder
ScaleBuilder({Curve curve, this.child}) : super(curve);
}

/// Slide transition builder.
class SlideBuilder extends TransitionContainerBuilder {
/// The target widget to slide with.
Widget child;

/// slide direction.
final bool reverse;

/// Create slide builder.
SlideBuilder({Curve curve, this.child, this.reverse}) : super(curve);

@override
Expand All @@ -60,10 +67,16 @@ class SlideBuilder extends TransitionContainerBuilder {
/// This flip animation is origin from [https://github.com/deven98/flip_box_bar/blob/master/lib/src/flip_box.dart]
/// UX => ![](https://cdn.dribbble.com/users/1094383/screenshots/4811135/800_5.gif).
class FlipBuilder extends TransitionContainerBuilder {
/// Top widget.
final Widget topChild;

/// Bottom widget.
final Widget bottomChild;

/// Size of builder.
final double height;

/// Create flip builder
FlipBuilder(this.height, {Curve curve, this.topChild, this.bottomChild})
: super(curve);

Expand Down

0 comments on commit c268075

Please sign in to comment.