便民电话

pull/1/head
张萌 3 years ago
parent 6195daa49c
commit c5feb7e9b7

@ -1,21 +0,0 @@
class ConvenientPhoneModel {
int? id;
String? name;
String? tel;
ConvenientPhoneModel({this.id, this.name, this.tel});
ConvenientPhoneModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
tel = json['tel'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
data['tel'] = this.tel;
return data;
}
}

@ -0,0 +1,26 @@
import 'package:json_annotation/json_annotation.dart';
import 'package:equatable/equatable.dart';
part 'convenience_phone_model.g.dart';
@JsonSerializable()
class ConveniencePhoneModel extends Equatable {
final int id;
final String name;
final String tel;
final int type;
factory ConveniencePhoneModel.fromJson(Map<String, dynamic> json) =>
_$ConveniencePhoneModelFromJson(json);
const ConveniencePhoneModel({
required this.id,
required this.name,
required this.tel,
required this.type,
});
@override
List<Object?> get props => [id, name, tel, type,];
}

@ -0,0 +1,16 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'convenience_phone_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
ConveniencePhoneModel _$ConveniencePhoneModelFromJson(
Map<String, dynamic> json) =>
ConveniencePhoneModel(
id: json['id'] as int,
name: json['name'] as String,
tel: json['tel'] as String,
type: json['type'] as int,
);

@ -1,7 +1,7 @@
import 'package:aku_new_community/const/resource.dart';
import 'package:aku_new_community/constants/api.dart';
import 'package:aku_new_community/model/user/convenient_phone_model.dart';
import 'package:aku_new_community/pages/things_page/widget/bee_list_view.dart';
import 'package:aku_new_community/constants/saas_api.dart';
import 'package:aku_new_community/models/convenience_phone/convenience_phone_model.dart';
import 'package:aku_new_community/utils/network/net_util.dart';
import 'package:aku_new_community/widget/bee_scaffold.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
@ -19,8 +19,10 @@ class ConvenientPhonePage extends StatefulWidget {
}
class _ConvenientPhonePageState extends State<ConvenientPhonePage> {
EasyRefreshController? _easyRefreshController;
TextEditingController? _textEditingController;
late EasyRefreshController _easyRefreshController;
late TextEditingController _textEditingController;
List<ConveniencePhoneModel> _models = [];
@override
void initState() {
@ -31,12 +33,12 @@ class _ConvenientPhonePageState extends State<ConvenientPhonePage> {
@override
void dispose() {
_easyRefreshController?.dispose();
_textEditingController?.dispose();
_easyRefreshController.dispose();
_textEditingController.dispose();
super.dispose();
}
Widget _buildTile(ConvenientPhoneModel model) {
Widget _buildTile(ConveniencePhoneModel model) {
return Column(
children: [
Row(
@ -45,9 +47,9 @@ class _ConvenientPhonePageState extends State<ConvenientPhonePage> {
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
model.name!.text.black.size(32.sp).make(),
model.name.text.black.size(32.sp).make(),
12.w.heightBox,
model.tel!.text.color(Color(0xFF999999)).size(28.sp).make(),
model.tel.text.color(Color(0xFF999999)).size(28.sp).make(),
],
).expand(),
IconButton(
@ -58,7 +60,7 @@ class _ConvenientPhonePageState extends State<ConvenientPhonePage> {
),
onPressed: () async {
bool? result = await Get.dialog(CupertinoAlertDialog(
title: model.tel!.text.isIntrinsic.make(),
title: '是否拨打电话 ${model.tel}'.text.isIntrinsic.make(),
actions: [
CupertinoDialogAction(
child: '取消'.text.isIntrinsic.make(),
@ -99,8 +101,8 @@ class _ConvenientPhonePageState extends State<ConvenientPhonePage> {
),
child: TextField(
controller: _textEditingController,
onSubmitted: (value) {
_easyRefreshController!.callRefresh();
onChanged: (value) {
_easyRefreshController.callRefresh();
setState(() {});
},
decoration: InputDecoration(
@ -119,32 +121,36 @@ class _ConvenientPhonePageState extends State<ConvenientPhonePage> {
),
),
Expanded(
child: BeeListView<ConvenientPhoneModel>(
extraParams: {'name': _textEditingController!.text},
child: EasyRefresh(
firstRefresh: true,
header: MaterialHeader(),
controller: _easyRefreshController,
path: API.manager.convenientPhone,
convert: (model) {
return model.rows
.map((e) => ConvenientPhoneModel.fromJson(e))
.toList();
},
builder: (items) {
return ListView.separated(
padding:
EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
itemBuilder: (context, index) {
return _buildTile(items[index]);
},
separatorBuilder: (context, index) {
return Divider(
thickness: 1.w,
height: 40.w,
color: Color(0xFFD8D8D8),
);
},
itemCount: items.length,
);
onRefresh: () async {
var base =
await NetUtil().get(SAASAPI.conveniencePhone.list, params: {
'name': _textEditingController.text,
});
if (base.success) {
_models = (base.data as List)
.map((e) => ConveniencePhoneModel.fromJson(e))
.toList();
}
setState(() {});
},
child: ListView.separated(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
itemBuilder: (context, index) {
return _buildTile(_models[index]);
},
separatorBuilder: (context, index) {
return Divider(
thickness: 1.w,
height: 40.w,
color: Color(0xFFD8D8D8),
);
},
itemCount: _models.length,
),
),
),
],

@ -146,6 +146,8 @@ class _BalanceRecordViewState extends State<BalanceRecordView> {
_models = baseList.rows
.map((e) => TradeRecordListModel.fromJson(e))
.toList();
setState(() {});
},
onLoad: () async {
_pageNum++;
@ -164,6 +166,7 @@ class _BalanceRecordViewState extends State<BalanceRecordView> {
} else {
_refreshController.finishLoad(noMore: true);
}
setState(() {});
},
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),

@ -146,6 +146,7 @@ class _PointRecordViewState extends State<PointRecordView> {
_models = baseList.rows
.map((e) => TradeRecordListModel.fromJson(e))
.toList();
setState(() {});
},
onLoad: () async {
_pageNum++;
@ -164,6 +165,7 @@ class _PointRecordViewState extends State<PointRecordView> {
} else {
_refreshController.finishLoad(noMore: true);
}
setState(() {});
},
child: ListView(
padding: EdgeInsets.symmetric(horizontal: 32.w, vertical: 24.w),
@ -193,8 +195,8 @@ class _PointRecordViewState extends State<PointRecordView> {
.text
.size(28.sp)
.color(incom(model.type)
? Colors.red
: Colors.black.withOpacity(0.85))
? Colors.red
: Colors.black.withOpacity(0.85))
.make(),
],
),

@ -81,8 +81,6 @@ class ApplicationUtil {
title: '便民电话',
imgPath: Assets.newIcon.imgBmdh.path,
onTap: () {
BotToast.showText(text: '此功能暂未上线');
return;
Get.to(() => ConvenientPhonePage());
}),
AppElement(
@ -170,8 +168,6 @@ class ApplicationUtil {
title: '社区介绍',
imgPath: Assets.newIcon.icSqjs.path,
onTap: () {
// BotToast.showText(text: '此功能升级中,敬请期待');
// return;
Get.to(() => CommunityIntroducePage());
}),
// AppElement('家政服务', R.ASSETS_ICONS_FUNC_JZFW_PNG, () => HouseKeepingPage()),

Loading…
Cancel
Save