feat: add elevation and centerTitle to ThreadHeader and ChannelListHeader

This commit is contained in:
S-ecki
2022-03-09 17:18:09 +01:00
parent 00d2948930
commit a7eaee29d6
3 changed files with 21 additions and 25 deletions
@@ -170,7 +170,7 @@ class ChannelHeader extends StatelessWidget implements PreferredSizeWidget {
),
),
],
centerTitle: _getEffectiveCenterTitle(theme),
centerTitle: centerTitle,
title: InkWell(
onTap: onTitleTap,
child: SizedBox(
@@ -202,24 +202,4 @@ class ChannelHeader extends StatelessWidget implements PreferredSizeWidget {
@override
final Size preferredSize;
/// Returns the effective center title for the current theme and platform.
///
/// This code is aligned with the [AppBar]'s [AppBar.centerTitle].
bool _getEffectiveCenterTitle(ThemeData theme) {
if (centerTitle != null) return centerTitle!;
if (theme.appBarTheme.centerTitle != null) {
return theme.appBarTheme.centerTitle!;
}
switch (theme.platform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
return false;
case TargetPlatform.iOS:
case TargetPlatform.macOS:
return actions == null || actions!.length < 2;
}
}
}