feat: 搜索页的数据,缺省页
This commit is contained in:
1 parent
9b0fe51fa4
commit
b5bce6edcf
18 files changed
+1101
-171
No files matched your search
+61
-47
@@ -21,47 +21,51 @@ class RootPage extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _RootPageState extends State<RootPage> {
|
||||
|
||||
final _pageController = PageController();
|
||||
final List<Widget> _pages = [
|
||||
NovyKeepAlive(child: FirstPage()),
|
||||
NovyKeepAlive(child: PlayPage()),
|
||||
CollectionPage(),
|
||||
NovyKeepAlive(child: MyPage()),
|
||||
];
|
||||
int _currentIndex = 0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final pages = [
|
||||
NovyKeepAlive(child: FirstPage()),
|
||||
NovyKeepAlive(child: PlayPage(isActive: _currentIndex == 1)),
|
||||
CollectionPage(),
|
||||
NovyKeepAlive(child: MyPage()),
|
||||
];
|
||||
|
||||
return Scaffold(
|
||||
body: Stack(
|
||||
children: [
|
||||
PageView(
|
||||
physics: const NeverScrollableScrollPhysics(),
|
||||
controller: _pageController,
|
||||
children: _pages,
|
||||
children: pages,
|
||||
),
|
||||
Positioned(
|
||||
left: 0, right: 0, bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
bottom: 0,
|
||||
child: SafeArea(
|
||||
top: false,
|
||||
child: AppBottomView(
|
||||
onSelectedIndex: (index) {
|
||||
setState(() {
|
||||
_currentIndex = index;
|
||||
});
|
||||
_pageController.jumpToPage(index);
|
||||
},
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 底部tabbar
|
||||
class AppBottomView extends StatefulWidget {
|
||||
const AppBottomView({super.key,
|
||||
required this.onSelectedIndex,
|
||||
});
|
||||
const AppBottomView({super.key, required this.onSelectedIndex});
|
||||
|
||||
final Function(int) onSelectedIndex;
|
||||
|
||||
@@ -72,14 +76,17 @@ class AppBottomView extends StatefulWidget {
|
||||
}
|
||||
|
||||
class _AppBottomViewState extends State<AppBottomView> {
|
||||
|
||||
final List<String> _unselectedIcons = [
|
||||
ConstImage.btHomeUnsel, ConstImage.btPlayUnsel,
|
||||
ConstImage.btCollectUnsel, ConstImage.btMineUnsel
|
||||
ConstImage.btHomeUnsel,
|
||||
ConstImage.btPlayUnsel,
|
||||
ConstImage.btCollectUnsel,
|
||||
ConstImage.btMineUnsel,
|
||||
];
|
||||
final List<String> _selectedIcons = [
|
||||
ConstImage.btHomeSel, ConstImage.btPlaySel,
|
||||
ConstImage.btCollectSel, ConstImage.btMineSel
|
||||
ConstImage.btHomeSel,
|
||||
ConstImage.btPlaySel,
|
||||
ConstImage.btCollectSel,
|
||||
ConstImage.btMineSel,
|
||||
];
|
||||
final List<String> _titles = ['Home', 'Play', 'Collect', 'Me'];
|
||||
int _currentIndex = 0;
|
||||
@@ -92,38 +99,45 @@ class _AppBottomViewState extends State<AppBottomView> {
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Stack(
|
||||
children: [
|
||||
Opacity(opacity: 0.9,
|
||||
child: ImageFiltered(imageFilter: ImageFilter.blur(sigmaX: 1),
|
||||
child: HelpImage.asset(ConstImage.appBottom,
|
||||
width: AppScreen.screenWidth-32, height: _height,
|
||||
Opacity(
|
||||
opacity: 0.9,
|
||||
child: ImageFiltered(
|
||||
imageFilter: ImageFilter.blur(sigmaX: 1),
|
||||
child: HelpImage.asset(
|
||||
ConstImage.appBottom,
|
||||
width: AppScreen.screenWidth - 32,
|
||||
height: _height,
|
||||
fit: BoxFit.fill,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Positioned.fill(
|
||||
child: Padding(padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: List.generate(_unselectedIcons.length, (index) {
|
||||
return _buildTabItem(_titles[index], index, onTap: () {
|
||||
setState(() {
|
||||
_currentIndex = index;
|
||||
});
|
||||
widget.onSelectedIndex(index);
|
||||
|
||||
});
|
||||
return _buildTabItem(
|
||||
_titles[index],
|
||||
index,
|
||||
onTap: () {
|
||||
setState(() {
|
||||
_currentIndex = index;
|
||||
});
|
||||
widget.onSelectedIndex(index);
|
||||
},
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
_aaaa(){
|
||||
|
||||
_aaaa() {
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
child: BackdropFilter(
|
||||
@@ -131,10 +145,7 @@ class _AppBottomViewState extends State<AppBottomView> {
|
||||
child: Container(
|
||||
color: Colors.white.withOpacity(0.1),
|
||||
child: const Center(
|
||||
child: Text(
|
||||
'毛玻璃效果',
|
||||
style: TextStyle(color: Colors.white),
|
||||
),
|
||||
child: Text('毛玻璃效果', style: TextStyle(color: Colors.white)),
|
||||
),
|
||||
),
|
||||
),
|
||||
@@ -142,20 +153,23 @@ class _AppBottomViewState extends State<AppBottomView> {
|
||||
}
|
||||
|
||||
Widget _buildTabItem(String title, int index, {required Function() onTap}) {
|
||||
String icon = _currentIndex == index ? _selectedIcons[index] : _unselectedIcons[index];
|
||||
Color tcolor = _currentIndex == index ? ConstColor.btGreen : ConstColor.btWhite;
|
||||
String icon = _currentIndex == index
|
||||
? _selectedIcons[index]
|
||||
: _unselectedIcons[index];
|
||||
Color tcolor = _currentIndex == index
|
||||
? ConstColor.btGreen
|
||||
: ConstColor.btWhite;
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
width: 60, height: 70,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
|
||||
width: 60,
|
||||
height: 70,
|
||||
child: Column(
|
||||
children: [
|
||||
HelpImage.asset(icon, width: 32, height: 32),
|
||||
const SizedBox(height: 2),
|
||||
NovyText(title, fontSize: 11,
|
||||
color: tcolor,
|
||||
)
|
||||
NovyText(title, fontSize: 11, color: tcolor),
|
||||
],
|
||||
)
|
||||
),
|
||||
).addInkWell(onTap: onTap);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user