FondleTalk/lib/tools/chat/chat_info_page.dart
2024-07-16 22:23:54 +08:00

235 lines
9.9 KiB
Dart

import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import '../../beans/character_info_bean.dart';
///人物详情页
class ChatInfoPage extends StatefulWidget {
CharacterInfoBean data;
ChatInfoPage({required this.data});
@override
State<ChatInfoPage> createState() => _ChatInfoPageState();
}
class _ChatInfoPageState extends State<ChatInfoPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
CachedNetworkImage(
fit: BoxFit.fitHeight,
imageUrl: widget.data.bgUrl!,
errorWidget: (context, url, error) => const Icon(Icons.error),
),
NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return [
SliverOverlapAbsorber(
handle: NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: SliverAppBar(
backgroundColor: const Color(0x00FFFFFF),
automaticallyImplyLeading: false,
elevation: 0.0,
forceElevated: false,
centerTitle: true,
floating: false,
expandedHeight: 260,
pinned: true,
title: Row(
children: [
Container(
padding: const EdgeInsets.all(10),
child: GestureDetector(
onTap: () {
Navigator.pop(context);
},
child: const Image(
width: 24,
height: 24,
image: AssetImage('assets/images/ic_back1.png'),
),
),
)
],
),
// flexibleSpace: FlexibleSpaceBar(
// background: Container(
// child: Column(
// children: [
// Container(
// height: 260,
// ),
// Container(
// width: MediaQuery.of(context).size.width,
// height: 114,
// color: Color(0x331F1F1F),
// child: Image(
// width: 48,
// height: 48,
// image: AssetImage('assets/images/img_head2.png'),
// ),
// ),
// ],
// ),
// ),
// ),
),
),
];
// SliverPersistentHeader(delegate: null,);
},
body: Container(
decoration: const BoxDecoration(
gradient: LinearGradient(
colors: [Color(0x001f1f1f), Color(0xFF000000), Color(0xFF000000)], // 三色渐变数组
begin: Alignment.topCenter, // 渐变开始位置
end: Alignment.bottomCenter, // 渐变结束位置
),
),
child: SingleChildScrollView(
child: Column(
children: [
Container(
margin: EdgeInsets.only(top: 114),
),
SizedBox(
width: MediaQuery.of(context).size.width,
height: 80,
child: Stack(
alignment: Alignment.center,
children: [
Positioned(
left: 16,
child: Row(
children: [
///名字
Text(
widget.data.characterName!,
style: TextStyle(fontSize: 18, color: Colors.white),
),
///性别
Container(
margin: EdgeInsets.only(left: 10),
child: Image(
width: 13,
image: widget.data.gender == 1
? const AssetImage('assets/images/ic_woman.png')
: const AssetImage('assets/images/ic_man.png'),
),
)
],
),
),
Positioned(
left: 16,
bottom: 10,
child: Text(
'ID ${widget.data.characterId}',
style: const TextStyle(fontSize: 10, color: Color(0xFFC2C2C2)),
),
),
],
),
),
Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(left: 16, top: 20),
child: const Text(
'关于 TA',
style: TextStyle(color: Colors.white, fontSize: 15),
),
),
Container(
width: MediaQuery.of(context).size.width,
margin: const EdgeInsets.symmetric(horizontal: 16, vertical: 24),
padding: const EdgeInsets.symmetric(vertical: 20, horizontal: 19),
decoration: const BoxDecoration(
color: Color(0x992A2A2A),
borderRadius: BorderRadius.all(Radius.circular(7)),
),
child: Column(
children: [
Container(
alignment: Alignment.centerLeft,
child: const Text(
'简介',
style: TextStyle(color: Colors.white, fontSize: 14),
),
),
Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(top: 9),
child: Text(
widget.data.biography!,
style: const TextStyle(color: Color(0xFF979797), fontSize: 13),
),
),
Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(top: 17),
child: const Text(
'开场白',
style: TextStyle(color: Colors.white, fontSize: 14),
),
),
Container(
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(top: 9),
child: Text(
widget.data.prologue!,
style: TextStyle(color: Color(0xFF979797), fontSize: 13),
),
),
Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(top: 17),
child: const Text(
'标签',
style: TextStyle(color: Colors.white, fontSize: 14),
),
),
Container(
alignment: Alignment.centerLeft,
margin: const EdgeInsets.only(top: 12),
child: Wrap(
spacing: 5.0,
// gap between adjacent boxes
runSpacing: 8.0,
// vertical gap
alignment: WrapAlignment.start,
crossAxisAlignment: WrapCrossAlignment.center,
direction: Axis.horizontal,
children: <Widget>[
for (int i = 0; i < widget.data.label!.length; i++)
Container(
padding: const EdgeInsets.symmetric(horizontal: 11, vertical: 2),
decoration: BoxDecoration(
borderRadius: const BorderRadius.all(Radius.circular(10)),
border: Border.all(color: const Color(0xFFFF9000), width: 0.33)),
child: Text(
widget.data.label![i].name.toString(),
style: TextStyle(fontSize: 10, color: Color(0xFFFF9000)),
),
),
],
),
),
],
),
),
],
),
),
),
),
],
),
);
}
}