first commit

This commit is contained in:
编码猿
2024-09-27 01:31:25 +08:00
commit 07c46ac300
558 changed files with 37414 additions and 0 deletions

View File

@@ -0,0 +1 @@
eb0076cb-897d-4491-b916-cc08023eedc4

View File

@@ -0,0 +1,81 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_modular/flutter_modular.dart';
import 'package:peach/config/_.dart';
import 'package:peach/entity/_.dart';
import 'package:peach/utils/_.dart';
import 'package:peach/service/_.dart';
import 'package:peach/widget/_.dart';
class Mechanism extends StatefulWidget {
@override
State<StatefulWidget> createState() => _Mechanism();
}
class _Mechanism extends State<Mechanism> with AutomaticKeepAliveClientMixin<Mechanism> {
/// 获取机构列表的数据
Future<List<MechanismResult>> GetMechanismData() async {
return await MechanismService.GetMechanismData(params: {});
}
/// 组件
Widget MechanismList(List<MechanismResult> res) {
return SingleChildScrollView(
scrollDirection: Axis.vertical,
physics: BouncingScrollPhysics(),
child: Container(
padding: EdgeInsets.all(Screen.setFontSize(15)),
margin: EdgeInsets.only(top: 15),
child: Wrap(
runAlignment: WrapAlignment.spaceBetween,
children: res.map((e) => Container(
width: Screen.setWidth(86),
margin: EdgeInsets.only(bottom: 20),
child: InkWell(
onTap: () {
Modular.to.pushNamed("/mechanismList/${e.id}/${e.title}/mechanism");
},
child: Column(
children: [
Text(e.title,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: ColorConfig.TitleColor,
fontSize: Screen.setFontSize(16))),
SizedBox(height: 10),
Text(
e.quantity,
style: TextStyle(
color: ColorConfig.ThemeColor,
fontSize: Screen.setFontSize(12)),
)
],
),
),
)).toList()
),
),
);
}
@override
Widget build(BuildContext context) {
super.build(context);
return Scaffold(
appBar: AppBar(
backgroundColor: ColorConfig.ThemeColor,
automaticallyImplyLeading: false,
title: Text("机构"),
),
body: FutureBuilderWidget<List<MechanismResult>>(
future: GetMechanismData,
success: MechanismList,
),
);
}
@override
bool get wantKeepAlive => true;
}

View File

@@ -0,0 +1,89 @@
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:toast/toast.dart';
import 'package:peach/config/_.dart';
import 'package:peach/entity/_.dart';
import 'package:peach/service/_.dart';
import 'package:peach/widget/_.dart';
class MechanismList extends StatefulWidget {
String id;
String title = "";
String type;
int totalPage = 0;
MechanismList({ this.id, this.title, this.type });
@override
State<StatefulWidget> createState() => _MechanismList();
}
class _MechanismList extends State<MechanismList> {
int page = 1;
List<ItemList> Result = [];
@override
void initState() {
switch(widget.type) {
case 'mechanism':
GetmechanismList();
break;
case 'tags':
getClassListData();
break;
}
}
/// 机构列表点击进入详情
Future<void> GetmechanismList() async {
AgentClassListData res = await MechanismService.GetmechanismList(params: { "id": widget.id, "page": page });
setState(() {
Result.addAll(res.list);
widget.totalPage = int.parse(res.total);
page = int.parse(res.page);
});
}
Future<AgentClassListData> getClassListData() async {
AgentClassListData res = await HomeService.GetClassListData(params: { 'id': widget.id, 'page': page });
setState(() {
Result.addAll(res.list);
widget.totalPage = int.parse(res.total);
page = int.parse(res.page);
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
elevation: 0,
backgroundColor: ColorConfig.ThemeColor,
title: Text(widget.title),
),
body: EasyRefresh(
header: BezierCircleHeader(backgroundColor: ColorConfig.ThemeColor),
footer: BezierBounceFooter(backgroundColor: ColorConfig.ThemeColor),
onRefresh: () async {
print("刷新");
},
onLoad: () async {
setState(() {
page+=1;
if (page > widget.totalPage) {
Toast.show("没有数据", context, duration: Toast.LENGTH_SHORT, gravity: Toast.BOTTOM);
} else {
GetmechanismList();
}
});
},
child: ItemWidget(
data: Result,
title: '',
longPress: () {}
),
),
);
}
}