张萌 4 years ago
commit 71aded26ef

@ -104,7 +104,6 @@ class _HomePageState extends State<HomePage>
});
// akuShop(page);
_scrollController = ScrollController();
}
Future<void> akuShop(String response) async {
@ -145,8 +144,6 @@ class _HomePageState extends State<HomePage>
);
}
@override
Widget build(BuildContext context) {
super.build(context);
@ -156,19 +153,19 @@ class _HomePageState extends State<HomePage>
extendBodyBehindAppBar: true,
appBar: AnimateAppBar(
scrollController: _scrollController,
actions:[
_buildColButton(
icon: AntDesign.scan1,
title: '扫一扫',
onTap: () => Get.to(ScanPage()),
),
_buildColButton(
icon: AntDesign.bells,
title: '消息',
onTap: () => Get.to(MessageCenterPage()),
),
16.wb,
],
actions: [
_buildColButton(
icon: AntDesign.scan1,
title: '扫一扫',
onTap: () => Get.to(ScanPage()),
),
_buildColButton(
icon: AntDesign.bells,
title: '消息',
onTap: () => Get.to(MessageCenterPage()),
),
16.wb,
],
),
body: RefreshConfiguration(
child: SmartRefresher(

@ -35,7 +35,7 @@ class _CommitteeMailboxPageState extends State<CommitteeMailboxPage> {
bottom: 0.w,
),
hintText: '',
border: InputBorder.none, //线
border: InputBorder.none,
fillColor: Colors.white,
filled: true,
hintStyle: TextStyle(

@ -1,3 +1,4 @@
import 'package:akuCommunity/base/base_style.dart';
import 'package:akuCommunity/pages/industry_committee/committee_mailbox/committee_mailbox_page.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
@ -5,7 +6,7 @@ import 'package:flutter/cupertino.dart';
import 'package:get/get.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'widget/staff_list.dart';
import 'package:velocity_x/velocity_x.dart';
class IndustryCommitteePage extends StatefulWidget {
IndustryCommitteePage({Key key}) : super(key: key);
@ -15,131 +16,62 @@ class IndustryCommitteePage extends StatefulWidget {
}
class _IndustryCommitteePageState extends State<IndustryCommitteePage> {
List<Map<String, dynamic>> _listBottom = [
{
'title': '业委会电话',
'color': Color(0xff2a2a2a),
'fontColor': Color(0xffffffff),
},
{
'title': '业委会信箱',
'color': Color(0xffffc40c),
'fontColor': Color(0xff333333),
},
];
Future<void> _phoneCall(String url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
throw 'Could not launch $url';
}
}
void _showDialog() {
showCupertinoDialog(
context: context,
builder: (context) {
return CupertinoAlertDialog(
title: Text(
'0574-88478909',
style: TextStyle(
fontSize: 34.sp,
color: Color(0xff030303),
),
),
actions: <Widget>[
CupertinoDialogAction(
child: Text(
'取消',
style: TextStyle(
fontSize: 34.sp,
color: Color(0xff333333),
),
Widget _buildBottomNavi() {
return [
MaterialButton(
onPressed: () {
Get.dialog(CupertinoAlertDialog(
//TODO , for test only
title: '(0574) 8888 8888'.text.isIntrinsic.make(),
actions: [
CupertinoDialogAction(
child: '取消'.text.isIntrinsic.make(),
onPressed: Get.back,
),
onPressed: () {
Get.back();
},
),
CupertinoDialogAction(
child: Text(
'呼叫',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 34.sp,
color: Color(0xffff8200),
),
CupertinoDialogAction(
child: '呼叫'.text.isIntrinsic.orange500.make(),
onPressed: () {
launch('tel:10086');
Get.back();
},
),
onPressed: () {
_phoneCall('tel:${'0574-88478909'}');
Get.back();
},
),
],
);
},
);
}
InkWell _inkWellBotoom(String title, Color color, Color fontColor) {
return InkWell(
onTap: () {
switch (title) {
case '业委会电话':
_showDialog();
break;
case '业委会信箱':
CommitteeMailboxPage().to;
break;
default:
}
},
child: Container(
color: color,
alignment: Alignment.center,
padding: EdgeInsets.symmetric(
vertical: 26.5.w,
),
child: Text(
title,
style: TextStyle(
fontSize: 32.sp,
color: fontColor,
),
),
),
);
}
Positioned _positionedBottomBar() {
return Positioned(
bottom: 0,
child: Container(
height: 98.w + MediaQuery.of(context).viewPadding.bottom,
width: MediaQuery.of(context).size.width,
child: Row(
children: _listBottom
.map((item) => Expanded(
child: _inkWellBotoom(
item['title'],
item['color'],
item['fontColor'],
),
))
.toList(),
),
),
);
],
));
},
height: 98.w,
color: Color(0xFF2A2A2A),
child: '业委会电话'.text.white.size(32.sp).make(),
)
.box
.color(Color(0xFF2A2A2A))
.margin(EdgeInsets.only(
bottom: MediaQuery.of(context).viewPadding.bottom,
))
.make()
.expand(),
MaterialButton(
onPressed: CommitteeMailboxPage().to,
height: 98.w,
color: kPrimaryColor,
child: '业委会信箱'.text.size(32.sp).color(ktextPrimary).make(),
)
.box
.color(kPrimaryColor)
.margin(EdgeInsets.only(
bottom: MediaQuery.of(context).viewPadding.bottom,
))
.make()
.expand(),
].row();
}
Widget build(BuildContext context) {
return BeeScaffold(
title: '业委会',
body: Stack(
children: [
StaffList(),
_positionedBottomBar(),
],
children: [],
),
bottomNavi: _buildBottomNavi(),
);
}
}

@ -1,182 +0,0 @@
import 'package:akuCommunity/utils/headers.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:akuCommunity/widget/cached_image_wrapper.dart';
class StaffList extends StatefulWidget {
StaffList({Key key}) : super(key: key);
@override
_StaffListState createState() => _StaffListState();
}
class _StaffListState extends State<StaffList> {
List<Map<String, dynamic>> _staffList = [
{
'name': '刘鄂',
'imagePath':
'https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=1917253203,3586495528&fm=26&gp=0.jpg',
'address': '3幢2单元703室',
'tenure': '2016年12月19日-2020年10月3日',
'post': '会计师',
'tag': '主任'
},
{
'name': '史红',
'imagePath':
'https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=1051460286,4207974038&fm=26&gp=0.jpg',
'address': '10幢1单元1903室',
'tenure': '2017年4月21日-2020年10月3日',
'post': '宠物医生',
'tag': '副主任'
},
{
'name': '陈吉明',
'imagePath':
'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=2962135405,1279141756&fm=26&gp=0.jpg',
'address': '19幢1单元203室',
'tenure': '2018年12月12日-2020年10月3日',
'post': '个体私营五金厂老板',
'tag': '委员'
},
{
'name': '周立宇',
'imagePath':
'https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2503876943,2429234388&fm=26&gp=0.jpg',
'address': '19幢1单元203室',
'tenure': '2018年11月23日-2020年10月3日',
'post': '技术工程师',
'tag': '委员'
},
];
RefreshController _refreshController =
RefreshController(initialRefresh: false);
void _onRefresh() async {
await Future.delayed(Duration(milliseconds: 1500));
_refreshController.refreshCompleted();
}
void _onLoading() async {
if (mounted) setState(() {});
_refreshController.loadComplete();
}
TextStyle _subStyle() {
return TextStyle(
fontSize: 24.sp,
color: Color(0xff999999),
);
}
Positioned _positionedTag(String tag) {
return Positioned(
top: 0,
right: 20.w,
child: Container(
padding: EdgeInsets.symmetric(
horizontal: 21.5.w,
vertical: 5.5.w),
decoration: BoxDecoration(
color: Color(0xfffff3cd),
border: Border.all(color: Color(0xffffc40c), width: 0.5),
borderRadius: BorderRadius.all(Radius.circular(22))),
child: Text(
tag,
style: TextStyle(
fontSize: 24.sp,
color: Color(0xff333333),
),
),
),
);
}
Container _containerStaffCard(String name, String imagePath, String address,
String tenure, String post, String tag) {
return Container(
margin: EdgeInsets.only(
left: 32.w,
right: 32.w,
top: 20.w,
),
padding: EdgeInsets.only(
left: 20.w,
top: 20.w,
bottom: 20.w,
),
decoration: BoxDecoration(
color: Color(0xffffffff),
borderRadius: BorderRadius.all(Radius.circular(8))),
child: Stack(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
CachedImageWrapper(
url: imagePath,
height: 150.w,
width: 150.w,
),
SizedBox(width: 24.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
name,
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 28.sp,
color: Color(0xff333333),
),
),
SizedBox(width: 10.w),
Text(
'住址:$address',
style: _subStyle(),
),
SizedBox(width: 10.w),
Text(
'任职期限:$tenure',
style: _subStyle(),
),
SizedBox(width: 10.w),
Text(
'从事岗位:$post',
style: _subStyle(),
),
],
),
],
),
_positionedTag(tag),
],
),
);
}
@override
Widget build(BuildContext context) {
return SmartRefresher(
controller: _refreshController,
header: WaterDropHeader(),
footer: ClassicFooter(),
onRefresh: _onRefresh,
onLoading: _onLoading,
enablePullUp: false,
enablePullDown: false,
child: ListView.builder(
itemBuilder: (context, index) => _containerStaffCard(
_staffList[index]['name'],
_staffList[index]['imagePath'],
_staffList[index]['address'],
_staffList[index]['tenure'],
_staffList[index]['post'],
_staffList[index]['tag'],
),
itemCount: _staffList.length,
),
);
}
}

@ -1,8 +1,10 @@
import 'package:akuCommunity/pages/tab_navigator.dart';
import 'package:akuCommunity/provider/user_provider.dart';
import 'package:akuCommunity/utils/hive_store.dart';
import 'package:akuCommunity/utils/logger/logger_view.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:velocity_x/velocity_x.dart';
//TODO splashPage
@ -15,8 +17,11 @@ class SplashPage extends StatefulWidget {
class _SplashPageState extends State<SplashPage> {
Future _initOp() async {
final userProvider = Provider.of<UserProvider>(context, listen: false);
await Future.delayed(Duration(seconds: 2));
print(HiveStore.appBox.get('token'));
if (HiveStore.appBox.get('login') ?? false) {
await userProvider.setLogin(HiveStore.appBox.get('token'));
}
}
@override

@ -21,6 +21,7 @@ class UserProvider extends ChangeNotifier {
_isLogin = true;
NetUtil().dio.options.headers.putIfAbsent('App-Admin-Token', () => token);
HiveStore.appBox.put('token', token);
HiveStore.appBox.put('login', true);
await updateProfile();
notifyListeners();
}
@ -32,6 +33,7 @@ class UserProvider extends ChangeNotifier {
NetUtil().get(API.user.logout, showMessage: true);
NetUtil().dio.options.headers.remove('App-Admin-Token');
HiveStore.appBox.delete('token');
HiveStore.appBox.delete('login');
notifyListeners();
}

@ -12,7 +12,6 @@ class Bundle {
return _map[k];
}
putInt(String k, int v) => _map[k] = v;
putString(String k, String v) => _setValue(k, v);
@ -28,8 +27,6 @@ class Bundle {
bool getBool(String k) => _getValue(k) as bool;
List getList(String k) => _getValue(k) as List;
Map getMap(String k) => _getValue(k) as Map;
@override

@ -1,6 +1,3 @@
import 'package:akuCommunity/utils/sp_key.dart';
import 'package:akuCommunity/utils/sp_util.dart';
class NetHeader {
/// Header
static String appID = 'MOBILE-APP-ZNY';
@ -9,8 +6,4 @@ class NetHeader {
'AppID': appID,
'AppSecret': appSecret,
};
static Future<Map<String, dynamic>> getZnToken() async {
String znToken = await SpUtil.getString(SpKey.zntoken);
return {'Authorization': znToken ?? ''};
}
}

@ -13,13 +13,15 @@ class BeeScaffold extends StatefulWidget {
final Color bgColor;
final List<Widget> actions;
final Widget leading;
final Widget bottomNavi;
BeeScaffold(
{Key key,
@required this.title,
this.body,
this.actions,
this.leading,
this.bgColor})
this.bgColor,
this.bottomNavi})
: super(key: key);
@override
@ -41,6 +43,7 @@ class _BeeScaffoldState extends State<BeeScaffold> {
actions: widget.actions,
),
body: widget.body,
bottomNavigationBar: widget.bottomNavi,
);
}
}

Loading…
Cancel
Save