Skip to content

Commit

Permalink
fix: Add centerTitleOnAppBar.
Browse files Browse the repository at this point in the history
  • Loading branch information
mathrunet committed Mar 1, 2023
1 parent dfc0196 commit 938d2bc
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 81 deletions.
32 changes: 16 additions & 16 deletions packages/katana_theme/example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: "0c80aeab9bc807ab10022cd3b2f4cf2ecdf231949dc1ddd9442406a003f19201"
sha256: e440ac42679dfc04bbbefb58ed225c994bc7e07fccc8a68ec7d3631a127e5da9
url: "https://pub.dev"
source: hosted
version: "52.0.0"
version: "54.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: cd8ee83568a77f3ae6b913a36093a1c9b1264e7cb7f834d9ddd2311dade9c1f4
sha256: "2c2e3721ee9fb36de92faa060f3480c81b23e904352b087e5c64224b1a044427"
url: "https://pub.dev"
source: hosted
version: "5.4.0"
version: "5.6.0"
args:
dependency: transitive
description:
name: args
sha256: "139d809800a412ebb26a3892da228b2d0ba36f0ef5d9a82166e5e52ec8d61611"
sha256: "4cab82a83ffef80b262ddedf47a0a8e56ee6fbf7fe21e6e768b02792034dd440"
url: "https://pub.dev"
source: hosted
version: "2.3.2"
version: "2.4.0"
asn1lib:
dependency: transitive
description:
Expand Down Expand Up @@ -69,18 +69,18 @@ packages:
dependency: transitive
description:
name: build_daemon
sha256: "6bc5544ea6ce4428266e7ea680e945c68806c4aae2da0eb5e9ccf38df8d6acbf"
sha256: "757153e5d9cd88253cb13f28c2fb55a537dc31fefd98137549895b5beb7c6169"
url: "https://pub.dev"
source: hosted
version: "3.1.0"
version: "3.1.1"
build_resolvers:
dependency: transitive
description:
name: build_resolvers
sha256: "7c35a3a7868626257d8aee47b51c26b9dba11eaddf3431117ed2744951416aab"
sha256: db49b8609ef8c81cca2b310618c3017c00f03a92af44c04d310b907b2d692d95
url: "https://pub.dev"
source: hosted
version: "2.1.0"
version: "2.2.0"
build_runner:
dependency: "direct dev"
description:
Expand Down Expand Up @@ -345,7 +345,7 @@ packages:
path: ".."
relative: true
source: path
version: "1.3.1"
version: "1.3.2"
katana_theme_annotation:
dependency: transitive
description:
Expand Down Expand Up @@ -477,10 +477,10 @@ packages:
dependency: transitive
description:
name: pubspec_parse
sha256: "75f6614d6dde2dc68948dffbaa4fe5dae32cd700eb9fb763fe11dfb45a3c4d0a"
sha256: ec85d7d55339d85f44ec2b682a82fea340071e8978257e5a43e69f79e98ef50c
url: "https://pub.dev"
source: hosted
version: "1.2.1"
version: "1.2.2"
recase:
dependency: transitive
description:
Expand Down Expand Up @@ -594,10 +594,10 @@ packages:
dependency: transitive
description:
name: tint
sha256: d856019547532d4ea24171f554b319081c004c37741e7946eae30cb09f24e1c7
sha256: "9652d9a589f4536d5e392cf790263d120474f15da3cf1bee7f1fdb31b4de5f46"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
version: "2.0.1"
typed_data:
dependency: transitive
description:
Expand Down Expand Up @@ -655,5 +655,5 @@ packages:
source: hosted
version: "3.1.1"
sdks:
dart: ">=2.19.0 <4.0.0"
dart: ">=2.19.0 <3.0.0"
flutter: ">=2.11.0-0.1.pre"
14 changes: 14 additions & 0 deletions packages/katana_theme/lib/src/app_theme_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ class AppThemeData {
String? defaultFontFamily,
this.useMaterial3 = true,
this.platform = TargetPlatform.iOS,
this.centerTitleOnAppBar,
Brightness brightness = Brightness.light,
}) : color = ColorThemeData._(
brightness: brightness,
Expand Down Expand Up @@ -352,6 +353,7 @@ class AppThemeData {
String? defaultFontFamily,
this.useMaterial3 = true,
this.platform = TargetPlatform.iOS,
this.centerTitleOnAppBar,
}) : color = ColorThemeData._(
brightness: Brightness.light,
primary: primary,
Expand Down Expand Up @@ -539,6 +541,7 @@ class AppThemeData {
String? defaultFontFamily,
this.useMaterial3 = true,
this.platform = TargetPlatform.iOS,
this.centerTitleOnAppBar,
}) : color = ColorThemeData._(
brightness: Brightness.dark,
primary: primary,
Expand Down Expand Up @@ -699,6 +702,15 @@ class AppThemeData {
/// このプラットフォームに合わせたデザインになります。
final TargetPlatform platform;

/// Specify whether to center the title of [AppBar].
///
/// If `true`, it will be centered, if `false`, it will be left-aligned, and if [null], it will be default alignment for the platform.
///
/// [AppBar]のタイトルを中央寄せするかどうかを指定します。
///
/// `true`の場合中央寄せ、`false`の場合左寄せ、[Null]の場合はプラットフォームに合わせたデフォルトの寄せ方になります。
final bool? centerTitleOnAppBar;

/// Get [AppThemeData] placed on the widget tree.
///
/// ウィジェットツリー上に配置されている[AppThemeData]を取得します。
Expand Down Expand Up @@ -808,6 +820,7 @@ class AppThemeData {
fontSizeDelta: text.fontSizeDelta,
),
appBarTheme: theme.appBarTheme.copyWith(
centerTitle: centerTitleOnAppBar,
backgroundColor: color.appBarColor,
elevation: color.appBarColor == Colors.transparent ? 0 : null,
foregroundColor: appBarForegroundColor,
Expand Down Expand Up @@ -948,6 +961,7 @@ class AppThemeData {
canvasColor: color.canvas,
scaffoldBackgroundColor: color.scaffoldBackgroundColor,
appBarTheme: theme.appBarTheme.copyWith(
centerTitle: centerTitleOnAppBar,
backgroundColor: color.appBarColor,
elevation: color.appBarColor == Colors.transparent ? 0 : null,
foregroundColor: appBarForegroundColor,
Expand Down
42 changes: 21 additions & 21 deletions packages/katana_theme/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: "0c80aeab9bc807ab10022cd3b2f4cf2ecdf231949dc1ddd9442406a003f19201"
sha256: e440ac42679dfc04bbbefb58ed225c994bc7e07fccc8a68ec7d3631a127e5da9
url: "https://pub.dev"
source: hosted
version: "52.0.0"
version: "54.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
sha256: cd8ee83568a77f3ae6b913a36093a1c9b1264e7cb7f834d9ddd2311dade9c1f4
sha256: "2c2e3721ee9fb36de92faa060f3480c81b23e904352b087e5c64224b1a044427"
url: "https://pub.dev"
source: hosted
version: "5.4.0"
version: "5.6.0"
args:
dependency: transitive
description:
name: args
sha256: "139d809800a412ebb26a3892da228b2d0ba36f0ef5d9a82166e5e52ec8d61611"
sha256: "4cab82a83ffef80b262ddedf47a0a8e56ee6fbf7fe21e6e768b02792034dd440"
url: "https://pub.dev"
source: hosted
version: "2.3.2"
version: "2.4.0"
asn1lib:
dependency: transitive
description:
Expand Down Expand Up @@ -85,10 +85,10 @@ packages:
dependency: transitive
description:
name: coverage
sha256: "961c4aebd27917269b1896382c7cb1b1ba81629ba669ba09c27a7e5710ec9040"
sha256: "2fb815080e44a09b85e0f2ca8a820b15053982b2e714b59267719e8a9ff17097"
url: "https://pub.dev"
source: hosted
version: "1.6.2"
version: "1.6.3"
crypto:
dependency: transitive
description:
Expand Down Expand Up @@ -266,10 +266,10 @@ packages:
dependency: transitive
description:
name: node_preamble
sha256: "8ebdbaa3b96d5285d068f80772390d27c21e1fa10fb2df6627b1b9415043608d"
sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
version: "2.0.2"
package_config:
dependency: transitive
description:
Expand Down Expand Up @@ -367,10 +367,10 @@ packages:
dependency: transitive
description:
name: source_maps
sha256: "490098075234dcedb83c5d949b4c93dad5e6b7702748de000be2b57b8e6b2427"
sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703"
url: "https://pub.dev"
source: hosted
version: "0.10.11"
version: "0.10.12"
source_span:
dependency: transitive
description:
Expand Down Expand Up @@ -423,10 +423,10 @@ packages:
dependency: "direct dev"
description:
name: test
sha256: b54d427664c00f2013ffb87797a698883c46aee9288e027a50b46eaee7486fa2
sha256: "5301f54eb6fe945daa99bc8df6ece3f88b5ceaa6f996f250efdaaf63e22886be"
url: "https://pub.dev"
source: hosted
version: "1.22.2"
version: "1.23.1"
test_api:
dependency: transitive
description:
Expand All @@ -439,18 +439,18 @@ packages:
dependency: transitive
description:
name: test_core
sha256: "95ecc12692d0dd59080ab2d38d9cf32c7e9844caba23ff6cd285690398ee8ef4"
sha256: d2e9240594b409565524802b84b7b39341da36dd6fd8e1660b53ad928ec3e9af
url: "https://pub.dev"
source: hosted
version: "0.4.22"
version: "0.4.24"
tint:
dependency: transitive
description:
name: tint
sha256: d856019547532d4ea24171f554b319081c004c37741e7946eae30cb09f24e1c7
sha256: "9652d9a589f4536d5e392cf790263d120474f15da3cf1bee7f1fdb31b4de5f46"
url: "https://pub.dev"
source: hosted
version: "2.0.0"
version: "2.0.1"
typed_data:
dependency: transitive
description:
Expand Down Expand Up @@ -479,10 +479,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: "2277c73618916ae3c2082b6df67b6ebb64b4c69d9bf23b23700707952ac30e60"
sha256: eb3cf3f45fc1500ae30481ac9ab788302fa5e8edc3f3eaddf183945ee93a8bf3
url: "https://pub.dev"
source: hosted
version: "10.1.2"
version: "11.2.0"
watcher:
dependency: transitive
description:
Expand Down Expand Up @@ -516,5 +516,5 @@ packages:
source: hosted
version: "3.1.1"
sdks:
dart: ">=2.18.0 <4.0.0"
dart: ">=2.18.0 <3.0.0"
flutter: ">=2.0.0"
Loading

0 comments on commit 938d2bc

Please sign in to comment.