聊天列表顶部遮罩.
This commit is contained in:
parent
48769e1e98
commit
8d21b8755a
|
|
@ -354,15 +354,29 @@ class _ChatPageState extends State<ChatPage> {
|
|||
///聊天列表
|
||||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
controller: _scrollController,
|
||||
itemCount: chatList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return _item(index);
|
||||
}),
|
||||
)),
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: ShaderMask(
|
||||
shaderCallback: (Rect bounds) {
|
||||
return const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Colors.transparent,
|
||||
Colors.white,
|
||||
],
|
||||
stops: [0.0, 0.1], // 调整透明的范围
|
||||
).createShader(bounds);
|
||||
},
|
||||
blendMode: BlendMode.dstIn,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
controller: _scrollController,
|
||||
itemCount: chatList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return _item(index);
|
||||
}),
|
||||
),
|
||||
)),
|
||||
// Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
// margin: EdgeInsets.only(left: 16, bottom: 3),
|
||||
|
|
|
|||
|
|
@ -89,39 +89,41 @@ class _RecommendPageState extends State<RecommendPage> with AutomaticKeepAliveCl
|
|||
Widget build(BuildContext context) {
|
||||
return Stack(
|
||||
children: [
|
||||
Container(
|
||||
SizedBox(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: MediaQuery.of(context).size.height,
|
||||
child: SingleChildScrollView(
|
||||
physics: BouncingScrollPhysics(),
|
||||
// physics: BouncingScrollPhysics(),
|
||||
child: Column(
|
||||
children: [
|
||||
SizedBox(
|
||||
height: 270,
|
||||
child: Swiper(
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
key: ValueKey<int>(index),
|
||||
padding: EdgeInsets.only(bottom: 30),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
goChatPage(bannerList[index].actionId.toString());
|
||||
child: bannerList.isNotEmpty
|
||||
? Swiper(
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return Container(
|
||||
key: ValueKey<int>(index),
|
||||
padding: EdgeInsets.only(bottom: 30),
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
goChatPage(bannerList[index].actionId.toString());
|
||||
},
|
||||
child: CachedNetworkImage(
|
||||
fit: BoxFit.fill,
|
||||
imageUrl: bannerList[index].imageUrl!,
|
||||
errorWidget: (context, url, error) => const Icon(Icons.error),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: CachedNetworkImage(
|
||||
fit: BoxFit.fill,
|
||||
imageUrl: bannerList[index].imageUrl!,
|
||||
errorWidget: (context, url, error) => const Icon(Icons.error),
|
||||
itemCount: bannerList.length,
|
||||
pagination: SwiperPagination(
|
||||
// 此处使用自己编写的样式
|
||||
builder: CustomSwiperPaginationBuilder(
|
||||
alignment: Alignment.bottomRight, color: Color(0xFF646464), activeColor: Color(0xFFCFCFCF)),
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
itemCount: bannerList.length,
|
||||
pagination: SwiperPagination(
|
||||
// 此处使用自己编写的样式
|
||||
builder:
|
||||
CustomSwiperPaginationBuilder(alignment: Alignment.bottomRight, color: Color(0xFF646464), activeColor: Color(0xFFCFCFCF)),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(),
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
|
|||
}
|
||||
|
||||
///删除消息
|
||||
delChat(int id, index) {
|
||||
deleteChat(int id, index) {
|
||||
EasyLoading.show(status: 'loading...');
|
||||
delIndex = index;
|
||||
List<int> ids = [id];
|
||||
|
|
@ -348,13 +348,27 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
|
|||
Expanded(
|
||||
child: Align(
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
controller: _scrollController,
|
||||
itemCount: chatList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return _item(index);
|
||||
}),
|
||||
child: ShaderMask(
|
||||
shaderCallback: (Rect bounds) {
|
||||
return const LinearGradient(
|
||||
begin: Alignment.topCenter,
|
||||
end: Alignment.bottomCenter,
|
||||
colors: [
|
||||
Colors.transparent,
|
||||
Colors.white,
|
||||
],
|
||||
stops: [0.0, 0.1], // 调整透明的范围
|
||||
).createShader(bounds);
|
||||
},
|
||||
blendMode: BlendMode.dstIn,
|
||||
child: ListView.builder(
|
||||
shrinkWrap: true,
|
||||
controller: _scrollController,
|
||||
itemCount: chatList.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
return _item(index);
|
||||
}),
|
||||
),
|
||||
)),
|
||||
// Container(
|
||||
// alignment: Alignment.centerLeft,
|
||||
|
|
@ -555,7 +569,6 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
|
|||
],
|
||||
),
|
||||
),
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
@ -622,7 +635,7 @@ class _HomeChatPageState extends State<HomeChatPage> with AutomaticKeepAliveClie
|
|||
|
||||
///聊天内容
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
padding: const EdgeInsets.only(bottom: 8),
|
||||
child: chatList[index].role != 'user'
|
||||
? Container(
|
||||
///AI
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ dependencies:
|
|||
card_swiper: ^3.0.1
|
||||
flutter_slidable: ^3.1.0
|
||||
flutter_keyboard_visibility: ^6.0.0
|
||||
custom_pop_up_menu: ^1.2.4
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user