修改附近版本滚动范围限制
This commit is contained in:
parent
0b20ed0927
commit
bb286c94ae
@ -25,13 +25,25 @@ class Vicinity extends StatefulWidget {
|
|||||||
class _VicinityState extends State<Vicinity> with AutomaticKeepAliveClientMixin {
|
class _VicinityState extends State<Vicinity> with AutomaticKeepAliveClientMixin {
|
||||||
var sub;
|
var sub;
|
||||||
ScrollController _scrollController = ScrollController();
|
ScrollController _scrollController = ScrollController();
|
||||||
|
|
||||||
|
double maxOff = 0;
|
||||||
|
@override
|
||||||
|
bool get wantKeepAlive => true;
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
// TODO: implement initState
|
||||||
super.initState();
|
super.initState();
|
||||||
sub = EventBusManager.on<NearScrollTap>().listen((event) {
|
sub = EventBusManager.on<NearScrollTap>().listen((event) {
|
||||||
_scrollController.animateTo(0,
|
if (widget.logic.myVip > 0) {
|
||||||
duration: const Duration(milliseconds: 300), curve: Curves.easeInOut);
|
_scrollController.animateTo(0,
|
||||||
|
duration: const Duration(milliseconds: 300), curve: Curves.easeInOut);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
_scrollController.addListener(() {
|
||||||
|
if (maxOff > 0 && widget.logic.myVip == 0 && _scrollController.offset >= maxOff) {
|
||||||
|
_scrollController.jumpTo(maxOff);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -40,13 +52,14 @@ class _VicinityState extends State<Vicinity> with AutomaticKeepAliveClientMixin
|
|||||||
// TODO: implement dispose
|
// TODO: implement dispose
|
||||||
super.dispose();
|
super.dispose();
|
||||||
_scrollController.dispose();
|
_scrollController.dispose();
|
||||||
|
|
||||||
sub.cancel();
|
sub.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// TODO: add widget build method
|
// TODO: add widget build method
|
||||||
if (widget.logic.myVip == 0) {
|
if (widget.logic.myVip == 0 && _scrollController.offset > Get.height) {
|
||||||
_scrollController.jumpTo(_scrollController.offset - 150.sp);
|
_scrollController.jumpTo(_scrollController.offset - 150.sp);
|
||||||
}
|
}
|
||||||
return widget.logic.vicinityList.isNotEmpty ? Stack(
|
return widget.logic.vicinityList.isNotEmpty ? Stack(
|
||||||
@ -59,7 +72,6 @@ class _VicinityState extends State<Vicinity> with AutomaticKeepAliveClientMixin
|
|||||||
enablePullUp: true,
|
enablePullUp: true,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
controller: _scrollController,
|
controller: _scrollController,
|
||||||
physics: widget.logic.myVip ==0 ? NeverScrollableScrollPhysics() : BouncingScrollPhysics(),
|
|
||||||
padding: EdgeInsets.all(10.sp),
|
padding: EdgeInsets.all(10.sp),
|
||||||
itemCount: widget.logic.vicinityList.length + 1,
|
itemCount: widget.logic.vicinityList.length + 1,
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
@ -461,6 +473,9 @@ class _VicinityState extends State<Vicinity> with AutomaticKeepAliveClientMixin
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _onLoading() async {
|
void _onLoading() async {
|
||||||
|
if (widget.logic.vicinityPage == 2 && maxOff == 0) {
|
||||||
|
maxOff = _scrollController.offset - 170.sp;
|
||||||
|
}
|
||||||
// if (widget.logic.myVip > 0) {
|
// if (widget.logic.myVip > 0) {
|
||||||
// widget.logic.vicinityPage = widget.logic.vicinityPage + 1;
|
// widget.logic.vicinityPage = widget.logic.vicinityPage + 1;
|
||||||
// logic.offset = 0;
|
// logic.offset = 0;
|
||||||
@ -471,7 +486,4 @@ class _VicinityState extends State<Vicinity> with AutomaticKeepAliveClientMixin
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
// TODO: implement wantKeepAlive
|
|
||||||
bool get wantKeepAlive => true;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -153,7 +153,7 @@ class LoginLogic extends GetxController {
|
|||||||
data, (data) => MineResponseBean.fromJson(data));
|
data, (data) => MineResponseBean.fromJson(data));
|
||||||
if (bean.isSuccess()) {
|
if (bean.isSuccess()) {
|
||||||
if (!bean.data.has_pwd) {
|
if (!bean.data.has_pwd) {
|
||||||
Get.offNamed(AppRoutes.SetPasswordActivity);
|
Get.toNamed(AppRoutes.SetPasswordActivity);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -70,7 +70,7 @@ class MinefragmentPage extends StatelessWidget {
|
|||||||
child: Stack(children: [
|
child: Stack(children: [
|
||||||
logic.isProxy ? MyImageWidget1 : MyImageWidget,
|
logic.isProxy ? MyImageWidget1 : MyImageWidget,
|
||||||
Positioned(
|
Positioned(
|
||||||
top: 24.sp,
|
top:(Platform.isIOS && Get.statusBarHeight < 60) ? 30.sp : 24.sp,
|
||||||
left: 78.sp,
|
left: 78.sp,
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
@ -84,6 +84,7 @@ class MinefragmentPage extends StatelessWidget {
|
|||||||
],),
|
],),
|
||||||
),
|
),
|
||||||
_circleLiveView(logic),
|
_circleLiveView(logic),
|
||||||
|
Container(height: 20.sp,)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -20,6 +20,7 @@ class SetpasswordLogic extends GetxController {
|
|||||||
});
|
});
|
||||||
var bean = BaseResponse<String>.fromJson(data, (data) => data);
|
var bean = BaseResponse<String>.fromJson(data, (data) => data);
|
||||||
if (bean.isSuccess()) {
|
if (bean.isSuccess()) {
|
||||||
|
showOKToast('密码设置成功');
|
||||||
Get.offAllNamed(AppRoutes.Home);
|
Get.offAllNamed(AppRoutes.Home);
|
||||||
} else {
|
} else {
|
||||||
showOKToast(bean.msg);
|
showOKToast(bean.msg);
|
||||||
|
|||||||
@ -37,12 +37,10 @@ final TUIChatSeparateViewModel chatSeparateViewModel =
|
|||||||
TUIChatSeparateViewModel();
|
TUIChatSeparateViewModel();
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
|
|
||||||
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
|
|
||||||
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
|
|
||||||
FlutterBugly.postCatchedException(() {
|
FlutterBugly.postCatchedException(() {
|
||||||
// 如果需要 ensureInitialized,请在这里运行。
|
// 如果需要 ensureInitialized,请在这里运行。
|
||||||
// WidgetsFlutterBinding.ensureInitialized();
|
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
|
||||||
runApp(MyApp());
|
runApp(MyApp());
|
||||||
FlutterBugly.init(
|
FlutterBugly.init(
|
||||||
androidAppId: "8509314e11",
|
androidAppId: "8509314e11",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user