聊天列表顶部遮罩.

This commit is contained in:
18631081161 2024-07-21 16:58:40 +08:00
parent 48769e1e98
commit 8d21b8755a
4 changed files with 73 additions and 43 deletions

View File

@ -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),

View File

@ -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,

View File

@ -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

View File

@ -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: