From a9a59dcaddf44591d67327b3fad89a4d11f304e9 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Fri, 12 Mar 2021 11:32:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=9A=E5=A7=94=E4=BC=9A?= =?UTF-8?q?=E7=94=B5=E8=AF=9D=E5=92=8C=E7=89=A9=E4=B8=9A=E7=94=B5=E8=AF=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../convenient_phone/widget/phone_list.dart | 172 ------------------ lib/pages/home/home_page.dart | 17 +- .../industry_committee_page.dart | 3 +- lib/pages/property/widget/property_card.dart | 2 +- .../community_views/community_page.dart | 32 +++- 5 files changed, 36 insertions(+), 190 deletions(-) delete mode 100644 lib/pages/convenient_phone/widget/phone_list.dart diff --git a/lib/pages/convenient_phone/widget/phone_list.dart b/lib/pages/convenient_phone/widget/phone_list.dart deleted file mode 100644 index e68c74a2..00000000 --- a/lib/pages/convenient_phone/widget/phone_list.dart +++ /dev/null @@ -1,172 +0,0 @@ -// Flutter imports: -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; - -// Package imports: -import 'package:get/get.dart'; -import 'package:pull_to_refresh/pull_to_refresh.dart'; -import 'package:url_launcher/url_launcher.dart'; - -// Project imports: -import 'package:akuCommunity/base/assets_image.dart'; -import 'package:akuCommunity/utils/headers.dart'; - -class PhoneList extends StatefulWidget { - PhoneList({Key key}) : super(key: key); - - @override - _PhoneListState createState() => _PhoneListState(); -} - -class _PhoneListState extends State { - List> _phoneList = [ - {'name': '绿化徐', 'phone': '18898097890'}, - {'name': '废品回收', 'phone': '13890909090'}, - {'name': '业委会电话', 'phone': '0574-88467897'}, - {'name': '7-9幢管家', 'phone': '18989093454'}, - {'name': '监控电话', 'phone': '0574-8812572'}, - {'name': '百世快递', 'phone': '15890987687'}, - ]; - RefreshController _refreshController = - RefreshController(initialRefresh: false); - - void _onRefresh() async { - await Future.delayed(Duration(milliseconds: 1500)); - _refreshController.refreshCompleted(); - } - - void _onLoading() async { - if (mounted) setState(() {}); - _refreshController.loadComplete(); - } - - Future _phoneCall(String url) async { - if (await canLaunch(url)) { - await launch(url); - } else { - throw 'Could not launch $url'; - } - } - - void _showDialog(String url) { - showCupertinoDialog( - context: context, - builder: (context) { - return CupertinoAlertDialog( - title: Text( - url, - style: TextStyle( - fontSize: 34.sp, - color: Color(0xff030303), - ), - ), - actions: [ - CupertinoDialogAction( - child: Text( - '取消', - style: TextStyle( - fontSize: 34.sp, - color: Color(0xff333333), - ), - ), - onPressed: () { - Get.back(); - }, - ), - CupertinoDialogAction( - child: Text( - '呼叫', - style: TextStyle( - fontWeight: FontWeight.w600, - fontSize: 34.sp, - color: Color(0xffff8200), - ), - ), - onPressed: () { - _phoneCall('tel:$url'); - Get.back(); - }, - ), - ], - ); - }, - ); - } - - Widget _phoneCard(String name, String phone) { - return Container( - margin: EdgeInsets.symmetric(horizontal: 32.w), - padding: EdgeInsets.only( - top: 23.w, - bottom: 20.w, - ), - decoration: BoxDecoration( - color: Color(0xffffffff), - border: - Border(bottom: BorderSide(color: Color(0xffd9d9d9), width: 0.5)), - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Text( - name, - style: TextStyle( - fontSize: 32.sp, - color: Color(0xff333333), - ), - ), - SizedBox(height: 12.w), - Text( - phone, - style: TextStyle( - fontSize: 28.sp, - color: Color(0xff999999), - ), - ), - ], - ), - InkWell( - onTap: () { - _showDialog(phone); - }, - child: Image.asset( - AssetsImage.PHONE, - height: 60.w, - width: 60.w, - ), - ), - ], - ), - ); - } - - @override - Widget build(BuildContext context) { - return SmartRefresher( - controller: _refreshController, - header: WaterDropHeader(), - footer: ClassicFooter(), - onRefresh: _onRefresh, - onLoading: _onLoading, - enablePullUp: true, - child: CustomScrollView( - slivers: [ - SliverList( - delegate: SliverChildBuilderDelegate( - (BuildContext context, int index) { - return _phoneCard( - _phoneList[index]['name'], - _phoneList[index]['phone'], - ); - }, - childCount: _phoneList.length, - ), - ), - ], - ), - ); - } -} diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index d2097df7..419b192e 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -1,6 +1,7 @@ // Dart imports: // Flutter imports: +import 'package:akuCommunity/utils/login_util.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; @@ -72,19 +73,19 @@ class _HomePageState extends State appBar: AnimateAppBar( scrollController: _scrollController, actions: [ - Badge( - elevation: 0, - showBadge: appProvider.messageCenterModel.sysCount==0, - position: BadgePosition.topEnd(), - child: ColumnActionButton( - onPressed: (){ - + Badge( + elevation: 0, + showBadge: appProvider.messageCenterModel.sysCount == 0, + position: BadgePosition.topEnd(), + child: ColumnActionButton( + onPressed: () { + if (LoginUtil.isNotLogin) return; MessageCenterPage().to(); }, title: '消息', path: R.ASSETS_ICONS_ALARM_PNG, ), - ) + ) ], ), body: EasyRefresh( diff --git a/lib/pages/industry_committee/industry_committee_page.dart b/lib/pages/industry_committee/industry_committee_page.dart index a35f429c..7a2e10fb 100644 --- a/lib/pages/industry_committee/industry_committee_page.dart +++ b/lib/pages/industry_committee/industry_committee_page.dart @@ -31,8 +31,7 @@ class _IndustryCommitteePageState extends State { MaterialButton( onPressed: () { Get.dialog(CupertinoAlertDialog( - //TODO 业委会电话, for test only - title: '(0574) 8888 8888'.text.isIntrinsic.make(), + title: '0574-87760023'.text.isIntrinsic.make(), actions: [ CupertinoDialogAction( child: '取消'.text.isIntrinsic.make(), diff --git a/lib/pages/property/widget/property_card.dart b/lib/pages/property/widget/property_card.dart index ffeabec3..a5fc3846 100644 --- a/lib/pages/property/widget/property_card.dart +++ b/lib/pages/property/widget/property_card.dart @@ -99,7 +99,7 @@ class PropertyCard extends StatelessWidget { onTap: () { switch (_listCard[index]['title']) { case '电话物业': - _showDialog(context, '0574-88467897'); + _showDialog(context, '0574-87760023'); break; case '语音管家': break; diff --git a/lib/ui/community/community_views/community_page.dart b/lib/ui/community/community_views/community_page.dart index b562154c..64149625 100644 --- a/lib/ui/community/community_views/community_page.dart +++ b/lib/ui/community/community_views/community_page.dart @@ -30,7 +30,7 @@ class CommunityPage extends StatefulWidget { class _CommunityPageState extends State with TickerProviderStateMixin, AutomaticKeepAliveClientMixin { TabController _tabController; - List _tabs = ['最新', '话题', '我的']; + List _tabs = []; GlobalKey topicKey = GlobalKey(); GlobalKey myKey = GlobalKey(); @@ -39,20 +39,33 @@ class _CommunityPageState extends State @override void initState() { super.initState(); + final userProvider = Provider.of(context, listen: false); + if (userProvider.isLogin) _tabs = ['最新', '话题', '我的']; + if (userProvider.isNotLogin) _tabs = ['最新', '话题']; _tabController = TabController( vsync: this, length: _tabs.length, ); } + @override + void dispose() { + _tabController?.dispose(); + super.dispose(); + } + @override Widget build(BuildContext context) { super.build(context); + final userProvider = Provider.of(context); return BeeScaffold( title: '社区', actions: [ ColumnActionButton( - onPressed: MessageCenter().to, + onPressed: () { + if (LoginUtil.isNotLogin) return; + MessageCenter().to(); + }, title: '消息', path: R.ASSETS_ICONS_ALARM_PNG, ), @@ -90,11 +103,16 @@ class _CommunityPageState extends State ), ), body: TabBarView( - children: [ - NewCommunityView(key: newKey), - TopicCommunityView(key: topicKey), - MyCommunityView(key: myKey), - ], + children: userProvider.isLogin + ? [ + NewCommunityView(key: newKey), + TopicCommunityView(key: topicKey), + MyCommunityView(key: myKey), + ] + : [ + NewCommunityView(key: newKey), + TopicCommunityView(key: topicKey), + ], controller: _tabController, ), bodyColor: Colors.white,