点击发现 滑动到顶部
This commit is contained in:
parent
14fbbe356f
commit
59c0969691
@ -135,6 +135,7 @@ class User {
|
|||||||
double? lng;
|
double? lng;
|
||||||
String? nickname;
|
String? nickname;
|
||||||
int? orientation;
|
int? orientation;
|
||||||
|
String? avatar_thumb;
|
||||||
int? role;
|
int? role;
|
||||||
int vip = 0;
|
int vip = 0;
|
||||||
|
|
||||||
@ -147,6 +148,7 @@ class User {
|
|||||||
this.lng,
|
this.lng,
|
||||||
this.age,
|
this.age,
|
||||||
this.nickname,
|
this.nickname,
|
||||||
|
this.avatar_thumb,
|
||||||
this.orientation,
|
this.orientation,
|
||||||
this.role,
|
this.role,
|
||||||
this.vip=0});
|
this.vip=0});
|
||||||
@ -160,6 +162,7 @@ class User {
|
|||||||
lat = json['lat'] ?? 0.0;
|
lat = json['lat'] ?? 0.0;
|
||||||
lng = json['lng'] ?? 0.0;
|
lng = json['lng'] ?? 0.0;
|
||||||
nickname = json['nickname'];
|
nickname = json['nickname'];
|
||||||
|
avatar_thumb = json['avatar_thumb'];
|
||||||
orientation = json['orientation'];
|
orientation = json['orientation'];
|
||||||
role = json['role'];
|
role = json['role'];
|
||||||
vip = json['vip'];
|
vip = json['vip'];
|
||||||
|
|||||||
@ -19,6 +19,8 @@ class CirclePage extends StatefulWidget {
|
|||||||
|
|
||||||
class _CirclePageState extends State<CirclePage>
|
class _CirclePageState extends State<CirclePage>
|
||||||
with AutomaticKeepAliveClientMixin {
|
with AutomaticKeepAliveClientMixin {
|
||||||
|
|
||||||
|
final ScrollController scrollController = ScrollController();
|
||||||
@override
|
@override
|
||||||
bool get wantKeepAlive => true;
|
bool get wantKeepAlive => true;
|
||||||
|
|
||||||
@ -60,7 +62,7 @@ class _CirclePageState extends State<CirclePage>
|
|||||||
child: Swiper(
|
child: Swiper(
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
var bean = logic.circle.lists[index];
|
var bean = logic.circle.lists[index];
|
||||||
return InfoListView(index, bean, logic);
|
return InfoListView(index, bean, logic,scrollController);
|
||||||
},
|
},
|
||||||
onIndexChanged: (index) {
|
onIndexChanged: (index) {
|
||||||
controller.state.index = index;
|
controller.state.index = index;
|
||||||
@ -166,13 +168,22 @@ class _CirclePageState extends State<CirclePage>
|
|||||||
colors: [Color(0xff71F3F2), Color(0xffF657FF)],
|
colors: [Color(0xff71F3F2), Color(0xffF657FF)],
|
||||||
).createShader(Offset.zero & bounds.size);
|
).createShader(Offset.zero & bounds.size);
|
||||||
},
|
},
|
||||||
child: Text(
|
child: GestureDetector(
|
||||||
'发现',
|
onTap: (){
|
||||||
style: TextStyle(
|
scrollController.animateTo(
|
||||||
fontSize: 18.sp,
|
0.0, // Scroll to the top
|
||||||
fontWeight: FontWeight.w600,
|
duration: Duration(milliseconds: 300),
|
||||||
color: Colors.white,
|
curve: Curves.easeInOut,
|
||||||
shadows: const [Shadow(color: Color(0xffF657FF), offset: Offset(0.0, -1))],
|
);
|
||||||
|
},
|
||||||
|
child: Text(
|
||||||
|
'发现',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 18.sp,
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: Colors.white,
|
||||||
|
shadows: const [Shadow(color: Color(0xffF657FF), offset: Offset(0.0, -1))],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -23,8 +23,9 @@ class InfoListView extends StatefulWidget {
|
|||||||
var logic;
|
var logic;
|
||||||
Circle bean;
|
Circle bean;
|
||||||
int index;
|
int index;
|
||||||
|
ScrollController scrollController;
|
||||||
|
|
||||||
InfoListView(this.index, this.bean, this.logic, {super.key});
|
InfoListView(this.index, this.bean, this.logic,this.scrollController, {super.key});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<InfoListView> createState() => _InfoListViewState();
|
State<InfoListView> createState() => _InfoListViewState();
|
||||||
@ -44,13 +45,13 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
|||||||
bool callOutMore = true;
|
bool callOutMore = true;
|
||||||
var circleId = '';
|
var circleId = '';
|
||||||
List<Lists> lists = [];
|
List<Lists> lists = [];
|
||||||
final ScrollController scrollController = ScrollController();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO: implement dispose
|
// TODO: implement dispose
|
||||||
super.dispose();
|
super.dispose();
|
||||||
scrollController.dispose();
|
widget.scrollController.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -58,10 +59,10 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
|||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
// TODO: implement initState
|
||||||
super.initState();
|
super.initState();
|
||||||
scrollController.addListener(() {
|
widget.scrollController.addListener(() {
|
||||||
try {
|
try {
|
||||||
if (scrollController.position.pixels ==
|
if (widget.scrollController.position.pixels ==
|
||||||
scrollController.position.maxScrollExtent) {
|
widget.scrollController.position.maxScrollExtent) {
|
||||||
loadMore();
|
loadMore();
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
@ -231,7 +232,7 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
|||||||
ListView.builder(
|
ListView.builder(
|
||||||
physics: const AlwaysScrollableScrollPhysics(),
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
scrollDirection: Axis.vertical,
|
scrollDirection: Axis.vertical,
|
||||||
controller: scrollController,
|
controller: widget.scrollController,
|
||||||
itemCount: lists.length + 2,
|
itemCount: lists.length + 2,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
@ -361,34 +362,44 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Container(
|
child: GestureDetector(
|
||||||
|
behavior: HitTestBehavior.opaque,
|
||||||
|
onTap: (){
|
||||||
|
widget.scrollController.animateTo(
|
||||||
|
0.0, // Scroll to the top
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Container(
|
||||||
padding: EdgeInsets.only(left: 8.sp, top: 12.sp),
|
padding: EdgeInsets.only(left: 8.sp, top: 12.sp),
|
||||||
// alignment: Alignment.,
|
// alignment: Alignment.,
|
||||||
height: 72.sp,
|
height: 72.sp,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
widget.bean.title,
|
widget.bean.title,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
fontSize: 18.sp,
|
fontSize: 18.sp,
|
||||||
fontWeight: FontWeight.w600),
|
fontWeight: FontWeight.w600),
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: 4.sp,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
'${convertToTenThousand(widget.bean.viewTotal)}人看过',
|
|
||||||
textAlign: TextAlign.left,
|
|
||||||
style: TextStyle(
|
|
||||||
color: const Color(0xff03FEFB),
|
|
||||||
fontSize: 12.sp,
|
|
||||||
),
|
),
|
||||||
),
|
SizedBox(
|
||||||
],
|
height: 4.sp,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'${convertToTenThousand(widget.bean.viewTotal)}人看过',
|
||||||
|
textAlign: TextAlign.left,
|
||||||
|
style: TextStyle(
|
||||||
|
color: const Color(0xff03FEFB),
|
||||||
|
fontSize: 12.sp,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
|
)),
|
||||||
GestureDetector(//加入圈子
|
GestureDetector(//加入圈子
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
if (widget.bean.isJoin) {
|
if (widget.bean.isJoin) {
|
||||||
@ -609,7 +620,7 @@ class _InfoListViewState extends State<InfoListView> with AutomaticKeepAliveClie
|
|||||||
),
|
),
|
||||||
ClipOval(
|
ClipOval(
|
||||||
child: Image.network(
|
child: Image.network(
|
||||||
lists.user!.avatar!,
|
lists.user!.avatar_thumb!,
|
||||||
width: 40.sp,
|
width: 40.sp,
|
||||||
height: 40.sp,
|
height: 40.sp,
|
||||||
fit: BoxFit.cover,
|
fit: BoxFit.cover,
|
||||||
|
|||||||
@ -28,6 +28,7 @@ class _My_circlePageState extends State<My_circlePage>
|
|||||||
final state = Get.find<MyCircleLogic>().state;
|
final state = Get.find<MyCircleLogic>().state;
|
||||||
|
|
||||||
var getContext;
|
var getContext;
|
||||||
|
final ScrollController scrollController = ScrollController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -57,7 +58,7 @@ class _My_circlePageState extends State<My_circlePage>
|
|||||||
child: logic.circle.lists.isEmpty ? loaddingWidget(true) : Swiper(
|
child: logic.circle.lists.isEmpty ? loaddingWidget(true) : Swiper(
|
||||||
itemBuilder: (BuildContext context, int index) {
|
itemBuilder: (BuildContext context, int index) {
|
||||||
var bean = logic.circle.lists[index];
|
var bean = logic.circle.lists[index];
|
||||||
return InfoListView(index, bean, controller);
|
return InfoListView(index, bean, controller,scrollController);
|
||||||
},
|
},
|
||||||
index: controller.state.index,
|
index: controller.state.index,
|
||||||
itemCount: logic.circle.lists.length,
|
itemCount: logic.circle.lists.length,
|
||||||
@ -88,6 +89,13 @@ class _My_circlePageState extends State<My_circlePage>
|
|||||||
backNavigatorItem() {
|
backNavigatorItem() {
|
||||||
return MyAppBar(
|
return MyAppBar(
|
||||||
centerTitle: '我的圈子',
|
centerTitle: '我的圈子',
|
||||||
|
onPressed: (){
|
||||||
|
scrollController.animateTo(
|
||||||
|
0.0, // Scroll to the top
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
curve: Curves.easeInOut,
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -13,14 +13,14 @@ class Signal_circle_listPage extends StatelessWidget {
|
|||||||
|
|
||||||
final logic = Get.find<Signal_circle_listLogic>();
|
final logic = Get.find<Signal_circle_listLogic>();
|
||||||
final state = Get.find<Signal_circle_listLogic>().state;
|
final state = Get.find<Signal_circle_listLogic>().state;
|
||||||
|
final ScrollController scrollController = ScrollController();
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
width: MediaQuery.of(context).size.width,
|
width: MediaQuery.of(context).size.width,
|
||||||
height: MediaQuery.of(context).size.height,
|
height: MediaQuery.of(context).size.height,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: Color(0xFF423055),
|
color: const Color(0xFF423055),
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
fit: BoxFit.fill,
|
fit: BoxFit.fill,
|
||||||
image: AssetImage(getBaseImage('home_back')))),
|
image: AssetImage(getBaseImage('home_back')))),
|
||||||
@ -29,6 +29,7 @@ class Signal_circle_listPage extends StatelessWidget {
|
|||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
appBar: MyAppBar(
|
appBar: MyAppBar(
|
||||||
centerTitle: logic.circle?.title ?? '',
|
centerTitle: logic.circle?.title ?? '',
|
||||||
|
|
||||||
),
|
),
|
||||||
body: Container(
|
body: Container(
|
||||||
padding: EdgeInsets.only(left: 15.sp, right: 15.sp),
|
padding: EdgeInsets.only(left: 15.sp, right: 15.sp),
|
||||||
@ -41,7 +42,7 @@ class Signal_circle_listPage extends StatelessWidget {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: controller.circle == null
|
child: controller.circle == null
|
||||||
? loaddingWidget(true)
|
? loaddingWidget(true)
|
||||||
: InfoListView(0, controller.circle!, controller))
|
: InfoListView(0, controller.circle!, controller,scrollController))
|
||||||
]),
|
]),
|
||||||
));
|
));
|
||||||
}));
|
}));
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user