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