You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aku_new_community/lib/ui/profile/house/house_owners_page.dart

120 lines
4.0 KiB

import 'package:aku_community/base/base_style.dart';
import 'package:aku_community/ui/profile/house/my_house_list.dart';
import 'package:aku_community/widget/buttons/bottom_button.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:provider/provider.dart';
import 'package:aku_community/const/resource.dart';
import 'package:aku_community/provider/app_provider.dart';
import 'package:aku_community/ui/profile/house/add_house_page.dart';
import 'package:aku_community/ui/profile/house/house_card.dart';
import 'package:aku_community/ui/profile/house/house_func.dart';
import 'package:aku_community/utils/headers.dart';
import 'package:aku_community/widget/bee_scaffold.dart';
class HouseOwnersPage extends StatefulWidget {
4 years ago
HouseOwnersPage({Key? key}) : super(key: key);
@override
_HouseOwnersPageState createState() => _HouseOwnersPageState();
}
class _HouseOwnersPageState extends State<HouseOwnersPage> {
EasyRefreshController _refreshController = EasyRefreshController();
bool get _emptyHouse {
final appProvider = Provider.of<AppProvider>(context, listen: false);
return appProvider.houses.isEmpty;
}
///存在已认证的房屋
bool get _haveAuthedHouse {
final appProvider = Provider.of<AppProvider>(context, listen: false);
// return (appProvider.selectedHouse?.status ?? 0) == 4;
return appProvider.selectedHouse != null;
}
Widget get _houseTitle {
// final appProvider = Provider.of<AppProvider>(context, listen: false);
if (_emptyHouse) return Text('还没有绑定房屋');
// if (appProvider.selectedHouse!.status == 1) return Text('您的身份正在审核中,请耐心等待');
// if (appProvider.selectedHouse!.status == 3) return Text('审核未通过');
return SizedBox();
}
@override
Widget build(BuildContext context) {
final appProvider = Provider.of<AppProvider>(context);
return BeeScaffold(
title: '我的房屋',
actions: [
TextButton(
onPressed: () {
Get.to(MyHouseList());
},
child: Text('审核记录'),
),
],
body: EasyRefresh(
header: MaterialHeader(),
controller: _refreshController,
firstRefresh: true,
onRefresh: () async {
appProvider.updateHouses(await HouseFunc.passedHouses);
},
child: ListView(
children: [
_emptyHouse
? 280.hb
: Padding(
padding: EdgeInsets.all(32.w),
child: HouseCard(
type: appProvider.selectedHouse!=null
? CardAuthType.SUCCESS
: CardAuthType.FAIL,
model: appProvider.selectedHouse,
),
),
if (!_emptyHouse) 88.hb,
if (!_haveAuthedHouse)
Stack(
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 75.w),
child: Image.asset(R.ASSETS_STATIC_REVIEWING_WEBP),
),
Positioned(
bottom: 100.w,
left: 0,
right: 0,
child: _houseTitle.centered(),
),
],
),
if (_emptyHouse)
Center(
child: ElevatedButton(
onPressed: _addHouse,
child: Text('添加房屋'),
),
),
],
),
),
bottomNavi: BottomButton(
onPressed: _addHouse,
child: '新增房屋'.text.size(32.sp).color(ktextPrimary).bold.make()),
);
}
///跳转到添加房屋
_addHouse() async {
4 years ago
bool? result = await Get.to(() => AddHousePage());
if (result == true) _refreshController.callRefresh();
}
}