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