mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-05-31 08:08:19 +08:00
feat: 侧边栏适配异形屏、分区子侧栏内边距优化
This commit is contained in:
@@ -39,10 +39,9 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
_mainController.pageController =
|
_mainController.pageController =
|
||||||
PageController(initialPage: _mainController.selectedIndex);
|
PageController(initialPage: _mainController.selectedIndex);
|
||||||
enableMYBar = setting.get(SettingBoxKey.enableMYBar, defaultValue: true);
|
enableMYBar = setting.get(SettingBoxKey.enableMYBar, defaultValue: true);
|
||||||
useSideBar =
|
useSideBar = setting.get(SettingBoxKey.useSideBar, defaultValue: false);
|
||||||
setting.get(SettingBoxKey.useSideBar, defaultValue: false);
|
enableGradientBg =
|
||||||
enableGradientBg = setting.get(SettingBoxKey.enableGradientBg,
|
setting.get(SettingBoxKey.enableGradientBg, defaultValue: true);
|
||||||
defaultValue: true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setIndex(int value) async {
|
void setIndex(int value) async {
|
||||||
@@ -152,7 +151,7 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
children: [
|
children: [
|
||||||
if (useSideBar) ...[
|
if (useSideBar) ...[
|
||||||
SizedBox(
|
SizedBox(
|
||||||
width: 55,
|
width: 55 + MediaQuery.of(context).padding.left,
|
||||||
child: NavigationRail(
|
child: NavigationRail(
|
||||||
groupAlignment: 0.0,
|
groupAlignment: 0.0,
|
||||||
minWidth: 40.0,
|
minWidth: 40.0,
|
||||||
@@ -170,8 +169,11 @@ class _MainAppState extends State<MainApp> with SingleTickerProviderStateMixin {
|
|||||||
DynamicBadgeMode.number
|
DynamicBadgeMode.number
|
||||||
? Text(e['count'].toString())
|
? Text(e['count'].toString())
|
||||||
: null,
|
: null,
|
||||||
padding:
|
padding: EdgeInsets.fromLTRB(
|
||||||
const EdgeInsets.fromLTRB(2, 0, 2, 0),
|
2 + MediaQuery.of(context).padding.left,
|
||||||
|
0,
|
||||||
|
2,
|
||||||
|
0),
|
||||||
isLabelVisible:
|
isLabelVisible:
|
||||||
_mainController.dynamicBadgeType !=
|
_mainController.dynamicBadgeType !=
|
||||||
DynamicBadgeMode.hidden &&
|
DynamicBadgeMode.hidden &&
|
||||||
|
|||||||
@@ -88,33 +88,44 @@ class _RankPageState extends State<RankPage>
|
|||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: BoxConstraints(minHeight: constraint.maxHeight),
|
constraints: BoxConstraints(minHeight: constraint.maxHeight),
|
||||||
child: IntrinsicHeight(
|
child: IntrinsicHeight(
|
||||||
child: NavigationRail(
|
child: MediaQuery.removePadding(
|
||||||
backgroundColor: Colors.transparent,
|
context: context,
|
||||||
minWidth: 50.0,
|
removeLeft: true,
|
||||||
// elevation: 0,
|
removeRight: true,
|
||||||
selectedIndex: _selectedTabIndex,
|
removeTop: true,
|
||||||
onDestinationSelected: (int index) {
|
child: NavigationRail(
|
||||||
feedBack();
|
groupAlignment: -1.0,
|
||||||
if (_selectedTabIndex == index) {
|
backgroundColor: Colors.transparent,
|
||||||
_rankController.tabsCtrList[index]().animateToTop();
|
minWidth: 40.0,
|
||||||
} else {
|
useIndicator: false,
|
||||||
setState(() {
|
// elevation: 0,
|
||||||
_rankController.tabController.index = index;
|
selectedIndex: _selectedTabIndex,
|
||||||
_selectedTabIndex = index;
|
onDestinationSelected: (int index) {
|
||||||
});
|
feedBack();
|
||||||
}
|
if (_selectedTabIndex == index) {
|
||||||
},
|
_rankController.tabsCtrList[index]()
|
||||||
labelType: NavigationRailLabelType.none,
|
.animateToTop();
|
||||||
destinations: [
|
} else {
|
||||||
for (var tab in _rankController.tabs)
|
setState(() {
|
||||||
NavigationRailDestination(
|
_rankController.tabController.index = index;
|
||||||
icon: Text(tab['label']),
|
_selectedTabIndex = index;
|
||||||
// selectedIcon: Text(tab['label']),
|
});
|
||||||
label: const SizedBox.shrink(),
|
}
|
||||||
),
|
},
|
||||||
],
|
labelType: NavigationRailLabelType.none,
|
||||||
trailing: const SizedBox(height: 100),
|
destinations: [
|
||||||
))));
|
for (var tab in _rankController.tabs)
|
||||||
|
NavigationRailDestination(
|
||||||
|
icon: Padding(
|
||||||
|
padding: const EdgeInsets.symmetric(
|
||||||
|
vertical: 4),
|
||||||
|
child: Text(tab['label'])),
|
||||||
|
// selectedIcon: Text(tab['label']),
|
||||||
|
label: const SizedBox.shrink(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
trailing: const SizedBox(height: 100),
|
||||||
|
)))));
|
||||||
}),
|
}),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TabBarView(
|
child: TabBarView(
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ class _ZonePageState extends State<ZonePage>
|
|||||||
SliverPadding(
|
SliverPadding(
|
||||||
// 单列布局 EdgeInsets.zero
|
// 单列布局 EdgeInsets.zero
|
||||||
padding:
|
padding:
|
||||||
const EdgeInsets.fromLTRB(StyleString.safeSpace, StyleString.safeSpace, 0, 0),
|
const EdgeInsets.fromLTRB(StyleString.cardSpace, StyleString.safeSpace, 0, 0),
|
||||||
sliver: FutureBuilder(
|
sliver: FutureBuilder(
|
||||||
future: _futureBuilderFuture,
|
future: _futureBuilderFuture,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
|
|||||||
Reference in New Issue
Block a user