Merge branch 'master' of 192.168.2.201:laiiihz/akuCommunity

* 'master' of 192.168.2.201:laiiihz/akuCommunity:
  no message
  update app bar
hmxc
小赖 4 years ago
commit a75cbb0145

@ -4,6 +4,7 @@ import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/const/resource.dart'; import 'package:akuCommunity/const/resource.dart';
import 'package:akuCommunity/pages/activities_page/activities_page.dart'; import 'package:akuCommunity/pages/activities_page/activities_page.dart';
import 'package:akuCommunity/pages/convenient_phone/convenient_phone_page.dart'; import 'package:akuCommunity/pages/convenient_phone/convenient_phone_page.dart';
import 'package:akuCommunity/pages/home/widget/animate_app_bar.dart';
import 'package:akuCommunity/pages/industry_committee/industry_committee_page.dart'; import 'package:akuCommunity/pages/industry_committee/industry_committee_page.dart';
import 'package:akuCommunity/pages/life_pay/life_pay_page.dart'; import 'package:akuCommunity/pages/life_pay/life_pay_page.dart';
import 'package:akuCommunity/pages/message_center_page/message_center_page.dart'; import 'package:akuCommunity/pages/message_center_page/message_center_page.dart';
@ -48,6 +49,9 @@ class _HomePageState extends State<HomePage>
@override @override
bool get wantKeepAlive => true; bool get wantKeepAlive => true;
ScrollController _scrollController;
Color _bgColor;
List<AkuShopModel> _shopList = []; List<AkuShopModel> _shopList = [];
List<dynamic> data; List<dynamic> data;
@ -74,7 +78,7 @@ class _HomePageState extends State<HomePage>
}), }),
GridButton('建议咨询', R.ASSETS_ICONS_TOOL_JYTS_PNG, () { GridButton('建议咨询', R.ASSETS_ICONS_TOOL_JYTS_PNG, () {
Get.to(ThingsPage( Get.to(ThingsPage(
bundle: Bundle() bundle: Bundle()
..putMap('things', { ..putMap('things', {
'title': '建议咨询', 'title': '建议咨询',
'treeList': <Map<String, dynamic>>[ 'treeList': <Map<String, dynamic>>[
@ -102,6 +106,8 @@ class _HomePageState extends State<HomePage>
akuShop(value); akuShop(value);
}); });
// akuShop(page); // akuShop(page);
_scrollController = ScrollController();
} }
Future<void> akuShop(String response) async { Future<void> akuShop(String response) async {
@ -142,6 +148,8 @@ class _HomePageState extends State<HomePage>
); );
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
@ -149,47 +157,21 @@ class _HomePageState extends State<HomePage>
designSize: Size(750, 1334), allowFontScaling: true); designSize: Size(750, 1334), allowFontScaling: true);
return Scaffold( return Scaffold(
extendBodyBehindAppBar: true, extendBodyBehindAppBar: true,
appBar: AppBar( appBar: AnimateAppBar(
title: 'TEST'.text.make(), scrollController: _scrollController,
backgroundColor: Colors.transparent, actions:[
elevation: 0, _buildColButton(
centerTitle: true, icon: AntDesign.scan1,
leading: Container( title: '扫一扫',
margin: EdgeInsets.only(left: 32.w), onTap: () => Get.to(ScanPage()),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'深圳',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 24.sp,
color: Color(0xff333333),
),
),
Text(
'阴 27℃',
style: TextStyle(
fontSize: 20.sp,
color: Color(0xff333333),
),
)
]),
), ),
actions: [ _buildColButton(
_buildColButton( icon: AntDesign.bells,
icon: AntDesign.scan1, title: '消息',
title: '扫一扫', onTap: () => Get.to(MessageCenterPage()),
onTap: () => ScanPage().to(), ),
), 16.wb,
_buildColButton( ],
icon: AntDesign.bells,
title: '消息',
onTap: () => MessageCenterPage().to(),
),
16.wb,
],
), ),
body: RefreshConfiguration( body: RefreshConfiguration(
child: SmartRefresher( child: SmartRefresher(
@ -200,6 +182,7 @@ class _HomePageState extends State<HomePage>
enablePullUp: true, enablePullUp: true,
enablePullDown: false, enablePullDown: false,
child: CustomScrollView( child: CustomScrollView(
controller: _scrollController,
slivers: [ slivers: [
SliverToBoxAdapter( SliverToBoxAdapter(
child: Column( child: Column(

@ -0,0 +1,69 @@
import 'package:flutter/material.dart';
import 'package:velocity_x/velocity_x.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class AnimateAppBar extends StatefulWidget with PreferredSizeWidget {
final ScrollController scrollController;
final List<Widget> actions;
AnimateAppBar({Key key, this.scrollController, this.actions})
: super(key: key);
@override
_AnimateAppBarState createState() => _AnimateAppBarState();
@override
// TODO: implement preferredSize
Size get preferredSize => Size.fromHeight(56);
}
class _AnimateAppBarState extends State<AnimateAppBar> {
Color _bgColor = Colors.transparent;
@override
void initState() {
super.initState();
widget.scrollController.addListener(() {
setState(() {
_bgColor = widget.scrollController.offset > 30
? Color(0xFFFFBD00)
: widget.scrollController.offset < 0
? Colors.transparent
: Color(0xFFFFBD00)
.withOpacity((widget.scrollController.offset / 30));
});
});
}
@override
Widget build(BuildContext context) {
return AppBar(
title: 'TEST'.text.make(),
backgroundColor: _bgColor,
elevation: 0,
centerTitle: true,
leading: Container(
margin: EdgeInsets.only(left: 32.w),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'深圳',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 24.sp,
color: Color(0xff333333),
),
),
Text(
'阴 27℃',
style: TextStyle(
fontSize: 20.sp,
color: Color(0xff333333),
),
)
]),
),
actions: widget.actions,
);
}
}

@ -95,6 +95,8 @@ class _PersonalIndexState extends State<PersonalIndex>
SliverAppBar _sliverAppBar(double height) { SliverAppBar _sliverAppBar(double height) {
final userProvider = Provider.of<UserProvider>(context); final userProvider = Provider.of<UserProvider>(context);
return SliverAppBar( return SliverAppBar(
pinned: true,
toolbarHeight: 0,
elevation: 0, elevation: 0,
stretch: true, stretch: true,
floating: true, floating: true,

Loading…
Cancel
Save