mod: homePage开发、mainPage优化

This commit is contained in:
guozhigq
2023-04-18 17:12:32 +08:00
parent efa257b175
commit fbfdc2138b
6 changed files with 330 additions and 32 deletions

View File

@ -0,0 +1,58 @@
import 'dart:io';
import 'package:flutter/material.dart';
class HomeAppBar extends StatelessWidget {
const HomeAppBar({super.key});
@override
Widget build(BuildContext context) {
return SliverAppBar(
// forceElevated: true,
scrolledUnderElevation: 0,
toolbarHeight: Platform.isAndroid
? (MediaQuery.of(context).padding.top + 6)
: Platform.isIOS
? MediaQuery.of(context).padding.top - 2
: kToolbarHeight,
expandedHeight: kToolbarHeight + MediaQuery.of(context).padding.top,
automaticallyImplyLeading: false,
pinned: true,
floating: true,
primary: false,
flexibleSpace: LayoutBuilder(
builder: (context, constraints) {
return FlexibleSpaceBar(
background: Column(
children: [
AppBar(
centerTitle: false,
title: const Text(
'PiLiPaLa',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
letterSpacing: 1,
),
),
actions: [
IconButton(
onPressed: () {},
icon: const Icon(Icons.notifications_none_rounded),
),
IconButton(
onPressed: () {},
icon: const Icon(Icons.search_rounded),
),
const SizedBox(width: 10)
],
elevation: 0,
scrolledUnderElevation: 0,
),
],
),
);
},
),
);
}
}