|
|
|
@ -13,7 +13,8 @@ class DiscoverPage extends StatefulWidget { |
|
|
|
State<DiscoverPage> createState() => _DiscoverPageState(); |
|
|
|
} |
|
|
|
|
|
|
|
class _DiscoverPageState extends State<DiscoverPage> with AutomaticKeepAliveClientMixin{ |
|
|
|
class _DiscoverPageState extends State<DiscoverPage> |
|
|
|
with AutomaticKeepAliveClientMixin { |
|
|
|
late final RoomController roomController; |
|
|
|
|
|
|
|
List<String> topNav = ["相亲", "聚会脱单"]; |
|
|
|
@ -31,13 +32,10 @@ class _DiscoverPageState extends State<DiscoverPage> with AutomaticKeepAliveClie |
|
|
|
{"isNew": false}, |
|
|
|
]; |
|
|
|
|
|
|
|
List<String> tabList = [ |
|
|
|
"全部", "同城", "相亲视频", "相亲语音" |
|
|
|
]; |
|
|
|
List<String> tabList = ["全部", "同城", "相亲视频", "相亲语音"]; |
|
|
|
|
|
|
|
int active = 0; |
|
|
|
|
|
|
|
|
|
|
|
void changeNav(int active) { |
|
|
|
print("当前项: $active"); |
|
|
|
} |
|
|
|
@ -69,29 +67,33 @@ class _DiscoverPageState extends State<DiscoverPage> with AutomaticKeepAliveClie |
|
|
|
|
|
|
|
child: Column( |
|
|
|
children: [ |
|
|
|
HomeAppbar(topNav: topNav, changeNav: changeNav, right: InkWell( |
|
|
|
onTap: () async { |
|
|
|
await roomController.createRtcChannel(); |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
width: 52.w, |
|
|
|
height: 20.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
HomeAppbar( |
|
|
|
topNav: topNav, |
|
|
|
changeNav: changeNav, |
|
|
|
right: InkWell( |
|
|
|
onTap: () async { |
|
|
|
await roomController.createRtcChannel(); |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
width: 52.w, |
|
|
|
height: 20.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(20.w)), |
|
|
|
color: const Color.fromRGBO(108, 105, 244, 1) |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
"申请红娘", |
|
|
|
style: TextStyle( |
|
|
|
color: const Color.fromRGBO(108, 105, 244, 1), |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
"申请红娘", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 10.w, |
|
|
|
color: Colors.white, |
|
|
|
fontWeight: FontWeight.w500 |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
),), |
|
|
|
), |
|
|
|
Container( |
|
|
|
width: 351.w, |
|
|
|
height: 45.w, |
|
|
|
@ -100,30 +102,41 @@ class _DiscoverPageState extends State<DiscoverPage> with AutomaticKeepAliveClie |
|
|
|
child: Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.start, |
|
|
|
children: [ |
|
|
|
...tabList.asMap().entries.map((entry){ |
|
|
|
...tabList.asMap().entries.map((entry) { |
|
|
|
return Container( |
|
|
|
margin: EdgeInsets.only(right: 27.w), |
|
|
|
child: InkWell( |
|
|
|
onTap: (){ |
|
|
|
onTap: () { |
|
|
|
active = entry.key; |
|
|
|
setState(() { |
|
|
|
|
|
|
|
}); |
|
|
|
setState(() {}); |
|
|
|
}, |
|
|
|
child: Container( |
|
|
|
height: 21.w, |
|
|
|
padding: EdgeInsets.symmetric(horizontal: active == entry.key ? 30.w : 0), |
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
horizontal: active == entry.key ? 30.w : 0, |
|
|
|
), |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(21.w)), |
|
|
|
color: Color.fromRGBO(108, 105, 244, active == entry.key ? 1 : 0) |
|
|
|
borderRadius: BorderRadius.all( |
|
|
|
Radius.circular(21.w), |
|
|
|
), |
|
|
|
color: Color.fromRGBO( |
|
|
|
108, |
|
|
|
105, |
|
|
|
244, |
|
|
|
active == entry.key ? 1 : 0, |
|
|
|
), |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
entry.value, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 12.w, |
|
|
|
color: active == entry.key ? Colors.white :const Color.fromRGBO(51, 51, 51, .7), |
|
|
|
fontWeight: active == entry.key ? FontWeight.w700 : FontWeight.w500 |
|
|
|
fontSize: 12.w, |
|
|
|
color: active == entry.key |
|
|
|
? Colors.white |
|
|
|
: const Color.fromRGBO(51, 51, 51, .7), |
|
|
|
fontWeight: active == entry.key |
|
|
|
? FontWeight.w700 |
|
|
|
: FontWeight.w500, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
@ -141,17 +154,16 @@ class _DiscoverPageState extends State<DiscoverPage> with AutomaticKeepAliveClie |
|
|
|
spacing: 7.w, |
|
|
|
runSpacing: 7.w, |
|
|
|
children: [ |
|
|
|
...liveList.map((e){ |
|
|
|
return LiveItem(item: e,); |
|
|
|
...liveList.map((e) { |
|
|
|
return LiveItem(item: e); |
|
|
|
}), |
|
|
|
|
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
) |
|
|
|
), |
|
|
|
], |
|
|
|
); |
|
|
|
} |
|
|
|
@ -160,8 +172,6 @@ class _DiscoverPageState extends State<DiscoverPage> with AutomaticKeepAliveClie |
|
|
|
bool get wantKeepAlive => true; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class LiveItem extends StatefulWidget { |
|
|
|
final Map item; |
|
|
|
const LiveItem({super.key, required this.item}); |
|
|
|
@ -174,7 +184,7 @@ class _LiveItemState extends State<LiveItem> { |
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return InkWell( |
|
|
|
onTap: (){ |
|
|
|
onTap: () { |
|
|
|
Get.to(() => LiveRoomPage(id: 0)); |
|
|
|
}, |
|
|
|
child: ClipRRect( |
|
|
|
@ -185,7 +195,7 @@ class _LiveItemState extends State<LiveItem> { |
|
|
|
width: 171.w, |
|
|
|
height: 171.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10.w)) |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10.w)), |
|
|
|
), |
|
|
|
child: Image.network( |
|
|
|
"https://picsum.photos/400", |
|
|
|
@ -208,62 +218,63 @@ class _LiveItemState extends State<LiveItem> { |
|
|
|
child: Row( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
SizedBox(width: 5.w,), |
|
|
|
SizedBox(width: 5.w), |
|
|
|
Image.asset( |
|
|
|
Assets.imagesLocationIcon, |
|
|
|
width: 6.w, |
|
|
|
height: 7.w, |
|
|
|
), |
|
|
|
SizedBox(width: 3.w,), |
|
|
|
SizedBox(width: 3.w), |
|
|
|
Text( |
|
|
|
"49.9km", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 8.w, |
|
|
|
color: Colors.white, |
|
|
|
fontWeight: FontWeight.w500 |
|
|
|
fontSize: 8.w, |
|
|
|
color: Colors.white, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
), |
|
|
|
) |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
) |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
if(widget.item["isNew"]) Positioned( |
|
|
|
top: 9.w, |
|
|
|
right: 8.w, |
|
|
|
child: Container( |
|
|
|
width: 39.w, |
|
|
|
height: 13.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
if (widget.item["isNew"]) |
|
|
|
Positioned( |
|
|
|
top: 9.w, |
|
|
|
right: 8.w, |
|
|
|
child: Container( |
|
|
|
width: 39.w, |
|
|
|
height: 13.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(13.w)), |
|
|
|
color: const Color.fromRGBO(0, 0, 0, .3) |
|
|
|
), |
|
|
|
child: Row( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
width: 5.w, |
|
|
|
height: 5.w, |
|
|
|
margin: EdgeInsets.only(right: 3.w), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: const Color.fromRGBO(0, 0, 0, .3), |
|
|
|
), |
|
|
|
child: Row( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
mainAxisAlignment: MainAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
width: 5.w, |
|
|
|
height: 5.w, |
|
|
|
margin: EdgeInsets.only(right: 3.w), |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(5.w)), |
|
|
|
color: const Color.fromRGBO(255, 209, 43, 1) |
|
|
|
color: const Color.fromRGBO(255, 209, 43, 1), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
Text( |
|
|
|
"等待", |
|
|
|
style: TextStyle( |
|
|
|
Text( |
|
|
|
"等待", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 8.w, |
|
|
|
color: Colors.white, |
|
|
|
fontWeight: FontWeight.w500 |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
Positioned( |
|
|
|
left: 9.w, |
|
|
|
bottom: 6.w, |
|
|
|
@ -277,51 +288,54 @@ class _LiveItemState extends State<LiveItem> { |
|
|
|
maxLines: 1, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 8.w, |
|
|
|
color: Colors.white, |
|
|
|
fontWeight: FontWeight.w500 |
|
|
|
fontSize: 8.w, |
|
|
|
color: Colors.white, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(height: 2.w,), |
|
|
|
SizedBox(height: 2.w), |
|
|
|
Row( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
children: [ |
|
|
|
Text( |
|
|
|
"福州 | 28岁", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 11.w, |
|
|
|
color: Colors.white, |
|
|
|
fontWeight: FontWeight.w500 |
|
|
|
fontSize: 11.w, |
|
|
|
color: Colors.white, |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(width: 5.w,), |
|
|
|
if(widget.item["isNew"]) Container( |
|
|
|
width: 32.w, |
|
|
|
height: 10.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all(Radius.circular(10.w)), |
|
|
|
color: const Color.fromRGBO(255, 206, 28, .8) |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
"新人", |
|
|
|
style: TextStyle( |
|
|
|
SizedBox(width: 5.w), |
|
|
|
if (widget.item["isNew"]) |
|
|
|
Container( |
|
|
|
width: 32.w, |
|
|
|
height: 10.w, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: BorderRadius.all( |
|
|
|
Radius.circular(10.w), |
|
|
|
), |
|
|
|
color: const Color.fromRGBO(255, 206, 28, .8), |
|
|
|
), |
|
|
|
child: Center( |
|
|
|
child: Text( |
|
|
|
"新人", |
|
|
|
style: TextStyle( |
|
|
|
fontSize: 8.w, |
|
|
|
color: Colors.white, |
|
|
|
fontWeight: FontWeight.w500 |
|
|
|
fontWeight: FontWeight.w500, |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
) |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
) |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
} |