opt: safearea

Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
bggRGjQaUbCoE
2025-04-22 13:59:08 +08:00
parent 42fa4a2fff
commit 3afdd9d3f3
12 changed files with 327 additions and 336 deletions

View File

@@ -147,17 +147,17 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
],
),
Expanded(
child: MediaQuery.removePadding(
context: context,
removeLeft:
context.orientation == Orientation.landscape,
child: TabBarView(
physics: const NeverScrollableScrollPhysics(),
children: loadingState.response!.map((item) {
if (item.episodes!.isNullOrEmpty) {
return const SizedBox.shrink();
}
return MediaQuery.removePadding(
context: context,
removeLeft: context.orientation ==
Orientation.landscape,
child: ListView.builder(
return ListView.builder(
physics:
const AlwaysScrollableScrollPhysics(),
scrollDirection: Axis.horizontal,
@@ -177,10 +177,10 @@ class _BangumiPageState extends CommonPageState<BangumiPage, BangumiController>
),
);
},
),
);
}).toList()),
),
),
],
),
);

View File

@@ -155,8 +155,7 @@ class _DynamicsPageState extends State<DynamicsPage>
labelStyle:
TabBarTheme.of(context).labelStyle?.copyWith(fontSize: 13) ??
const TextStyle(fontSize: 13),
tabs:
DynamicsType.values.map((e) => Tab(text: e.labels)).toList(),
tabs: DynamicsType.values.map((e) => Tab(text: e.labels)).toList(),
onTap: (index) {
if (!_dynamicsController.tabController.indexIsChanging) {
_dynamicsController.animateToTop();
@@ -176,14 +175,18 @@ class _DynamicsPageState extends State<DynamicsPage>
? SafeArea(child: upPanelPart())
: null,
endDrawerEnableOpenDragGesture: true,
body: Row(children: [
body: Row(
children: [
if (upPanelPosition == UpPanelPosition.leftFixed) upPanelPart(),
Expanded(
child: tabBarView(
controller: _dynamicsController.tabController,
children: _dynamicsController.tabsPageList,
)),
),
),
if (upPanelPosition == UpPanelPosition.rightFixed) upPanelPart(),
]));
],
),
);
}
}

View File

@@ -134,15 +134,13 @@ class _FavPageState extends State<FavPage> with SingleTickerProviderStateMixin {
tabs: _FavType.values.map((item) => Tab(text: item.title)).toList(),
),
),
body: tabBarView(
controller: _tabController,
children: _FavType.values
.map((item) => SafeArea(
body: SafeArea(
top: false,
bottom: false,
child: item.page,
))
.toList(),
child: tabBarView(
controller: _tabController,
children: _FavType.values.map((item) => item.page).toList(),
),
),
);
}

View File

@@ -179,13 +179,13 @@ class _HistoryPageState extends State<HistoryPage>
),
body: Obx(
() => _historyController.tabs.isNotEmpty
? Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SafeArea(
? SafeArea(
top: false,
bottom: false,
child: TabBar(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
TabBar(
controller: _historyController.tabController,
onTap: (index) {
if (_historyController
@@ -206,7 +206,6 @@ class _HistoryPageState extends State<HistoryPage>
),
],
),
),
Expanded(
child: Material(
color: Colors.transparent,
@@ -214,7 +213,8 @@ class _HistoryPageState extends State<HistoryPage>
physics: enableMultiSelect
? const NeverScrollableScrollPhysics()
: const CustomTabBarViewScrollPhysics(),
controller: _historyController.tabController,
controller:
_historyController.tabController,
children: [
_buildPage,
..._historyController.tabs.map(
@@ -225,18 +225,20 @@ class _HistoryPageState extends State<HistoryPage>
),
),
],
),
)
: _buildPage,
: SafeArea(
top: false,
bottom: false,
child: _buildPage,
),
),
),
),
);
}
Widget get _buildPage => SafeArea(
top: false,
bottom: false,
child: refreshIndicator(
Widget get _buildPage => refreshIndicator(
onRefresh: () async {
await _historyController.onRefresh();
},
@@ -247,7 +249,6 @@ class _HistoryPageState extends State<HistoryPage>
Obx(() => _buildBody(_historyController.loadingState.value)),
],
),
),
);
Widget _buildBody(LoadingState<List<HisListItem>?> loadingState) {

View File

@@ -86,12 +86,12 @@ class _LaterPageState extends State<LaterPage>
)
: const SizedBox(),
),
body: Column(
children: [
SafeArea(
body: SafeArea(
top: false,
bottom: false,
child: TabBar(
child: Column(
children: [
TabBar(
isScrollable: true,
controller: _tabController,
tabAlignment: TabAlignment.start,
@@ -110,26 +110,21 @@ class _LaterPageState extends State<LaterPage>
}
},
),
),
Expanded(
child: TabBarView(
physics: _baseCtr.enableMultiSelect.value
? const NeverScrollableScrollPhysics()
: const CustomTabBarViewScrollPhysics(),
controller: _tabController,
children: LaterViewType.values
.map((item) => SafeArea(
top: false,
bottom: false,
child: item.page,
))
.toList(),
children:
LaterViewType.values.map((item) => item.page).toList(),
),
),
],
),
),
),
),
);
}

View File

@@ -473,12 +473,15 @@ class _LoginPageState extends State<LoginPage> {
leading: IconButton(
tooltip: '关闭',
icon: const Icon(Icons.close_outlined),
onPressed: Get.back),
title: Row(children: [
onPressed: Get.back,
),
title: Row(
children: [
const Text('登录'),
if (orientation == Orientation.landscape) ...[
const Spacer(),
const Spacer(flex: 3),
Flexible(
flex: 5,
child: TabBar(
dividerHeight: 0,
tabs: const [
@@ -503,14 +506,19 @@ class _LoginPageState extends State<LoginPage> {
Tab(
child: Row(
mainAxisSize: MainAxisSize.min,
children: [Icon(Icons.cookie_outlined), Text(' Cookie')],
children: [
Icon(Icons.cookie_outlined),
Text(' Cookie')
],
),
),
],
controller: _loginPageCtr.tabController,
))
]
]),
),
)
],
],
),
bottom: orientation == Orientation.portrait
? TabBar(
tabs: const [
@@ -550,10 +558,11 @@ class _LoginPageState extends State<LoginPage> {
return SingleChildScrollView(
child: Align(
alignment: Alignment.topCenter,
child: SizedBox(
height: 500,
width: 600,
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: 600),
child: child,
)));
),
),
);
}
}

View File

@@ -173,12 +173,16 @@ class _MemberPageNewState extends State<MemberPageNew> {
];
},
body: _userController.tab2?.isNotEmpty == true
? Column(
? SafeArea(
top: false,
bottom: false,
child: Column(
children: [
if ((_userController.tab2?.length ?? 0) > 1)
_buildTab,
Expanded(child: _buildBody),
],
),
)
: Center(child: const Text('EMPTY')),
);
@@ -193,9 +197,6 @@ class _MemberPageNewState extends State<MemberPageNew> {
Widget get _buildTab => Material(
color: Theme.of(context).colorScheme.surface,
child: SafeArea(
top: false,
bottom: false,
child: TabBar(
controller: _userController.tabController,
tabs: _userController.tabs,
@@ -205,13 +206,9 @@ class _MemberPageNewState extends State<MemberPageNew> {
}
},
),
),
);
Widget get _buildBody => SafeArea(
top: false,
bottom: false,
child: tabBarView(
Widget get _buildBody => tabBarView(
controller: _userController.tabController,
children: _userController.tab2!.map((item) {
return switch (item.param!) {
@@ -235,7 +232,6 @@ class _MemberPageNewState extends State<MemberPageNew> {
_ => Center(child: Text(item.title ?? '')),
};
}).toList(),
),
);
Widget _buildAppBar({bool isV = true}) {

View File

@@ -28,10 +28,7 @@ class _SearchArchiveState extends State<SearchArchive>
@override
Widget build(BuildContext context) {
super.build(context);
return SafeArea(
top: false,
bottom: false,
child: refreshIndicator(
return refreshIndicator(
onRefresh: () async {
await widget.ctr.refreshArchive();
},
@@ -48,7 +45,6 @@ class _SearchArchiveState extends State<SearchArchive>
)
],
),
),
);
}

View File

@@ -30,10 +30,7 @@ class _SearchDynamicState extends State<SearchDynamic>
@override
Widget build(BuildContext context) {
super.build(context);
return SafeArea(
top: false,
bottom: false,
child: refreshIndicator(
return refreshIndicator(
onRefresh: () async {
await widget.ctr.refreshDynamic();
},
@@ -49,7 +46,6 @@ class _SearchDynamicState extends State<SearchDynamic>
)
],
),
),
);
}

View File

@@ -53,12 +53,12 @@ class _MemberSearchPageState extends State<MemberSearchPage> {
),
body: Obx(
() => _memberSearchCtr.hasData.value
? Column(
children: [
SafeArea(
? SafeArea(
top: false,
bottom: false,
child: TabBar(
child: Column(
children: [
TabBar(
controller: _memberSearchCtr.tabController,
tabs: [
Obx(
@@ -75,7 +75,6 @@ class _MemberSearchPageState extends State<MemberSearchPage> {
),
],
),
),
Expanded(
child: tabBarView(
controller: _memberSearchCtr.tabController,
@@ -86,6 +85,7 @@ class _MemberSearchPageState extends State<MemberSearchPage> {
),
),
],
),
)
: FractionallySizedBox(
heightFactor: 0.5,

View File

@@ -45,8 +45,6 @@ abstract class CommonSearchPanelState<
onRefresh: () async {
await controller.onRefresh();
},
child: SafeArea(
bottom: false,
child: CustomScrollView(
controller: controller.scrollController,
physics: const AlwaysScrollableScrollPhysics(),
@@ -56,7 +54,6 @@ abstract class CommonSearchPanelState<
Obx(() => _buildBody(controller.loadingState.value)),
],
),
),
);
}

View File

@@ -92,12 +92,12 @@ class _SearchResultPageState extends State<SearchResultPage>
),
),
),
body: Column(
children: [
SafeArea(
body: SafeArea(
top: false,
bottom: false,
child: SizedBox(
child: Column(
children: [
SizedBox(
width: double.infinity,
child: TabBar(
overlayColor: WidgetStateProperty.all(Colors.transparent),
@@ -145,7 +145,6 @@ class _SearchResultPageState extends State<SearchResultPage>
},
),
),
),
Expanded(
child: Material(
color: Colors.transparent,
@@ -194,6 +193,7 @@ class _SearchResultPageState extends State<SearchResultPage>
),
],
),
),
);
}
}