Browse Source

排版聊天页,我的页

master
YakumoChen 5 months ago
parent
commit
9b30400f5d
18 changed files with 608 additions and 2 deletions
  1. BIN
      assets/arrow.png
  2. BIN
      assets/blind_data.png
  3. BIN
      assets/cert.png
  4. BIN
      assets/customer.png
  5. BIN
      assets/edit.png
  6. BIN
      assets/index_bg.png
  7. BIN
      assets/mail.png
  8. BIN
      assets/make_friend.png
  9. BIN
      assets/rose.png
  10. BIN
      assets/setting.png
  11. BIN
      assets/shop.png
  12. BIN
      assets/system_notifi.png
  13. BIN
      assets/vip.png
  14. BIN
      assets/vip_banner.png
  15. BIN
      assets/wallet.png
  16. 1
      lib/components/home_appbar.dart
  17. 290
      lib/pages/chat_page.dart
  18. 319
      lib/pages/my_page.dart

BIN
assets/arrow.png

Before After
Width: 23  |  Height: 38  |  Size: 321 B

BIN
assets/blind_data.png

Before After
Width: 38  |  Height: 32  |  Size: 392 B

BIN
assets/cert.png

Before After
Width: 85  |  Height: 85  |  Size: 2.0 KiB

BIN
assets/customer.png

Before After
Width: 96  |  Height: 96  |  Size: 1.2 KiB

BIN
assets/edit.png

Before After
Width: 41  |  Height: 41  |  Size: 502 B

BIN
assets/index_bg.png

Before After
Width: 5377  |  Height: 3904  |  Size: 3.0 MiB

BIN
assets/mail.png

Before After
Width: 96  |  Height: 96  |  Size: 958 B

BIN
assets/make_friend.png

Before After
Width: 40  |  Height: 32  |  Size: 433 B

BIN
assets/rose.png

Before After
Width: 85  |  Height: 85  |  Size: 2.0 KiB

BIN
assets/setting.png

Before After
Width: 96  |  Height: 96  |  Size: 1.5 KiB

BIN
assets/shop.png

Before After
Width: 85  |  Height: 85  |  Size: 1.8 KiB

BIN
assets/system_notifi.png

Before After
Width: 185  |  Height: 185  |  Size: 4.6 KiB

BIN
assets/vip.png

Before After
Width: 176  |  Height: 64  |  Size: 3.5 KiB

BIN
assets/vip_banner.png

Before After
Width: 2139  |  Height: 385  |  Size: 79 KiB

BIN
assets/wallet.png

Before After
Width: 85  |  Height: 85  |  Size: 2.0 KiB

1
lib/components/home_appbar.dart

@ -19,6 +19,7 @@ class _HomeAppbarState extends State<HomeAppbar> {
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.only(top: MediaQuery.of(context).padding.top),
color: Colors.transparent,
child: Container(
height: ScreenUtil().setWidth(108),
padding: EdgeInsets.symmetric(

290
lib/pages/chat_page.dart

@ -1,4 +1,6 @@
import 'package:dating_touchme_app/components/home_appbar.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class ChatPage extends StatefulWidget {
const ChatPage({super.key});
@ -8,9 +10,295 @@ class ChatPage extends StatefulWidget {
}
class _ChatPageState extends State<ChatPage> {
List<String> topNav = ["聊天", "好友"];
List<Map> chatList = [
{"avatar": "assets/system_notifi.png", "isOnline": false, "userName": "系统通知", "messageNum": 2, "lastMessage": "在干嘛"},
{"avatar": "assets/user_avatar.png", "isOnline": true, "userName": "林园园", "messageNum": 2, "lastMessage": "在干嘛"},
{"avatar": "assets/user_avatar.png", "isOnline": false, "userName": "李晖", "messageNum": 0, "lastMessage": "好的"},
{"avatar": "assets/user_avatar.png", "isOnline": false, "userName": "李哲", "messageNum": 0, "lastMessage": "在干嘛"},
{"avatar": "assets/user_avatar.png", "isOnline": false, "userName": "李夏", "messageNum": 0, "lastMessage": "在干嘛"},
];
List<Map> topList = [
{"isFriend": false},
{"isFriend": true},
{"isFriend": false},
{"isFriend": false},
{"isFriend": false},
{"isFriend": true},
{"isFriend": false},
{"isFriend": false},
{"isFriend": false},
{"isFriend": true},
{"isFriend": false},
{"isFriend": false},
];
void changeNav(int active) {
print("当前项: $active");
}
@override
Widget build(BuildContext context) {
return Text("聊天页面");
return Container(
constraints: BoxConstraints(minHeight: ScreenUtil().setHeight(1220)),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color.fromRGBO(248, 242, 255, 1.0), // rgba(248, 242, 255, 1)
Color.fromRGBO(247, 247, 247, 1.0), // rgba(247, 247, 247, 1)
],
stops: [0.0, 1.0],
),
),
child: Column(
children: [
HomeAppbar(topNav: topNav, changeNav: changeNav,),
Container(
width: 750.w,
padding: EdgeInsets.only(
top: 5.w,
bottom: 46.w
),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(width: 11.w,),
...topList.map((e){
return TopItem(item: e);
}),
],
),
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 31.w),
child: Column(
children: [
...chatList.map((e){
return ChatItem(item: e);
}),
],
),
)
],
),
);
}
}
class ChatItem extends StatefulWidget {
final Map item;
const ChatItem({super.key, required this.item});
@override
State<ChatItem> createState() => _ChatItemState();
}
class _ChatItemState extends State<ChatItem> {
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(vertical: 15.w),
margin: EdgeInsets.only(bottom: 15.w),
child: Row(
children: [
Stack(
children: [
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(92.w)),
child: Image.asset(
widget.item["avatar"],
width: 92.w,
height: 92.w,
),
),
if(widget.item["isOnline"]) Positioned(
right: 0,
bottom: 0,
child: Container(
width: 22.w,
height: 22.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(22.w)),
color: const Color.fromRGBO(43, 255, 132, 1)
),
),
),
],
),
SizedBox(width: 17.w,),
SizedBox(
width: 578.w,
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
widget.item["userName"],
style: TextStyle(
fontSize: 27.w,
color: const Color.fromRGBO(51, 51, 51, 1),
fontWeight: FontWeight.w500
),
),
Text(
"19.24",
style: TextStyle(
fontSize: 23.w,
color: const Color.fromRGBO(51, 51, 51, .6),
),
)
],
),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
widget.item["lastMessage"],
style: TextStyle(
fontSize: 23.w,
color: const Color.fromRGBO(51, 51, 51, .6),
),
),
if(widget.item["messageNum"] > 0) Container(
width: 38.w,
height: 38.w,
margin: EdgeInsets.only(right: 9.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(38.w)),
color: const Color.fromRGBO(255, 87, 51, 1)
),
child: Center(
child: Text(
"${widget.item["messageNum"]}",
style: TextStyle(
fontSize: 23.w,
color: Colors.white
),
),
),
)
],
)
],
),
)
],
),
);
}
}
class TopItem extends StatefulWidget {
final Map item;
const TopItem({super.key, required this.item});
@override
State<TopItem> createState() => _TopItemState();
}
class _TopItemState extends State<TopItem> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 16.w),
child: Stack(
children: [
SizedBox(
width: 101.w,
height: 101.w,
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(101.w)),
child: Container(
padding: EdgeInsets.all(4.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(101.w)),
border: Border.all(width: 1, color: widget.item["isFriend"] ? const Color.fromRGBO(115, 143, 255, 1) : const Color.fromRGBO(255, 115, 164, 1))
),
child: Image.asset(
"assets/user_avatar.png",
width: 92.w,
height: 92.w,
),
),
),
),
if(!widget.item["isFriend"]) Positioned(
bottom: 0,
left: 13.w,
child: Container(
width: 76.w,
height: 24.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(24.w)),
color: const Color.fromRGBO(255, 115, 164, 1)
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/blind_data.png",
width: 19.w,
height: 16.w,
),
SizedBox(width: 4.w,),
Text(
"相亲",
style: TextStyle(
fontSize: 16.w,
color: Colors.white,
fontWeight: FontWeight.w500
),
)
],
),
),
),
if(widget.item["isFriend"]) Positioned(
bottom: 0,
left: 13.w,
child: Container(
width: 76.w,
height: 24.w,
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(24.w)),
color: const Color.fromRGBO(115, 143, 255, 1)
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
"assets/make_friend.png",
width: 20.w,
height: 16.w,
),
SizedBox(width: 4.w,),
Text(
"交友",
style: TextStyle(
fontSize: 16.w,
color: Colors.white,
fontWeight: FontWeight.w500
),
)
],
),
),
),
],
),
);
}
}

319
lib/pages/my_page.dart

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
class MyPage extends StatefulWidget {
const MyPage({super.key});
@ -8,8 +9,324 @@ class MyPage extends StatefulWidget {
}
class _MyPageState extends State<MyPage> {
List<Map> infoList = [
{"label": "我的关注", "num": 88},
{"label": "关注我的", "num": 18988},
{"label": "好友", "num": 8},
{"label": "访客", "num": 357},
];
List<Map> blockList = [
{"icon": "assets/rose.png", "title": "我的玫瑰", "subTitle": "新人限时福利"},
{"icon": "assets/wallet.png", "title": "我的钱包", "subTitle": "提现无门槛"},
{"icon": "assets/shop.png", "title": "商城中心", "subTitle": "不定期更新商品"},
{"icon": "assets/cert.png", "title": "认证中心 ", "subTitle": "未认证"},
];
List<Map> settingList = [
{"icon": "assets/setting.png", "title": "设置"},
{"icon": "assets/customer.png", "title": "联系客服"},
{"icon": "assets/mail.png", "title": "意见反馈"},
];
@override
Widget build(BuildContext context) {
return Container(
padding: EdgeInsets.symmetric(horizontal: 19.w),
constraints: BoxConstraints(minHeight: ScreenUtil().setHeight(1220)),
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Color.fromRGBO(248, 242, 255, 1.0), // rgba(248, 242, 255, 1)
Color.fromRGBO(247, 247, 247, 1.0), // rgba(247, 247, 247, 1)
],
stops: [0.0, 1.0],
),
),
child: Column(
children: [
SizedBox(
height: MediaQuery.of(context).padding.top + 108.w,
),
Container(
width: 713.w,
padding: EdgeInsets.only(
left: 12.w,
right: 10.w
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Image.asset(
"assets/user_avatar.png",
width: 120.w,
height: 120.w,
),
SizedBox(width: 29.w,),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
"用户昵称",
style: TextStyle(
fontSize: 36.w,
color: const Color.fromRGBO(51, 51, 51, 1),
fontWeight: FontWeight.w700
),
),
SizedBox(width: 17.w,),
Image.asset(
"assets/vip.png",
width: 88.w,
height: 32.w,
)
],
),
SizedBox(height: 23.w,),
Text(
"ID:4654654565",
style: TextStyle(
fontSize: 24.w,
color: const Color.fromRGBO(51, 51, 51, 1),
fontWeight: FontWeight.w500
),
)
],
)
],
),
Row(
children: [
Image.asset(
"assets/edit.png",
width: 20.w,
height: 20.w,
),
SizedBox(width: 8.w,),
Text(
"编辑资料",
style: TextStyle(
fontSize: 24.w,
color: const Color.fromRGBO(55, 57, 72, 1),
fontWeight: FontWeight.w500
),
)
],
)
],
),
),
SizedBox(height: 33.w,),
Container(
height: 114.w,
padding: EdgeInsets.only(
top: 22.w,
right: 75.w,
bottom: 17.w,
left: 55.w
),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(18.w)),
color: Colors.white,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
...infoList.map((e){
return InfoItem(item: e);
}),
],
),
),
SizedBox(height: 25.w,),
Stack(
children: [
Image.asset(
"assets/vip_banner.png",
width: 713.w,
height: 129.w,
),
Positioned(
top: 36.w,
right: 31.w,
child: InkWell(
child: SizedBox(
width: 147.w,
height: 57.w,
),
),
)
],
),
SizedBox(height: 25.w,),
Wrap(
spacing: 17.w,
runSpacing: 17.w,
children: [
...blockList.map((e){
return BlockItem(item: e);
}),
],
),
SizedBox(height: 25.w,),
...settingList.map((e){
return SettingItem(item: e);
}),
],
),
);
}
}
class InfoItem extends StatefulWidget {
final Map item;
const InfoItem({super.key, required this.item});
@override
State<InfoItem> createState() => _InfoItemState();
}
class _InfoItemState extends State<InfoItem> {
@override
Widget build(BuildContext context) {
return Column(
children: [
Text(
"${widget.item["num"]}",
style: TextStyle(
fontSize: 30.w,
color: Colors.black,
fontWeight: FontWeight.w700
),
),
Text(
widget.item["label"],
style: TextStyle(
fontSize: 21.w,
color: const Color.fromRGBO(166, 166, 166, 1),
),
)
],
);
}
}
class BlockItem extends StatefulWidget {
final Map item;
const BlockItem({super.key, required this.item});
@override
State<BlockItem> createState() => _BlockItemState();
}
class _BlockItemState extends State<BlockItem> {
@override
Widget build(BuildContext context) {
return Container(
width: 340.w,
height: 77.w,
padding: EdgeInsets.symmetric(horizontal: 15.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(18.w)),
color: Colors.white
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Image.asset(
widget.item["icon"],
width: 42.w,
height: 42.w,
),
SizedBox(width: 5.w,),
Text(
widget.item["title"],
style: TextStyle(
fontSize: 25.w,
color: Colors.black,
),
)
],
),
Row(
children: [
Container(
width: 10.w,
height: 10.w,
margin: EdgeInsets.only(right: 9.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(10.w)),
color: const Color.fromRGBO(255, 87, 51, 1)
),
),
Text(
widget.item["subTitle"],
style: TextStyle(
fontSize: 18.w,
color: const Color.fromRGBO(166, 166, 166, 1)
),
)
],
)
],
),
);
}
}
class SettingItem extends StatefulWidget {
final Map item;
const SettingItem({super.key, required this.item});
@override
State<SettingItem> createState() => _SettingItemState();
}
class _SettingItemState extends State<SettingItem> {
@override
Widget build(BuildContext context) {
return Text("我的");
return Container(
height: 96.w,
padding: EdgeInsets.symmetric(horizontal: 32.w),
color: Colors.white,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Image.asset(
widget.item["icon"],
width: 48.w,
height: 48.w,
),
SizedBox(width: 8.w,),
Text(
widget.item["title"],
style: TextStyle(
fontSize: 28.w,
fontWeight: FontWeight.w500,
color: Colors.black
),
)
],
),
Image.asset(
"assets/arrow.png",
width: 8.w,
height: 16.w,
)
],
),
);
}
}
Loading…
Cancel
Save