mod: 首页样式

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

View File

@@ -53,53 +53,49 @@ 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(
children: [
Expanded(
child: Theme( child: Theme(
data: ThemeData( data: ThemeData(
splashColor: Colors.transparent, // 点击时的水波纹颜色设置为透明 splashColor: Colors.transparent, // 点击时的水波纹颜色设置为透明
highlightColor: Colors.transparent, // 点击时的背景高亮颜色设置为透明 highlightColor: Colors.transparent, // 点击时的背景高亮颜色设置为透明
), ),
child: Padding(
padding: const EdgeInsets.only(top: 2),
child: TabBar( child: TabBar(
controller: _homeController.tabController, controller: _homeController.tabController,
tabs: [ tabs: [
for (var i in _homeController.tabs) for (var i in _homeController.tabs) Tab(text: i['label'])
// Tab(text: i['label'])
Padding(
padding: const EdgeInsets.symmetric(
horizontal: 0, vertical: 11),
child: Row(
children: [
i['icon'],
const SizedBox(width: 4),
Text(i['label'])
],
),
),
], ],
isScrollable: true, isScrollable: true,
indicatorWeight: 0, indicatorWeight: 0,
indicatorPadding: const EdgeInsets.symmetric( indicatorPadding: const EdgeInsets.only(
horizontal: 4, vertical: 5), top: 37, left: 18, right: 18, bottom: 6),
indicatorColor: Colors.black,
indicator: BoxDecoration( indicator: BoxDecoration(
color: Theme.of(context) gradient: RadialGradient(
.colorScheme center: Alignment.centerLeft,
.primaryContainer radius: 20.00,
.withOpacity(0.8), colors: [
borderRadius: Theme.of(context).colorScheme.primary,
const BorderRadius.all(Radius.circular(20)), Theme.of(context).colorScheme.background,
],
),
borderRadius: const BorderRadius.only(
topLeft: Radius.circular(4),
topRight: Radius.circular(2),
bottomLeft: Radius.circular(2),
bottomRight: Radius.circular(4),
),
), ),
indicatorSize: TabBarIndicatorSize.tab, indicatorSize: TabBarIndicatorSize.tab,
labelColor: Theme.of(context).colorScheme.primary, labelColor: Theme.of(context).colorScheme.primary,
labelStyle: const TextStyle(fontSize: 13), labelStyle:
const TextStyle(fontSize: 13, fontWeight: FontWeight.bold),
dividerColor: Colors.transparent, dividerColor: Colors.transparent,
unselectedLabelColor: unselectedLabelStyle: TextStyle(
Theme.of(context).colorScheme.outline, color: Theme.of(context).colorScheme.outline,
fontWeight: FontWeight.normal,
),
unselectedLabelColor: Theme.of(context).colorScheme.outline,
onTap: (value) { onTap: (value) {
feedBack(); feedBack();
if (_homeController.initialIndex == value) { if (_homeController.initialIndex == value) {
@@ -110,27 +106,6 @@ class _HomePageState extends State<HomePage>
), ),
), ),
), ),
),
SizedBox(
width: 30,
height: 30,
child: IconButton(
tooltip: '全部分类',
style: ButtonStyle(
padding: MaterialStateProperty.all(EdgeInsets.zero),
),
onPressed: () async {},
icon: Icon(
Icons.dataset_outlined,
color: Theme.of(context).colorScheme.outline,
size: 19,
),
),
),
const SizedBox(width: 14)
],
),
),
Expanded( Expanded(
child: TabBarView( child: TabBarView(
controller: _homeController.tabController, controller: _homeController.tabController,
@@ -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(