Skip to content

Commit

Permalink
Add web demo deployment action + readme links (#24)
Browse files Browse the repository at this point in the history
* Lint fixes

* Create web deployment action

* Add web demo link

* Add badge

* Add arrow
  • Loading branch information
WieFel authored Dec 27, 2024
1 parent d034195 commit 87c2433
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 19 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/deploy_web.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Deploy to web

on:
push:
tags:
- '*'

jobs:
deploy-for-web:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
channel: stable
- run: flutter config --enable-web
- run: flutter pub get
- name: Build for web
working-directory: example/
run: flutter build web --release
- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: gh-pages # The branch the action should deploy to.
FOLDER: example/build/web # The folder the action should deploy.
CLEAN: true # Automatically remove deleted files from the deploy branch
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

[![pub.dev](https://img.shields.io/pub/v/number_paginator?logo=dart)](https://pub.dev/packages/number_paginator)
[![analysis](https://github.com/WieFel/number_paginator/workflows/analysis/badge.svg)](https://github.com/WieFel/number_paginator/actions?query=workflow%3Aanalysis)
[![demo](https://img.shields.io/badge/demo-web-blue?logo=googlechrome&logoColor=white&color=blue)](https://wiefel.github.io/number_paginator/#/)

A Flutter paginator widget for switching between page numbers.

<img alt="screenshot1" src="https://github.com/WieFel/number_paginator/raw/main/screenshots/num1.png" width="24%"/> <img alt="screenshot2" src="https://github.com/WieFel/number_paginator/raw/main/screenshots/num2.png" width="24%"/> <img alt="screenshot3" src="https://github.com/WieFel/number_paginator/raw/main/screenshots/num3.png" width="24%"/> <img alt="screenshot3" src="https://github.com/WieFel/number_paginator/raw/main/screenshots/num4.png" width="24%"/>

[→ Check web demo](https://wiefel.github.io/number_paginator/#/)

## Getting Started

Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ packages:
path: ".."
relative: true
source: path
version: "0.4.1"
version: "0.4.2"
path:
dependency: transitive
description:
Expand Down
10 changes: 4 additions & 6 deletions lib/src/ui/number_paginator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class NumberPaginator extends StatefulWidget {

/// Creates an instance of [NumberPaginator].
const NumberPaginator({
Key? key,
super.key,
required this.numberPages,
this.initialPage = 0,
this.onPageChange,
Expand All @@ -85,11 +85,10 @@ class NumberPaginator extends StatefulWidget {
this.prevButtonBuilder,
this.nextButtonBuilder,
}) : assert(initialPage >= 0),
assert(initialPage <= numberPages - 1),
super(key: key);
assert(initialPage <= numberPages - 1);

const NumberPaginator.noPrevNextButtons({
Key? key,
super.key,
required this.numberPages,
this.initialPage = 0,
this.onPageChange,
Expand All @@ -103,8 +102,7 @@ class NumberPaginator extends StatefulWidget {
prevButtonBuilder = null,
nextButtonBuilder = null,
assert(initialPage >= 0),
assert(initialPage <= numberPages - 1),
super(key: key);
assert(initialPage <= numberPages - 1);

@override
NumberPaginatorState createState() => NumberPaginatorState();
Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/widgets/buttons/paginator_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ class PaginatorButton extends StatelessWidget {

/// Creates an instance of [PaginatorButton].
const PaginatorButton({
Key? key,
super.key,
required this.onPressed,
required this.child,
this.selected = false,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
6 changes: 3 additions & 3 deletions lib/src/ui/widgets/inherited_number_paginator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ class InheritedNumberPaginator extends InheritedWidget {
final NumberPaginatorUIConfig config;

const InheritedNumberPaginator({
Key? key,
super.key,
required this.numberPages,
this.initialPage = 0,
this.onPageChange,
required this.config,
required Widget child,
}) : super(key: key, child: child);
required super.child,
});

static InheritedNumberPaginator of(BuildContext context) {
final InheritedNumberPaginator? result =
Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/widgets/paginator_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ class PaginatorContent extends StatelessWidget {
final int currentPage;

const PaginatorContent({
Key? key,
super.key,
required this.currentPage,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/widgets/paginator_content/dropdown_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ class DropDownContent extends StatelessWidget {
final int currentPage;

const DropDownContent({
Key? key,
super.key,
required this.currentPage,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down
4 changes: 2 additions & 2 deletions lib/src/ui/widgets/paginator_content/number_content.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class NumberContent extends StatelessWidget {
final int currentPage;

const NumberContent({
Key? key,
super.key,
required this.currentPage,
}) : super(key: key);
});

@override
Widget build(BuildContext context) {
Expand Down

0 comments on commit 87c2433

Please sign in to comment.