mod: 首页样式

This commit is contained in:
guozhigq
2023-08-12 15:17:25 +08:00
parent c0f5555654
commit 58cdcdabb5

View File

@ -53,82 +53,57 @@ class _HomePageState extends State<HomePage>
ctr: _homeController, ctr: _homeController,
callback: showUserBottonSheet, callback: showUserBottonSheet,
), ),
Container( Padding(
padding: const EdgeInsets.only(left: 12, right: 12, bottom: 4), padding: const EdgeInsets.only(left: 12, right: 12, bottom: 4),
child: Row( child: Theme(
children: [ data: ThemeData(
Expanded( splashColor: Colors.transparent, // 点击时的水波纹颜色设置为透明
child: Theme( highlightColor: Colors.transparent, // 点击时的背景高亮颜色设置为透明
data: ThemeData( ),
splashColor: Colors.transparent, // 点击时的水波纹颜色设置为透明 child: TabBar(
highlightColor: Colors.transparent, // 点击时的背景高亮颜色设置为透明 controller: _homeController.tabController,
), tabs: [
child: Padding( for (var i in _homeController.tabs) Tab(text: i['label'])
padding: const EdgeInsets.only(top: 2), ],
child: TabBar( isScrollable: true,
controller: _homeController.tabController, indicatorWeight: 0,
tabs: [ indicatorPadding: const EdgeInsets.only(
for (var i in _homeController.tabs) top: 37, left: 18, right: 18, bottom: 6),
// Tab(text: i['label']) indicatorColor: Colors.black,
Padding( indicator: BoxDecoration(
padding: const EdgeInsets.symmetric( gradient: RadialGradient(
horizontal: 0, vertical: 11), center: Alignment.centerLeft,
child: Row( radius: 20.00,
children: [ colors: [
i['icon'], Theme.of(context).colorScheme.primary,
const SizedBox(width: 4), Theme.of(context).colorScheme.background,
Text(i['label']) ],
], ),
), borderRadius: const BorderRadius.only(
), topLeft: Radius.circular(4),
], topRight: Radius.circular(2),
isScrollable: true, bottomLeft: Radius.circular(2),
indicatorWeight: 0, bottomRight: Radius.circular(4),
indicatorPadding: const EdgeInsets.symmetric(
horizontal: 4, vertical: 5),
indicator: BoxDecoration(
color: Theme.of(context)
.colorScheme
.primaryContainer
.withOpacity(0.8),
borderRadius:
const BorderRadius.all(Radius.circular(20)),
),
indicatorSize: TabBarIndicatorSize.tab,
labelColor: Theme.of(context).colorScheme.primary,
labelStyle: const TextStyle(fontSize: 13),
dividerColor: Colors.transparent,
unselectedLabelColor:
Theme.of(context).colorScheme.outline,
onTap: (value) {
feedBack();
if (_homeController.initialIndex == value) {
_homeController.tabsCtrList[value]().animateToTop();
}
_homeController.initialIndex = value;
},
),
),
), ),
), ),
SizedBox( indicatorSize: TabBarIndicatorSize.tab,
width: 30, labelColor: Theme.of(context).colorScheme.primary,
height: 30, labelStyle:
child: IconButton( const TextStyle(fontSize: 13, fontWeight: FontWeight.bold),
tooltip: '全部分类', dividerColor: Colors.transparent,
style: ButtonStyle( unselectedLabelStyle: TextStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero), color: Theme.of(context).colorScheme.outline,
), fontWeight: FontWeight.normal,
onPressed: () async {},
icon: Icon(
Icons.dataset_outlined,
color: Theme.of(context).colorScheme.outline,
size: 19,
),
),
), ),
const SizedBox(width: 14) unselectedLabelColor: Theme.of(context).colorScheme.outline,
], onTap: (value) {
feedBack();
if (_homeController.initialIndex == value) {
_homeController.tabsCtrList[value]().animateToTop();
}
_homeController.initialIndex = value;
},
),
), ),
), ),
Expanded( Expanded(
@ -174,15 +149,22 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
child: AnimatedContainer( child: AnimatedContainer(
curve: Curves.linear, curve: Curves.linear,
duration: const Duration(milliseconds: 300), duration: const Duration(milliseconds: 300),
height: snapshot.data ? 96 : MediaQuery.of(context).padding.top, height: snapshot.data
? MediaQuery.of(context).padding.top + 42
: MediaQuery.of(context).padding.top,
child: Container( child: Container(
padding: EdgeInsets.only( padding: EdgeInsets.only(
left: 14, left: 12,
right: 12, right: 12,
bottom: 4, bottom: 0,
top: MediaQuery.of(context).padding.top, top: MediaQuery.of(context).padding.top,
), ),
child: Row(children: [ child: Row(children: [
Image.asset(
'assets/images/logo/logo_android_2.png',
color: Theme.of(context).colorScheme.primary,
),
const SizedBox(width: 4),
Expanded( Expanded(
child: GestureDetector( child: GestureDetector(
onTap: () { onTap: () {
@ -191,7 +173,7 @@ class CustomAppBar extends StatelessWidget implements PreferredSizeWidget {
}, },
child: Container( child: Container(
width: 250, width: 250,
height: 44, height: 40,
clipBehavior: Clip.hardEdge, clipBehavior: Clip.hardEdge,
padding: const EdgeInsets.only(left: 12, right: 22), padding: const EdgeInsets.only(left: 12, right: 22),
decoration: BoxDecoration( decoration: BoxDecoration(