Skip to content

Commit

Permalink
Merge pull request #11 from netglade/update
Browse files Browse the repository at this point in the history
Update
  • Loading branch information
tenhobi authored Oct 10, 2023
2 parents c90a3d9 + db2ee48 commit b8d1137
Show file tree
Hide file tree
Showing 8 changed files with 69 additions and 42 deletions.
21 changes: 21 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

- package-ecosystem: "pub"
directory: "./"
schedule:
interval: "weekly"

- package-ecosystem: "pub"
directory: "/example"
schedule:
interval: "weekly"
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: subosito/[email protected]

- name: Install Dependencies
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/storybook.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
url: ${{ steps.deployment.outputs.page_url }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Configure FVM
uses: kuhnroyal/flutter-fvm-config-action@v1
Expand All @@ -43,19 +43,19 @@ jobs:
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: ${{ env.FLUTTER_CHANNEL }}
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}

- name: Build Storybook for Web
run: flutter build web --base-href "/sliver_app_bar_builder/"

- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: 'example/build/web/'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v2
1 change: 1 addition & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ void main() {

// ignore: prefer-match-file-name, ok for example
class StorybookApp extends StatelessWidget {
// ignore: avoid-stateless-widget-initialized-fields, ok for this
final _plugins = initializePlugins(
knobsSidePanel: true,
contentsSidePanel: true,
Expand Down
15 changes: 4 additions & 11 deletions example/lib/stories/multiline_to_oneline_story.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
// ignore_for_file: no-equal-arguments, no-empty-block
// ignore_for_file: no-empty-block, avoid-local-functions

import 'package:flutter/material.dart';
import 'package:sliver_app_bar_builder/sliver_app_bar_builder.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

class MultilineToOneLineStory extends StatefulWidget {
const MultilineToOneLineStory({
super.key,
});
class MultilineToOneLineStory extends StatelessWidget {
const MultilineToOneLineStory({super.key});

@override
State<MultilineToOneLineStory> createState() => _MultilineToOneLineStoryState();
}

class _MultilineToOneLineStoryState extends State<MultilineToOneLineStory> {
@override
Widget build(BuildContext context) {
// Bar.
Expand Down Expand Up @@ -73,7 +66,7 @@ class _MultilineToOneLineStoryState extends State<MultilineToOneLineStory> {
}

TextPainter painterForExpandRatio(double expandRatio) {
final screenWidth = MediaQuery.of(context).size.width;
final screenWidth = MediaQuery.sizeOf(context).width;
final paddingSpace = EdgeInsets.only(left: leftPaddingForExpandRatio(expandRatio));

return TextPainter()
Expand Down
58 changes: 35 additions & 23 deletions example/lib/stories/play_with_parameters_story.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
// ignore_for_file: avoid_redundant_argument_values, no-empty-block
// ignore_for_file: avoid_redundant_argument_values, no-empty-block, avoid-missing-image-alt, prefer-define-hero-tag

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:sliver_app_bar_builder/sliver_app_bar_builder.dart';
import 'package:storybook_flutter/storybook_flutter.dart';

class PlayWithParametersStory extends StatefulWidget {
const PlayWithParametersStory({
super.key,
});
const PlayWithParametersStory({super.key});

@override
State<PlayWithParametersStory> createState() => _PlayWithParametersStoryState();
Expand Down Expand Up @@ -91,7 +89,6 @@ class _PlayWithParametersStoryState extends State<PlayWithParametersStory> {
final knobContentBelowBar = context.knobs.boolean(
label: 'Separate content',
description: 'Determines if the content is below the bar or above it.',
initial: false,
);
final knobInitialContentHeight = context.knobs
.sliderInt(
Expand All @@ -104,20 +101,13 @@ class _PlayWithParametersStoryState extends State<PlayWithParametersStory> {
.toDouble();

// Sliver settings.
final knobPinned = context.knobs.boolean(
label: 'Pinned',
initial: true,
);
final knobFloating = context.knobs.boolean(
label: 'Floating',
initial: false,
);
final knobPinned = context.knobs.boolean(label: 'Pinned', initial: true);
final knobFloating = context.knobs.boolean(label: 'Floating');

// Leading actions.
final knobCollapseLeadingActions = context.knobs.boolean(
label: 'Collapse leading actions',
description: 'Collapses leading actions when scrolling.',
initial: false,
);
final knobLeadingActionsPadding = context.knobs
.sliderInt(
Expand All @@ -131,7 +121,6 @@ class _PlayWithParametersStoryState extends State<PlayWithParametersStory> {
final knobCollapseTrailingActions = context.knobs.boolean(
label: 'Collapse trailing actions',
description: 'Collapses trailing actions when scrolling.',
initial: false,
);
final knobTrailingActionsPadding = context.knobs
.sliderInt(
Expand All @@ -145,7 +134,6 @@ class _PlayWithParametersStoryState extends State<PlayWithParametersStory> {
final knobDebug = context.knobs.boolean(
label: 'Debug',
description: 'Shows background color for each section - bar, content, leading and trailing actions, whole, ...',
initial: false,
);

// Content customization.
Expand Down Expand Up @@ -186,7 +174,13 @@ class _PlayWithParametersStoryState extends State<PlayWithParametersStory> {
stretchTriggerOffset: 100,
onStretchTrigger: _onStretchCallback,
),
contentBuilder: (context, expandRatio, contentHeight, centerPadding, overlapsContent) {
contentBuilder: (
context,
expandRatio,
contentHeight,
centerPadding,
overlapsContent,
) {
return Stack(
children: [
// All height image that fades away on scroll.
Expand All @@ -200,8 +194,9 @@ class _PlayWithParametersStoryState extends State<PlayWithParametersStory> {
width: double.infinity,
fit: BoxFit.cover,
alignment: Alignment.topCenter,
image:
const NetworkImage('https://flutter.github.io/assets-for-api-docs/assets/widgets/owl.jpg'),
image: const NetworkImage(
'https://flutter.github.io/assets-for-api-docs/assets/widgets/owl.jpg',
),
),
),
),
Expand All @@ -210,7 +205,9 @@ class _PlayWithParametersStoryState extends State<PlayWithParametersStory> {
Container(
alignment: Alignment.centerLeft,
height: contentHeight,
padding: centerPadding.copyWith(left: 10 + (1 - expandRatio) * 40),
padding: centerPadding.copyWith(
left: 10 + (1 - expandRatio) * 40,
),
child: Text(
knobText,
style: TextStyle(
Expand All @@ -219,7 +216,12 @@ class _PlayWithParametersStoryState extends State<PlayWithParametersStory> {
fontWeight: FontWeight.bold,
shadows: [
Shadow(
color: Color.lerp(Colors.black, Colors.transparent, 1 - expandRatio) ?? Colors.transparent,
color: Color.lerp(
Colors.black,
Colors.transparent,
1 - expandRatio,
) ??
Colors.transparent,
blurRadius: 10,
offset: const Offset(4, 2),
),
Expand Down Expand Up @@ -256,7 +258,14 @@ class _PlayWithParametersStoryState extends State<PlayWithParametersStory> {
child: Opacity(
opacity: Tween<double>(begin: 1, end: 0).transform((expandRatio * 2).clamp(0.0, 1.0)),
child: IconButton(
icon: Icon(Icons.lightbulb, color: Color.lerp(Colors.yellow, Colors.red, expandRatio)),
icon: Icon(
Icons.lightbulb,
color: Color.lerp(
Colors.yellow,
Colors.red,
expandRatio,
),
),
onPressed: () {},
),
),
Expand All @@ -270,7 +279,10 @@ class _PlayWithParametersStoryState extends State<PlayWithParametersStory> {
for (int i = 0; i < 100; i++)
Container(
margin: const EdgeInsets.only(top: 40),
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 40),
padding: const EdgeInsets.symmetric(
vertical: 20,
horizontal: 40,
),
color: i.isEven ? Colors.blue.shade200 : Colors.black12,
child: Text(i.toString()),
),
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
netglade_analysis: 1.1.2
netglade_analysis: ^5.0.0

flutter:
uses-material-design: true
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
netglade_analysis: ^4.0.0
netglade_analysis: ^5.0.0

0 comments on commit b8d1137

Please sign in to comment.