import 'package:abroad_location/base/base_controller.dart'; import 'package:get/get.dart'; import 'package:injectable/injectable.dart'; import 'package:sliding_sheet2/sliding_sheet2.dart'; import '../../data/bean/user_info.dart'; @injectable class LocationController extends BaseController { SheetController sheetController = SheetController(); final RxDouble _sheetProgress = 0.0.obs; double get sheetProgress => _sheetProgress.value; final Rxn _selectUserInfo = Rxn(); UserInfo? get selectUserInfo => _selectUserInfo.value; final RxList locationFriendList = RxList(); final RxBool _isFindContact = false.obs; bool get isFindContact => _isFindContact.value; final findContactAnimatedDuration = const Duration(milliseconds: 250); @override void onReady() { super.onReady(); //*******测试******* for (int i = 0; i < 20; i++) { locationFriendList.add(UserInfo( id: 'id$i', phoneNumber: 'phoneNumber$i', remark: 'remark$i', timestamp: 1234567890, blockedHim: false, blockedMe: false, virtual: false, isMine: false, )); } _selectUserInfo.value = locationFriendList[0]; //********** } setSheetProgress(double progress) { _sheetProgress.value = progress; } onSelectItemClick(UserInfo userInfo) async { _selectUserInfo.value = userInfo; await sheetController.scrollTo(0, duration: Duration(milliseconds: 1)); sheetController.snapToExtent(0, duration: Duration(milliseconds: 350)); } void onFindContactClick() { _isFindContact.value = !isFindContact; } }