添加我的车辆页面

hmxc
小赖 4 years ago
parent 87f399aca3
commit b4f692fd29

@ -75,6 +75,12 @@ class _User {
/// ///
String get deleteHouse => '/user/myHouse/falseDelete'; String get deleteHouse => '/user/myHouse/falseDelete';
///
String get carParkingList => '/user/myParkingSpace/list';
///
String get carList => '/user/myCar/list';
} }
class _Manager { class _Manager {

@ -21,6 +21,10 @@ class AppTheme {
fontSize: 28.sp, fontSize: 28.sp,
color: Color(0xFF333333), color: Color(0xFF333333),
), ),
bodyText1: TextStyle(
fontSize: 24.sp,
color: Color(0xFF333333),
),
), ),
floatingActionButtonTheme: FloatingActionButtonThemeData().copyWith( floatingActionButtonTheme: FloatingActionButtonThemeData().copyWith(
backgroundColor: Color(0xFFFFD000), backgroundColor: Color(0xFFFFD000),

@ -1,3 +1,4 @@
import 'package:akuCommunity/ui/profile/car/car_manage_page.dart';
import 'package:akuCommunity/ui/profile/car_parking/car_parking_page.dart'; import 'package:akuCommunity/ui/profile/car_parking/car_parking_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -78,7 +79,7 @@ List<AO> appObjects = [
List<AO> userAppObjects = [ List<AO> userAppObjects = [
AO('我的房屋', R.ASSETS_ICONS_USER_ICON_WDFW_PNG, () => HouseOwnersPage()), AO('我的房屋', R.ASSETS_ICONS_USER_ICON_WDFW_PNG, () => HouseOwnersPage()),
AO('我的车位', R.ASSETS_ICONS_USER_ICON_WDCW_PNG, () => CarParkingPage()), AO('我的车位', R.ASSETS_ICONS_USER_ICON_WDCW_PNG, () => CarParkingPage()),
AO('我的车', R.ASSETS_ICONS_USER_ICON_WDC_PNG, () => CarParkingPage()), AO('我的车', R.ASSETS_ICONS_USER_ICON_WDC_PNG, () => CarManagePage()),
AO('社区活动', R.ASSETS_ICONS_USER_ICON_WDSQHD_PNG, () => ActivityListPage()), AO('社区活动', R.ASSETS_ICONS_USER_ICON_WDSQHD_PNG, () => ActivityListPage()),
AO('我的缴费', R.ASSETS_ICONS_USER_ICON_WDJF_PNG, () => LifePayPage()), AO('我的缴费', R.ASSETS_ICONS_USER_ICON_WDJF_PNG, () => LifePayPage()),
AO('我的报修', R.ASSETS_ICONS_USER_ICON_WDBX_PNG, () => FixedSubmitPage()), AO('我的报修', R.ASSETS_ICONS_USER_ICON_WDBX_PNG, () => FixedSubmitPage()),

@ -1,15 +1,75 @@
import 'package:flustars/flustars.dart'; import 'package:flustars/flustars.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class CarParkingModel { class CarParkingModel {
String code; String code;
int type; int type;
String effectiveTimeEnd; String effectiveTimeEnd;
DateTime get effectiveDate => DateUtil.getDateTime(effectiveTimeEnd); String get typeName {
switch (type) {
case 1:
return '产权车位';
case 2:
return '临时车位';
default:
return '未知';
}
}
String get carTypeName {
switch (type) {
case 1:
return '产权车位';
case 2:
return '包年';
case 3:
return '包月';
case 4:
return '临时';
default:
return '未知';
}
}
String get dateName {
if (effectiveTimeEnd == null) return '永久';
if (outdated) return '$effectiveDateValue(已过期)';
return effectiveDateValue;
}
DateTime get effectiveDate {
if (effectiveTimeEnd == null) return null;
return DateUtil.getDateTime(effectiveTimeEnd);
}
String get effectiveDateValue =>
DateUtil.formatDate(effectiveDate, format: 'yyyy-MM-dd');
bool get outdated { bool get outdated {
if (effectiveDate == null) return false;
DateTime now = DateTime.now(); DateTime now = DateTime.now();
return effectiveDate.isAfter(now); return effectiveDate.isAfter(now);
} }
List<BoxShadow> get shadow {
if (!outdated)
return [
BoxShadow(
offset: Offset(0, 10.w),
blurRadius: 30.w,
color: Color(0xFFFFF0BF),
)
];
return [
BoxShadow(
offset: Offset(0, 10.w),
blurRadius: 30.w,
color: Color(0xFFF0F0F0),
)
];
}
CarParkingModel({this.code, this.type, this.effectiveTimeEnd}); CarParkingModel({this.code, this.type, this.effectiveTimeEnd});
CarParkingModel.fromJson(Map<String, dynamic> json) { CarParkingModel.fromJson(Map<String, dynamic> json) {

@ -32,7 +32,7 @@ class HouseModel {
String get houseStatus { String get houseStatus {
if (status == 1) return '审核中'; if (status == 1) return '审核中';
if (status == 3) return '审核失败'; if (status == 3) return '未通过';
if (type == 1) return '业主'; if (type == 1) return '业主';
if (type == 2) return '亲属'; if (type == 2) return '亲属';
if (type == 3) return '租客'; if (type == 3) return '租客';

@ -205,8 +205,23 @@ class AppProvider extends ChangeNotifier {
List<CarParkingModel> _carParkingModels = []; List<CarParkingModel> _carParkingModels = [];
List<CarParkingModel> get carParkingModels => _carParkingModels; List<CarParkingModel> get carParkingModels => _carParkingModels;
updateCarParkingModels(List<CarParkingModel> models) { Future updateCarParkingModels() async {
_carParkingModels = models; BaseModel baseModel = await NetUtil().get(API.user.carParkingList);
if (baseModel?.data == null) return [];
_carParkingModels = (baseModel.data as List)
.map((e) => CarParkingModel.fromJson(e))
.toList();
notifyListeners();
}
List<CarParkingModel> _carModels = [];
List<CarParkingModel> get carModels => _carModels;
Future updateCarModels() async {
BaseModel baseModel = await NetUtil().get(API.user.carList);
if (baseModel?.data == null) return [];
_carModels = (baseModel.data as List)
.map((e) => CarParkingModel.fromJson(e))
.toList();
notifyListeners(); notifyListeners();
} }
} }

@ -0,0 +1,88 @@
import 'package:akuCommunity/constants/app_values.dart';
import 'package:akuCommunity/model/user/car_parking_model.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:flutter/material.dart';
class CarManageCard extends StatelessWidget {
final CarParkingModel model;
const CarManageCard({Key key, @required this.model}) : super(key: key);
String get _assetImage {
return model.outdated
? R.ASSETS_STATIC_PARKING_GREY_WEBP
: R.ASSETS_STATIC_PARKING_YELLOW_WEBP;
}
@override
Widget build(BuildContext context) {
return AspectRatio(
aspectRatio: 688 / 286,
child: Container(
padding: EdgeInsets.all(40.w),
decoration: BoxDecoration(
image: DecorationImage(image: AssetImage(_assetImage)),
borderRadius: BorderRadius.circular(8.w),
),
clipBehavior: Clip.antiAlias,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
model.code,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 36.sp,
),
),
Text(
AppValues.plotName,
style: Theme.of(context)
.textTheme
.subtitle2
.copyWith(color: Color(0xFF999999)),
),
Spacer(),
Row(
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'类型',
style: Theme.of(context).textTheme.bodyText1.copyWith(
color: Color(0xFF666666),
),
),
Text(
model.typeName,
style: Theme.of(context).textTheme.subtitle2.copyWith(
fontWeight: FontWeight.bold,
),
),
],
).expand(),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'到期时间',
style: Theme.of(context).textTheme.bodyText1.copyWith(
color: Color(0xFF666666),
),
),
Text(
model.dateName,
style: Theme.of(context).textTheme.subtitle2.copyWith(
fontWeight: FontWeight.bold,
),
),
],
).expand(),
],
),
],
),
),
);
}
}

@ -0,0 +1,68 @@
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:akuCommunity/ui/profile/car/car_manage_card.dart';
import 'package:akuCommunity/ui/profile/car_parking/car_parking_card.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:provider/provider.dart';
class CarManagePage extends StatefulWidget {
CarManagePage({Key key}) : super(key: key);
@override
_CarManagePageState createState() => _CarManagePageState();
}
class _CarManagePageState extends State<CarManagePage> {
Widget get _renderEmptyWidget {
return Center(
child: Stack(
children: [
Image.asset(R.ASSETS_STATIC_REVIEWING_WEBP).pSymmetric(h: 75.w),
Positioned(
bottom: 100.w,
left: 0,
right: 0,
child: Text(
'还没有车辆',
style: TextStyle(
color: Color(0xFF999999),
),
).centered(),
),
],
),
);
}
@override
Widget build(BuildContext context) {
final appProvider = Provider.of<AppProvider>(context);
return BeeScaffold(
title: '我的车位',
actions: [
// TextButton(
// onPressed: () {},
// child: Text('管理车位'),
// ),
],
body: EasyRefresh(
firstRefresh: true,
onRefresh: () async {
await appProvider.updateCarModels();
},
header: MaterialHeader(),
emptyWidget: appProvider.carModels.isEmpty ? _renderEmptyWidget : null,
child: ListView.separated(
separatorBuilder: (context, index) => 32.hb,
itemBuilder: (context, index) {
return CarManageCard(model: appProvider.carModels[index]);
},
padding: EdgeInsets.all(32.w),
itemCount: appProvider.carModels.length,
),
),
);
}
}

@ -19,11 +19,16 @@ class CarparkingCard extends StatelessWidget {
aspectRatio: 688 / 286, aspectRatio: 688 / 286,
child: Container( child: Container(
padding: EdgeInsets.all(40.w), padding: EdgeInsets.all(40.w),
decoration: BoxDecoration(
image: DecorationImage(image: AssetImage(_assetImage)),
borderRadius: BorderRadius.circular(8.w),
),
clipBehavior: Clip.antiAlias,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'地上车位B0001', model.code,
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
fontSize: 36.sp, fontSize: 36.sp,
@ -40,18 +45,43 @@ class CarparkingCard extends StatelessWidget {
Row( Row(
children: [ children: [
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text('类型'), Text(
'类型',
style: Theme.of(context).textTheme.bodyText1.copyWith(
color: Color(0xFF666666),
),
),
Text(
model.typeName,
style: Theme.of(context).textTheme.subtitle2.copyWith(
fontWeight: FontWeight.bold,
),
),
], ],
), ).expand(),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'到期时间',
style: Theme.of(context).textTheme.bodyText1.copyWith(
color: Color(0xFF666666),
),
),
Text(
model.dateName,
style: Theme.of(context).textTheme.subtitle2.copyWith(
fontWeight: FontWeight.bold,
),
),
],
).expand(),
], ],
), ),
], ],
), ),
decoration: BoxDecoration(
image: DecorationImage(image: AssetImage(_assetImage)),
borderRadius: BorderRadius.circular(4.w),
),
), ),
); );
} }

@ -1,7 +0,0 @@
import 'package:akuCommunity/model/user/car_parking_model.dart';
class CarParkingFunc {
static Future<CarParkingModel> getCarParkingModels() async {
// return
}
}

@ -41,13 +41,16 @@ class _CarParkingPageState extends State<CarParkingPage> {
return BeeScaffold( return BeeScaffold(
title: '我的车位', title: '我的车位',
actions: [ actions: [
TextButton( // TextButton(
onPressed: () {}, // onPressed: () {},
child: Text('管理车位'), // child: Text('管理车位'),
), // ),
], ],
body: EasyRefresh( body: EasyRefresh(
onRefresh: () async {}, firstRefresh: true,
onRefresh: () async {
await appProvider.updateCarParkingModels();
},
header: MaterialHeader(), header: MaterialHeader(),
emptyWidget: emptyWidget:
appProvider.carParkingModels.isEmpty ? _renderEmptyWidget : null, appProvider.carParkingModels.isEmpty ? _renderEmptyWidget : null,

Loading…
Cancel
Save