Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

69 feature request possibility to add actions to sbbheader when using specific constructors #103

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.1.0"
version: "1.2.0"
fake_async:
dependency: transitive
description:
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: "flutter_design_system_mobile_example"
description: A showcase app for the flutter design system mobile from SBB.
version: 0.1.0+0001001
version: 1.2.0
publish_to: "none"

environment:
Expand Down
16 changes: 13 additions & 3 deletions lib/src/header/sbb_header.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

import '../../design_system_flutter.dart';

Expand Down Expand Up @@ -37,6 +36,7 @@ class SBBHeader extends StatelessWidget implements PreferredSizeWidget {
String title = '',
VoidCallback? onPressed,
VoidCallback? onPressedLogo,
List<Widget>? actions,
String? logoTooltip,
bool? blockSemantics,
}) : this._(
Expand All @@ -46,6 +46,7 @@ class SBBHeader extends StatelessWidget implements PreferredSizeWidget {
useMenuButton: true,
onPressed: onPressed,
onPressedLogo: onPressedLogo,
actions: actions,
logoTooltip: logoTooltip,
blockSemantics: blockSemantics,
);
Expand All @@ -55,6 +56,7 @@ class SBBHeader extends StatelessWidget implements PreferredSizeWidget {
String title = '',
VoidCallback? onPressed,
VoidCallback? onPressedLogo,
List<Widget>? actions,
String? logoTooltip,
bool? blockSemantics,
}) : this._(
Expand All @@ -64,6 +66,7 @@ class SBBHeader extends StatelessWidget implements PreferredSizeWidget {
useBackButton: true,
onPressed: onPressed,
onPressedLogo: onPressedLogo,
actions: actions,
logoTooltip: logoTooltip,
blockSemantics: blockSemantics,
);
Expand All @@ -73,6 +76,7 @@ class SBBHeader extends StatelessWidget implements PreferredSizeWidget {
String title = '',
VoidCallback? onPressed,
VoidCallback? onPressedLogo,
List<Widget>? actions,
String? logoTooltip,
bool? blockSemantics,
}) : this._(
Expand All @@ -82,6 +86,7 @@ class SBBHeader extends StatelessWidget implements PreferredSizeWidget {
useCloseButton: true,
onPressed: onPressed,
onPressedLogo: onPressedLogo,
actions: actions,
logoTooltip: logoTooltip,
blockSemantics: blockSemantics,
);
Expand Down Expand Up @@ -139,7 +144,11 @@ class SBBHeader extends StatelessWidget implements PreferredSizeWidget {
final ModalRoute<dynamic>? parentRoute = ModalRoute.of(context);
useMenuButton = Scaffold.of(context).hasDrawer;
useBackButton = parentRoute?.canPop ?? false;
useCloseButton = useCloseButton || automaticallyImplyLeading && useBackButton && parentRoute is PageRoute<dynamic> && parentRoute.fullscreenDialog;
useCloseButton = useCloseButton ||
automaticallyImplyLeading &&
useBackButton &&
parentRoute is PageRoute<dynamic> &&
parentRoute.fullscreenDialog;
}

if (useMenuButton) {
Expand Down Expand Up @@ -200,7 +209,8 @@ class SBBHeader extends StatelessWidget implements PreferredSizeWidget {
excluding: onPressedLogo == null,
child: Container(
alignment: Alignment.centerRight,
padding: const EdgeInsets.only(right: sbbDefaultSpacing / 2),
padding:
const EdgeInsets.only(right: sbbDefaultSpacing / 2),
height: kToolbarHeight,
width: customLeadingWidth ? leadingWidth : kToolbarHeight,
child: IconButton(
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ packages:
dependency: "direct dev"
description:
name: lint
sha256: f4bd4dbaa39f4ae8836f2d1275f2f32bc68b3a8cce0a0735dd1f7a601f06682a
sha256: "77b3777e8e9adca8e942da1e835882ae3248dfa00488a2ebbdbc1f1a4aa3f4a7"
url: "https://pub.dev"
source: hosted
version: "2.1.2"
version: "2.2.0"
matcher:
dependency: transitive
description:
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: design_system_flutter
description: Design System Mobile for Flutter
version: 1.1.0
version: 1.2.0
homepage: https://mob.sbb.ch

environment:
Expand All @@ -15,7 +15,7 @@ dev_dependencies:
sdk: flutter

# https://pub.dev/packages/lint
lint: ^2.1.2
lint: ^2.2.0

# https://pub.dev/packages/golden_toolkit
golden_toolkit: ^0.15.0
Expand Down