import 'package:dating_touchme_app/components/page_appbar.dart'; import 'package:dating_touchme_app/components/sphere_cloud.dart'; import 'package:dating_touchme_app/controller/home/real_home_controller.dart'; import 'package:dating_touchme_app/extension/ex_widget.dart'; import 'package:dating_touchme_app/generated/assets.dart'; import 'package:dating_touchme_app/pages/home/real_home_timeline_item.dart'; import 'package:dating_touchme_app/pages/home/test_page.dart'; import 'package:dating_touchme_app/pages/home/user_information_page.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; class RealHomePage extends StatefulWidget { const RealHomePage({super.key}); @override State createState() => _RealHomePageState(); } class _RealHomePageState extends State with AutomaticKeepAliveClientMixin { @override Widget build(BuildContext context) { super.build(context); return GetBuilder( init: RealHomeController(), builder: (controller){ return Stack( children: [ Image.asset( Assets.imagesStarSkyBg, width: 375.w, fit: BoxFit.cover, alignment: AlignmentGeometry.topCenter, ), Scaffold( backgroundColor: Colors.transparent, appBar: PageAppbar(title: "星球奇遇记", color: Colors.white, backgroundColor: Colors.transparent,), body: Container( width: 375.w, padding: EdgeInsets.symmetric(horizontal: 15.w), child: SingleChildScrollView( child: Column( children: [ SizedBox( width: 345.w, height: 345.w, child: SphereCloud( itemSize: 36.w, items: [ ...controller.recommendFeed.map((e){ return SizedBox( width: 36.w, child: Column( children: [ Text( e.nickName, maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle( fontSize: 12.w, color: Colors.white, fontWeight: FontWeight.w400 ), ), Image.asset( Assets.imagesStar, width: 18.w, height: 18.w, fit: BoxFit.cover, ) ], ), ).onTap((){ Get.to(() => UserInformationPage(miId: e.miId, userId: e.userId,)); }); }), ] ), ), Container( width: 92.w, height: 21.w, margin: EdgeInsets.symmetric(vertical: 20.w), decoration: BoxDecoration( borderRadius: BorderRadius.all(Radius.circular(21.w)), color: const Color.fromRGBO(255, 255, 255, .1) ), child: Row( mainAxisAlignment: MainAxisAlignment.center, children: [ Icon( Icons.autorenew, size: 18.w, color: Colors.white, ), SizedBox(width: 4.w,), Text( "换一批", style: TextStyle( fontSize: 12.w, color: Colors.white ), ) ], ), ).onTap((){ controller.getListData(); }), Row( children: [ Text( "趣味测试", style: TextStyle( fontSize: 16.w, color: Colors.white ), ) ], ), SizedBox(height: 7.w,), Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Image.asset( Assets.imagesTest1, width: 170.w, ).onTap(() { Get.to(() => TestPage(type: 1,)); }), Image.asset( Assets.imagesTest2, width: 170.w, ).onTap(() { Get.to(() => TestPage(type: 2,)); }), ], ), SizedBox(height: 15.w,), Row( children: [ Text( "热门帖子", style: TextStyle( fontSize: 16.w, color: Colors.white ), ) ], ), SizedBox(height: 7.w,), Wrap( spacing: 5.w, runSpacing: 5.w, children: [ ...controller.postList.map((e){ return RealHomeTimelineItem(item: e); }), ], ) ], ), ), ), ) ], ); }, ); } @override bool get wantKeepAlive => true; }