opt: appbar theme

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2024-11-21 17:08:52 +08:00
parent 37ddebca50
commit 5b2a4fa681
46 changed files with 51 additions and 248 deletions

View File

@@ -160,10 +160,12 @@ class MyApp extends StatelessWidget {
// showSemanticsDebugger: true,
title: 'PiliPalaX',
theme: _getThemeData(
context: context,
colorScheme: lightColorScheme,
isDynamic: lightDynamic != null && isDynamicColor,
),
darkTheme: _getThemeData(
context: context,
colorScheme: darkColorScheme,
isDynamic: darkDynamic != null && isDynamicColor,
),
@@ -199,6 +201,7 @@ class MyApp extends StatelessWidget {
}
ThemeData _getThemeData({
required BuildContext context,
required ColorScheme colorScheme,
required bool isDynamic,
}) {
@@ -207,6 +210,14 @@ class MyApp extends StatelessWidget {
return ThemeData(
colorScheme: colorScheme,
useMaterial3: true,
appBarTheme: AppBarTheme(
elevation: 0,
titleSpacing: 0,
centerTitle: false,
scrolledUnderElevation: 0,
backgroundColor: Platform.isIOS ? colorScheme.surface : null,
titleTextStyle: Theme.of(context).textTheme.titleMedium,
),
navigationBarTheme: NavigationBarThemeData(
surfaceTintColor: surfaceTintColor,
),

View File

@@ -44,9 +44,7 @@ class _AboutPageState extends State<AboutPage> {
TextStyle subTitleStyle =
TextStyle(fontSize: 13, color: Theme.of(context).colorScheme.outline);
return Scaffold(
appBar: AppBar(
title: Text('关于', style: Theme.of(context).textTheme.titleMedium),
),
appBar: AppBar(title: Text('关于')),
body: ListView(
children: [
ConstrainedBox(

View File

@@ -51,15 +51,8 @@ class _BlackListPageState extends State<BlackListPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 0,
titleSpacing: 0,
centerTitle: false,
title: Obx(
() => Text(
'黑名单管理: ${_blackListController.total.value}',
style: Theme.of(context).textTheme.titleMedium,
),
() => Text('黑名单管理: ${_blackListController.total.value}'),
),
),
body: refreshIndicator(

View File

@@ -112,14 +112,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
Get.to(
() => Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Text(
'评论详情',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: Text('评论详情')),
body: VideoReplyReplyPanel(
id: id,
oid: oid,
@@ -192,11 +185,6 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 0,
backgroundColor: Theme.of(context).colorScheme.surface,
centerTitle: false,
titleSpacing: 0,
title: StreamBuilder(
stream: titleStreamC.stream,
initialData: false,
@@ -322,15 +310,7 @@ class _DynamicDetailPageState extends State<DynamicDetailPage>
return SliverPersistentHeader(
delegate: _MySliverPersistentHeaderDelegate(
child: Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
border: Border(
top: BorderSide(
width: 0.6,
color: Theme.of(context).dividerColor.withOpacity(0.05),
),
),
),
color: Theme.of(context).colorScheme.surface,
height: 45,
padding: const EdgeInsets.only(left: 12, right: 6),
child: Row(

View File

@@ -49,13 +49,8 @@ class _FansPageState extends State<FansPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 0,
centerTitle: false,
titleSpacing: 0,
title: Text(
_fansController.isOwner.value ? '我的粉丝' : '${_fansController.name}的粉丝',
style: Theme.of(context).textTheme.titleMedium,
),
),
body: refreshIndicator(

View File

@@ -48,12 +48,7 @@ class _FavPageState extends State<FavPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'我的收藏',
style: Theme.of(context).textTheme.titleMedium,
),
title: Text('我的收藏'),
actions: [
IconButton(
onPressed: () {

View File

@@ -71,7 +71,6 @@ class _FavDetailPageState extends State<FavDetailPage> {
SliverAppBar(
expandedHeight: 220 - MediaQuery.of(context).padding.top,
pinned: true,
titleSpacing: 0,
title: StreamBuilder(
stream: titleStreamC.stream,
initialData: false,

View File

@@ -48,8 +48,8 @@ class _FavSearchPageState extends State<FavSearchPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
titleSpacing: 0,
actions: [
IconButton(
tooltip: '搜索',

View File

@@ -27,15 +27,10 @@ class _FollowPageState extends State<FollowPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 0,
titleSpacing: 0,
centerTitle: false,
title: Text(
_followController.isOwner.value
? '我的关注'
: '${_followController.name}的关注',
style: Theme.of(context).textTheme.titleMedium,
),
actions: [
IconButton(

View File

@@ -73,12 +73,7 @@ class _HistoryPageState extends State<HistoryPage> {
appBar: AppBarWidget(
visible: _historyController.enableMultiple.value,
child1: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Text(
'观看记录',
style: Theme.of(context).textTheme.titleMedium,
),
title: Text('观看记录'),
actions: [
IconButton(
tooltip: '搜索',
@@ -134,8 +129,6 @@ class _HistoryPageState extends State<HistoryPage> {
],
),
child2: AppBar(
titleSpacing: 0,
centerTitle: false,
leading: IconButton(
tooltip: '取消',
onPressed: () {
@@ -151,7 +144,6 @@ class _HistoryPageState extends State<HistoryPage> {
title: Obx(
() => Text(
'已选择${_historyController.checkedCount.value}',
style: Theme.of(context).textTheme.titleMedium,
),
),
actions: [

View File

@@ -40,7 +40,7 @@ class _HomePageState extends State<HomePage>
: Brightness.light,
));
return Scaffold(
appBar: AppBar(toolbarHeight: 0, elevation: 0),
appBar: AppBar(toolbarHeight: 0),
body: Column(
children: [
if (!_homeController.useSideBar)

View File

@@ -16,7 +16,6 @@ class HomeAppBar extends StatelessWidget {
dynamic userInfo = userInfoCache.get('userInfoCache');
return SliverAppBar(
// forceElevated: true,
scrolledUnderElevation: 0,
toolbarHeight: MediaQuery.of(context).padding.top,
expandedHeight: kToolbarHeight + MediaQuery.of(context).padding.top,
automaticallyImplyLeading: false,
@@ -29,7 +28,6 @@ class HomeAppBar extends StatelessWidget {
background: Column(
children: [
AppBar(
centerTitle: false,
title: const Text(
'PiLiPaLa',
style: TextStyle(
@@ -95,8 +93,6 @@ class HomeAppBar extends StatelessWidget {
const SizedBox(width: 10)
],
elevation: 0,
scrolledUnderElevation: 0,
),
],
),

View File

@@ -115,12 +115,7 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
() => Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Text(
'评论详情',
style: Theme.of(context).textTheme.titleMedium,
),
title: Text('评论详情'),
),
body: VideoReplyReplyPanel(
id: id,
@@ -138,12 +133,7 @@ class _HtmlRenderPageState extends State<HtmlRenderPage>
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
title,
style: Theme.of(context).textTheme.titleMedium,
),
title: Text(title),
actions: [
const SizedBox(width: 4),
IconButton(

View File

@@ -24,12 +24,9 @@ class _LaterPageState extends State<LaterPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Obx(
() => Text(
'稍后再看${_laterController.count.value == -1 ? '' : ' (${_laterController.count.value})'}',
style: Theme.of(context).textTheme.titleMedium,
),
),
actions: [

View File

@@ -203,8 +203,6 @@ class _LiveRoomPageState extends State<LiveRoomPage>
Column(
children: [
AppBar(
centerTitle: false,
titleSpacing: 0,
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
toolbarHeight:

View File

@@ -45,10 +45,7 @@ class _BottomControlState extends State<BottomControl> {
return AppBar(
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
elevation: 0,
scrolledUnderElevation: 0,
primary: false,
centerTitle: false,
automaticallyImplyLeading: false,
titleSpacing: 14,
title: Row(

View File

@@ -191,8 +191,6 @@ class _MemberPageNewState extends State<MemberPageNew>
)
: const SizedBox.shrink()),
pinned: true,
backgroundColor: Theme.of(context).colorScheme.surface,
scrolledUnderElevation: 0,
flexibleSpace:
_buildUserInfo(_userController.loadingState.value, isV),
bottom: needTab && (_userController.tab2?.length ?? -1) > 1

View File

@@ -47,9 +47,7 @@ class _EditProfilePageState extends State<EditProfilePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('账号资料'),
),
appBar: AppBar(title: const Text('账号资料')),
body: _buildBody(_loadingState),
);
}

View File

@@ -54,9 +54,7 @@ class _MemberArchivePageState extends State<MemberArchivePage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Text('Ta的投稿', style: Theme.of(context).textTheme.titleMedium),
title: Text('Ta的投稿'),
actions: [
Obx(
() => TextButton.icon(

View File

@@ -47,12 +47,7 @@ class _MemberDynamicsPageState extends State<MemberDynamicsPage>
super.build(context);
return widget.mid == null
? Scaffold(
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title:
Text('Ta的动态', style: Theme.of(context).textTheme.titleMedium),
),
appBar: AppBar(title: Text('Ta的动态')),
body: _buildBody,
)
: _buildBody;

View File

@@ -1,5 +1,4 @@
import 'package:easy_debounce/easy_throttle.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:PiliPalaX/common/skeleton/video_card_h.dart';
@@ -53,8 +52,8 @@ class _MemberSearchPageState extends State<MemberSearchPage>
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
titleSpacing: 0,
actions: [
IconButton(
tooltip: '搜索',
@@ -86,8 +85,12 @@ class _MemberSearchPageState extends State<MemberSearchPage>
body: Obx(
() {
if (_memberSearchCtr.loadingStatus.value == 'init') {
return Center(
child: Text('搜索「${_memberSearchCtr.uname.value}」的动态、视频'),
return FractionallySizedBox(
heightFactor: 0.5,
widthFactor: 1.0,
child: Center(
child: Text('搜索「${_memberSearchCtr.uname.value}」的动态、视频'),
),
);
}
return CustomScrollView(

View File

@@ -47,11 +47,7 @@ class _MemberSeasonsPageState extends State<MemberSeasonsPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Text('Ta的专栏', style: Theme.of(context).textTheme.titleMedium),
),
appBar: AppBar(title: Text('Ta的专栏')),
body: Padding(
padding: const EdgeInsets.only(
left: StyleString.safeSpace,

View File

@@ -46,9 +46,7 @@ class _ReplyMePageState extends State<ReplyMePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('回复我的'),
),
appBar: AppBar(title: const Text('回复我的')),
body: refreshIndicator(
onRefresh: () async {
await _replyMeController.onRefresh();

View File

@@ -56,7 +56,6 @@ class _SearchPageState extends State<SearchPage> with RouteAware {
width: 1,
),
),
titleSpacing: 0,
actions: [
IconButton(
tooltip: '搜索',

View File

@@ -48,8 +48,6 @@ class _SearchResultPageState extends State<SearchResultPage>
width: 1,
),
),
titleSpacing: 0,
centerTitle: false,
title: GestureDetector(
onTap: () => Get.back(),
child: SizedBox(

View File

@@ -135,14 +135,7 @@ class _ExtraSettingState extends State<ExtraSetting> {
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline);
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'其它设置',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: Text('其它设置')),
body: ListView(
children: [
SetSwitchItem(

View File

@@ -66,10 +66,7 @@ class _ColorSelectPageState extends State<ColorSelectPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
title: const Text('选择应用主题'),
),
appBar: AppBar(title: const Text('选择应用主题')),
body: ListView(
children: [
Builder(

View File

@@ -104,9 +104,7 @@ class _LogsPageState extends State<LogsPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text('日志', style: Theme.of(context).textTheme.titleMedium),
title: Text('日志'),
actions: [
PopupMenuButton<String>(
onSelected: (String type) {

View File

@@ -201,16 +201,7 @@ class _PlaySpeedPageState extends State<PlaySpeedPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
scrolledUnderElevation: 0,
titleSpacing: 0,
centerTitle: false,
title: Text(
'倍速设置',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: Text('倍速设置')),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,

View File

@@ -52,14 +52,7 @@ class _PlaySettingState extends State<PlaySetting> {
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline);
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'播放器设置',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: Text('播放器设置')),
body: ListView(
children: [
const SetSwitchItem(

View File

@@ -38,14 +38,7 @@ class _PrivacySettingState extends State<PrivacySetting> {
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline);
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'隐私设置',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: Text('隐私设置')),
body: Column(
children: [
ListTile(

View File

@@ -55,14 +55,7 @@ class _RecommendSettingState extends State<RecommendSetting> {
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline);
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'推荐流设置',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: Text('推荐流设置')),
body: ListView(
children: [
ListTile(

View File

@@ -354,14 +354,7 @@ class _SponsorBlockPageState extends State<SponsorBlockPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'Sponsor Block',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: Text('Sponsor Block')),
body: CustomScrollView(
slivers: [
_dividerL,

View File

@@ -55,14 +55,7 @@ class _StyleSettingState extends State<StyleSetting> {
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline);
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'外观设置',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: Text('外观设置')),
body: ListView(
children: [
SetSwitchItem(

View File

@@ -54,14 +54,7 @@ class _VideoSettingState extends State<VideoSetting> {
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline);
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'音视频设置',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: Text('音视频设置')),
body: ListView(
children: [
const SetSwitchItem(

View File

@@ -14,14 +14,7 @@ class SettingPage extends StatelessWidget {
.labelMedium!
.copyWith(color: Theme.of(context).colorScheme.outline);
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'设置',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: Text('设置')),
body: ListView(
children: [
ListTile(

View File

@@ -44,14 +44,7 @@ class _SubPageState extends State<SubPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Text(
'我的订阅',
style: Theme.of(context).textTheme.titleMedium,
),
),
appBar: AppBar(title: Text('我的订阅')),
body: FutureBuilder(
future: _futureBuilderFuture,
builder: (context, snapshot) {

View File

@@ -70,7 +70,6 @@ class _SubDetailPageState extends State<SubDetailPage> {
SliverAppBar(
expandedHeight: 260 - MediaQuery.of(context).padding.top,
pinned: true,
titleSpacing: 0,
title: StreamBuilder(
stream: titleStreamC.stream,
initialData: false,

View File

@@ -51,15 +51,12 @@ class _FavPanelState extends State<FavPanel> {
top: Radius.circular(18),
),
),
centerTitle: false,
elevation: 0,
leading: IconButton(
tooltip: '关闭',
onPressed: Get.back,
icon: const Icon(Icons.close_outlined),
),
title: Text('添加到收藏夹',
style: Theme.of(context).textTheme.titleMedium),
title: Text('添加到收藏夹'),
actions: [
TextButton.icon(
onPressed: () {

View File

@@ -90,14 +90,11 @@ class _GroupPanelState extends State<GroupPanel> {
top: Radius.circular(18),
),
),
centerTitle: false,
elevation: 0,
leading: IconButton(
tooltip: '关闭',
onPressed: Get.back,
icon: const Icon(Icons.close_outlined)),
title: Text('设置关注分组',
style: Theme.of(context).textTheme.titleMedium),
title: Text('设置关注分组'),
),
Expanded(
child: Material(

View File

@@ -447,7 +447,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
: AppBar(
backgroundColor:
showStatusBarBackgroundColor ? null : Colors.black,
elevation: 0,
toolbarHeight: 0,
systemOverlayStyle: SystemUiOverlayStyle(
statusBarIconBrightness:
@@ -835,7 +834,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
: AppBar(
backgroundColor:
showStatusBarBackgroundColor ? null : Colors.black,
elevation: 0,
toolbarHeight: 0,
systemOverlayStyle: SystemUiOverlayStyle(
statusBarIconBrightness:
@@ -868,7 +866,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
: AppBar(
backgroundColor:
showStatusBarBackgroundColor ? null : Colors.black,
elevation: 0,
toolbarHeight: 0,
systemOverlayStyle: SystemUiOverlayStyle(
statusBarIconBrightness:
@@ -933,8 +930,6 @@ class _VideoDetailPageState extends State<VideoDetailPage>
child: AppBar(
primary: false,
foregroundColor: Colors.white,
elevation: 0,
scrolledUnderElevation: 0,
backgroundColor: Colors.transparent,
actions: (videoDetailController.userInfo == null)
? null

View File

@@ -33,8 +33,6 @@ class ScrollAppBar extends StatelessWidget {
padding: EdgeInsets.only(top: statusBarHeight),
child: AppBar(
primary: false,
elevation: 0,
scrolledUnderElevation: 0,
centerTitle: true,
title: TextButton(
onPressed: () => callback(),

View File

@@ -1339,12 +1339,8 @@ class _HeaderControlState extends State<HeaderControl> {
return AppBar(
backgroundColor: Colors.transparent,
foregroundColor: Colors.white,
elevation: 0,
scrolledUnderElevation: 0,
primary: false,
centerTitle: false,
automaticallyImplyLeading: false,
titleSpacing: 10,
title: Row(
children: [
SizedBox(

View File

@@ -26,13 +26,8 @@ class _WebviewPageState extends State<WebviewPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: false,
titleSpacing: 0,
title: Obx(
() => Text(
_webviewController.pageTitle.value,
style: Theme.of(context).textTheme.titleMedium,
),
() => Text(_webviewController.pageTitle.value),
),
actions: [
const SizedBox(width: 4),

View File

@@ -38,7 +38,6 @@ class _WebviewPageNewState extends State<WebviewPageNew> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
titleSpacing: 0,
title: StreamBuilder(
initialData: null,
stream: _titleStream.stream,

View File

@@ -49,12 +49,7 @@ class PiliScheme {
() => Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Text(
'评论详情',
// style: Theme.of(context).textTheme.titleMedium,
),
title: Text('评论详情'),
actions: [
IconButton(
tooltip: '前往原视频',
@@ -139,12 +134,7 @@ class PiliScheme {
() => Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Text(
'评论详情',
// style: Theme.of(context).textTheme.titleMedium,
),
title: Text('评论详情'),
actions: [
IconButton(
tooltip: '前往',
@@ -184,12 +174,7 @@ class PiliScheme {
() => Scaffold(
resizeToAvoidBottomInset: false,
appBar: AppBar(
titleSpacing: 0,
centerTitle: false,
title: Text(
'评论详情',
// style: Theme.of(context).textTheme.titleMedium,
),
title: Text('评论详情'),
actions: [
IconButton(
tooltip: '前往',