提交 0d39e86f authored 作者: yueweilu's avatar yueweilu

入口

上级 c47127be
...@@ -5,8 +5,10 @@ class ReadModel { ...@@ -5,8 +5,10 @@ class ReadModel {
ReadModel({ ReadModel({
required this.value, required this.value,
required this.name, required this.name,
this.link,
}); });
String value; String value;
String name; String name;
String? link;
} }
\ No newline at end of file
...@@ -42,15 +42,15 @@ class MineController extends GetxController { ...@@ -42,15 +42,15 @@ class MineController extends GetxController {
void _getInfo() async { void _getInfo() async {
userInfo = await MineAPI.userInfo(); userInfo = await MineAPI.userInfo();
reads = [ reads = [
ReadModel(name: '笔记',value: userInfo['note_nums'].toString()), ReadModel(name: '笔记',value: userInfo['note_nums'].toString(),),
ReadModel(name: '讨论',value: userInfo['comment_nums'].toString()), ReadModel(name: '讨论',value: userInfo['comment_nums'].toString()),
ReadModel(name: '错题',value: userInfo['wrong_nums'].toString()), ReadModel(name: '错题',value: userInfo['wrong_nums'].toString()),
ReadModel(name: '收藏',value: userInfo['collect_nums'].toString()) ReadModel(name: '收藏',value: userInfo['collect_nums'].toString())
]; ];
accounts = [ accounts = [
ReadModel(name: '优惠券',value: userInfo['coupon_nums'].toString()), ReadModel(name: '优惠券',value: userInfo['coupon_nums'].toString()),
ReadModel(name: '积分',value: userInfo['integral_nums'].toString()), ReadModel(name: '积分',value: userInfo['integral_nums'].toString(),link: Routes.coin),
ReadModel(name: '紫金币',value: userInfo['bean_nums'].toString()), ReadModel(name: '紫金币',value: userInfo['bean_nums'].toString(),link: Routes.coin),
ReadModel(name: '订单',value: userInfo['orders_nums'].toString()) ReadModel(name: '订单',value: userInfo['orders_nums'].toString())
]; ];
update(); update();
......
...@@ -71,7 +71,7 @@ class _MinePageState extends State<MinePage> { ...@@ -71,7 +71,7 @@ class _MinePageState extends State<MinePage> {
},), },),
Gaps.vGaps10, Gaps.vGaps10,
BuildRead(items: controller.reads), BuildRead(items: controller.reads),
controller.ads.isNotEmpty?Gaps.vGaps10:SizedBox(), controller.ads.isNotEmpty?Gaps.vGaps10:const SizedBox(),
controller.ads.isNotEmpty? controller.ads.isNotEmpty?
Container( Container(
color: Colors.transparent, color: Colors.transparent,
...@@ -97,10 +97,10 @@ class _MinePageState extends State<MinePage> { ...@@ -97,10 +97,10 @@ class _MinePageState extends State<MinePage> {
child: Column( child: Column(
children: [ children: [
_buildItem('账户安全', ''), _buildItem('账户安全', ''),
Container(color: Colours.cLine,margin: EdgeInsets.symmetric(horizontal: 15),height: 1,), Container(color: Colours.cLine,margin: const EdgeInsets.symmetric(horizontal: 15),height: 1,),
_buildItem('意见反馈', ''), _buildItem('意见反馈', ''),
Container(color: Colours.cLine,margin: EdgeInsets.symmetric(horizontal: 15),height: 1,), Container(color: Colours.cLine,margin: const EdgeInsets.symmetric(horizontal: 15),height: 1,),
_buildItem('关于我们', ''), _buildItem('关于我们', Routes.about),
], ],
), ),
), ),
...@@ -115,6 +115,7 @@ class _MinePageState extends State<MinePage> { ...@@ -115,6 +115,7 @@ class _MinePageState extends State<MinePage> {
Widget _buildItem(String title, String linkTo,{VoidCallback? onTap}) { Widget _buildItem(String title, String linkTo,{VoidCallback? onTap}) {
return GestureDetector( return GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: (){ onTap: (){
if (linkTo.isNotEmpty){ if (linkTo.isNotEmpty){
context.pushNamed(linkTo); context.pushNamed(linkTo);
...@@ -122,13 +123,13 @@ class _MinePageState extends State<MinePage> { ...@@ -122,13 +123,13 @@ class _MinePageState extends State<MinePage> {
} }
}, },
child: Container( child: Container(
padding: EdgeInsets.only(left: 18,right: 15), padding: const EdgeInsets.only(left: 18,right: 15),
height: 42, height: 42,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Text('$title',style: TextStyle(fontSize: 14,color: Colours.c3,),), Text(title,style: const TextStyle(fontSize: 14,color: Colours.c3,),),
Container( Container(
width: 5, width: 5,
height: 8, height: 8,
......
...@@ -2,9 +2,10 @@ part of mine; ...@@ -2,9 +2,10 @@ part of mine;
class BuildAccount extends StatelessWidget { class BuildAccount extends StatelessWidget {
final List<ReadModel> items ; final List<ReadModel> items ;
final void Function()? onTap;
const BuildAccount({ const BuildAccount({
super.key, super.key,
this.onTap,
this.items = const [] this.items = const []
}); });
...@@ -35,22 +36,30 @@ class BuildAccount extends StatelessWidget { ...@@ -35,22 +36,30 @@ class BuildAccount extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: items.map((model){ children: items.map((model){
return Column( return GestureDetector(
children: [ onTap: (){
Container( if (model.link != null){
width: 25.w, context.pushNamed(model.link!);
height: 25.w, if (onTap !=null) onTap;
color: Colors.green, }
), },
Gaps.vGaps5, child: Column(
Text(model.name,style: TextStyle(fontSize:12.w,height: 1.6,color: Colours.c9),), children: [
items.indexOf(model) == 0?Row( Container(
children: [ width: 25.w,
Text(model.value.toString(),style: TextStyle(fontSize: 16,height: 1.6,fontWeight: Fonts.medium,color: AppTheme.primary,),), height: 25.w,
const Text('张',style: TextStyle(fontSize: 12,height:1.6,color: Colours.c3),) color: Colors.green,
], ),
):Text(model.value.toString(),style: TextStyle(fontSize: 16,height:1.6,color: Colours.c3),) Gaps.vGaps5,
], Text(model.name,style: TextStyle(fontSize:12.w,height: 1.6,color: Colours.c9),),
items.indexOf(model) == 0?Row(
children: [
Text(model.value.toString(),style: TextStyle(fontSize: 16,height: 1.6,fontWeight: Fonts.medium,color: AppTheme.primary,),),
const Text('张',style: TextStyle(fontSize: 12,height:1.6,color: Colours.c3),)
],
):Text(model.value.toString(),style: TextStyle(fontSize: 16,height:1.6,color: Colours.c3),)
],
),
); );
} ).toList(), } ).toList(),
), ),
......
...@@ -31,12 +31,21 @@ class BuildRead extends StatelessWidget { ...@@ -31,12 +31,21 @@ class BuildRead extends StatelessWidget {
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly, mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: items.map((model){ children: items.map((model){
return Column( return GestureDetector(
children: [ behavior: HitTestBehavior.opaque,
Text(model.value,style: const TextStyle(fontSize: 18,height: 1.6,fontWeight: Fonts.medium,color: Colours.c3),), onTap: (){
Gaps.vGaps5, if (model.link != null){
Text(model.name,style: const TextStyle(fontSize: 13,height:1.6,color: Colours.c6)) context.pushNamed(model.link!);
], if (onTap !=null) onTap;
}
},
child: Column(
children: [
Text(model.value,style: const TextStyle(fontSize: 18,height: 1.6,fontWeight: Fonts.medium,color: Colours.c3),),
Gaps.vGaps5,
Text(model.name,style: const TextStyle(fontSize: 13,height:1.6,color: Colours.c6))
],
),
); );
}).toList(), }).toList(),
), ),
......
...@@ -15,13 +15,19 @@ class BuildUser extends StatelessWidget { ...@@ -15,13 +15,19 @@ class BuildUser extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return GestureDetector( return GestureDetector(
onTap: onTap, behavior: HitTestBehavior.opaque,
onTap:onTap,
child: Row( child: Row(
children: [ children: [
Container( Container(
width: 45.w, width: 45.w,
height: 45.w, height: 45.w,
color: Colors.cyan, decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22.5),
color: Colors.cyan,
),
// color: Colors.cyan,
child: CustomImage.network(url: userInfo.containsKey('head_img')?userInfo['head_img']:''),
), ),
Gaps.hGaps10, Gaps.hGaps10,
Column( Column(
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论